Sourced wnframework-modules from Google Code as erpnext
diff --git a/Dependencies b/Dependencies
new file mode 100755
index 0000000..173be1f
--- /dev/null
+++ b/Dependencies
@@ -0,0 +1,4 @@
+Install these python packages(using easy_install??
+
+1.suds
+2.
diff --git a/INSTALL.txt b/INSTALL.txt
new file mode 100755
index 0000000..d3b06fe
--- /dev/null
+++ b/INSTALL.txt
@@ -0,0 +1,29 @@
+
+0. Make sure the wnmodules folder has the read,write,execute permissions for user,group and others.
+
+1. After installing wnframework using the INSTALL.txt file from that project, do the following:
+	edit the defs.py file and set the variables as the templates there say.	
+
+2. Install dateutil module (apt-get install python-dateutil)
+		
+3. Unzip master.sql.gz in the modules folder
+
+4. goto  cgi-bin folder in wnframework and execute
+   python webnotes/install_lib/install.py root dbrootpassword dbname -s modules/master.sql
+
+   where:
+      root is the root database login
+      dbrootpassword is the root password
+      dbname is the name of the database you want to create for the ERP
+
+5. Login 
+   Set permissions through Profile(on top toolbar)-->Roles
+   Permission: System Manager, Sales User etc.
+   Tools-->Clear Cache, and refresh your browser.
+
+6. Go to Control Panel --> Set Company Name  --> Clear Cache --> Refresh the system  --> Go to Home  --> Enter Company Abbr, Year begin date, currency and Save it.
+
+7. Go to Setup-->System-->Global Defaults, save it.
+
+
+
diff --git a/accounts/DocType Label/Payable Voucher/Payable Voucher.txt b/accounts/DocType Label/Payable Voucher/Payable Voucher.txt
new file mode 100644
index 0000000..d12b2d2
--- /dev/null
+++ b/accounts/DocType Label/Payable Voucher/Payable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Payable Voucher', 'parent': None, 'dt_label': 'Purchase Invoice', 'creation': '2010-06-10 10:44:55', 'modified': '2010-06-10 10:44:55', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Payable Voucher', 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/DocType Label/QA Inspection Report/QA Inspection Report.txt b/accounts/DocType Label/QA Inspection Report/QA Inspection Report.txt
new file mode 100644
index 0000000..a4d266f
--- /dev/null
+++ b/accounts/DocType Label/QA Inspection Report/QA Inspection Report.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'QA Inspection Report', 'parent': None, 'dt_label': 'Quality Inspection', 'creation': '2010-06-28 12:56:06', 'modified': '2010-06-28 12:56:06', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'QA Inspection Report', 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/DocType Label/Receivable Voucher/Receivable Voucher.txt b/accounts/DocType Label/Receivable Voucher/Receivable Voucher.txt
new file mode 100644
index 0000000..459e4b8
--- /dev/null
+++ b/accounts/DocType Label/Receivable Voucher/Receivable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Receivable Voucher', 'parent': None, 'dt_label': 'Sales Invoice', 'creation': '2010-06-10 10:44:40', 'modified': '2010-06-10 10:44:40', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Receivable Voucher', 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/DocType Label/Ticket/Ticket.txt b/accounts/DocType Label/Ticket/Ticket.txt
new file mode 100644
index 0000000..8707e8f
--- /dev/null
+++ b/accounts/DocType Label/Ticket/Ticket.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Ticket', 'parent': None, 'dt_label': 'Task', 'creation': '2010-06-28 12:55:47', 'modified': '2010-06-28 12:55:47', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Ticket', 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt b/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt
new file mode 100644
index 0000000..b4a8cf6
--- /dev/null
+++ b/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt
@@ -0,0 +1 @@
+[{'doc_type': 'Journal Voucher', 'modified_by': 'nabin@webnotestech.com', 'name': 'Journal Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-04-30 17:56:41', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': "value:d.against_voucher or d.against_invoice or ''", 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'debit', 'docstatus': 0, 'parent': 'Journal Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': 'is_advance', 'remarks': 'parent:remark', 'account': 'account', 'name': 'GLMDetail00001', 'idx': 1, 'against_voucher_type': "value:(d.against_voucher and 'Payable Voucher') or (d.against_invoice and 'Receivable Voucher') or ''", 'modified': '2010-04-30 17:56:41', 'against': 'against_account', 'credit': 'credit', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-06-11 11:09:11', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': '', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Journal Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': '', 'remarks': 'remark', 'account': 'tax_code', 'name': 'GLMDetail00009', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-04-30 17:56:41', 'against': 'supplier_account', 'credit': 'ded_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/GL Mapper/POS with write off/POS with write off.txt b/accounts/GL Mapper/POS with write off/POS with write off.txt
new file mode 100644
index 0000000..a6715c6
--- /dev/null
+++ b/accounts/GL Mapper/POS with write off/POS with write off.txt
@@ -0,0 +1,233 @@
+[
+	{
+		'creation': '2011-05-10 11:21:22',
+		'doc_type': 'POS with write off',
+		'docstatus': 0,
+		'doctype': 'GL Mapper',
+		'idx': None,
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': 'POS with write off',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None
+	},
+	{
+		'account': 'income_account',
+		'against': 'parent:debit_to',
+		'against_voucher': None,
+		'against_voucher_type': None,
+		'aging_date': 'parent:aging_date',
+		'company': 'parent:company',
+		'cost_center': 'cost_center',
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'amount',
+		'debit': 'value:0',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'parent:fiscal_year',
+		'idx': 1,
+		'is_advance': None,
+		'is_opening': 'parent:is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002752',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'parent:posting_date',
+		'remarks': 'parent:remarks',
+		'table_field': 'entries',
+		'transaction_date': 'parent:voucher_date',
+		'voucher_no': 'parent:name',
+		'voucher_type': 'parent:doctype'
+	},
+	{
+		'account': 'account_head',
+		'against': 'parent:debit_to',
+		'against_voucher': None,
+		'against_voucher_type': None,
+		'aging_date': 'parent:aging_date',
+		'company': 'parent:company',
+		'cost_center': 'cost_center_other_charges',
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'tax_amount',
+		'debit': 'value:0',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'parent:fiscal_year',
+		'idx': 2,
+		'is_advance': None,
+		'is_opening': 'parent:is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002753',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'parent:posting_date',
+		'remarks': 'parent:remarks',
+		'table_field': 'other_charges',
+		'transaction_date': 'parent:voucher_date',
+		'voucher_no': 'parent:name',
+		'voucher_type': 'parent:doctype'
+	},
+	{
+		'account': 'debit_to',
+		'against': 'against_income_account',
+		'against_voucher': 'name',
+		'against_voucher_type': 'doctype',
+		'aging_date': 'aging_date',
+		'company': 'company',
+		'cost_center': None,
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'value:0',
+		'debit': 'grand_total',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'fiscal_year',
+		'idx': 3,
+		'is_advance': None,
+		'is_opening': 'is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002754',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'posting_date',
+		'remarks': 'remarks',
+		'table_field': None,
+		'transaction_date': 'voucher_date',
+		'voucher_no': 'name',
+		'voucher_type': 'doctype'
+	},
+	{
+		'account': 'debit_to',
+		'against': 'cash_bank_account',
+		'against_voucher': 'name',
+		'against_voucher_type': 'doctype',
+		'aging_date': 'aging_date',
+		'company': 'company',
+		'cost_center': None,
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'paid_amount',
+		'debit': 'value:0',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'fiscal_year',
+		'idx': 4,
+		'is_advance': None,
+		'is_opening': 'is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002755',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'posting_date',
+		'remarks': 'remarks',
+		'table_field': None,
+		'transaction_date': 'voucher_date',
+		'voucher_no': 'name',
+		'voucher_type': 'doctype'
+	},
+	{
+		'account': 'debit_to',
+		'against': 'write_off_account',
+		'against_voucher': 'name',
+		'against_voucher_type': 'doctype',
+		'aging_date': 'aging_date',
+		'company': 'company',
+		'cost_center': None,
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'write_off_amount',
+		'debit': 'value:0',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'fiscal_year',
+		'idx': 5,
+		'is_advance': None,
+		'is_opening': 'is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002758',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'posting_date',
+		'remarks': 'remarks',
+		'table_field': None,
+		'transaction_date': 'voucher_date',
+		'voucher_no': 'name',
+		'voucher_type': 'doctype'
+	},
+	{
+		'account': 'cash_bank_account',
+		'against': 'debit_to',
+		'against_voucher': None,
+		'against_voucher_type': None,
+		'aging_date': 'aging_date',
+		'company': 'company',
+		'cost_center': None,
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'value:0',
+		'debit': 'paid_amount',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'fiscal_year',
+		'idx': 6,
+		'is_advance': None,
+		'is_opening': 'is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002756',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'posting_date',
+		'remarks': 'remarks',
+		'table_field': None,
+		'transaction_date': 'voucher_date',
+		'voucher_no': 'name',
+		'voucher_type': 'doctype'
+	},
+	{
+		'account': 'write_off_account',
+		'against': 'debit_to',
+		'against_voucher': None,
+		'against_voucher_type': None,
+		'aging_date': 'aging_date',
+		'company': 'company',
+		'cost_center': 'write_off_cost_center',
+		'creation': '2011-05-10 11:21:22',
+		'credit': 'value:0',
+		'debit': 'write_off_amount',
+		'docstatus': 0,
+		'doctype': 'GL Mapper Detail',
+		'fiscal_year': 'fiscal_year',
+		'idx': 7,
+		'is_advance': None,
+		'is_opening': 'is_opening',
+		'modified': '2011-05-10 11:21:22',
+		'modified_by': 'Administrator',
+		'name': '000002757',
+		'owner': 'Administrator',
+		'parent': 'POS with write off',
+		'parentfield': 'fields',
+		'parenttype': 'GL Mapper',
+		'posting_date': 'posting_date',
+		'remarks': 'remarks',
+		'table_field': None,
+		'transaction_date': 'voucher_date',
+		'voucher_no': 'name',
+		'voucher_type': 'doctype'
+	}
+]
\ No newline at end of file
diff --git a/accounts/GL Mapper/POS/POS.txt b/accounts/GL Mapper/POS/POS.txt
new file mode 100644
index 0000000..dc95439
--- /dev/null
+++ b/accounts/GL Mapper/POS/POS.txt
@@ -0,0 +1 @@
+[{'doc_type': 'POS', 'modified_by': 'Administrator', 'name': 'POS', 'parent': None, 'creation': '2010-12-14 16:40:09', 'modified': '2010-12-14 20:15:04', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2010-12-14 16:40:09', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'POS', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'income_account', 'name': 'GLMDetail00010', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-12-14 20:15:04', 'against': 'parent:debit_to', 'credit': 'amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2010-12-14 16:40:09', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center_other_charges', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'other_charges', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'POS', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00011', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-12-14 20:15:04', 'against': 'parent:debit_to', 'credit': 'tax_amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2010-12-14 16:40:09', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': None, 'voucher_no': 'name', 'modified_by': 'Administrator', 'against_voucher': 'name', 'table_field': None, 'transaction_date': 'voucher_date', 'debit': 'grand_total', 'docstatus': 0, 'parent': 'POS', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'debit_to', 'name': 'GLMDetail00012', 'idx': 3, 'against_voucher_type': 'doctype', 'modified': '2010-12-14 20:15:04', 'against': 'against_income_account', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}, {'creation': '2010-12-14 16:40:09', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'Administrator', 'against_voucher': 'name', 'table_field': None, 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'POS', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'debit_to', 'name': 'GLMDetail00013', 'idx': 4, 'against_voucher_type': 'doctype', 'modified': '2010-12-14 20:15:04', 'against': 'cash_bank_account', 'credit': 'paid_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}, {'creation': '2010-12-14 16:40:09', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'Administrator', 'against_voucher': '', 'table_field': None, 'transaction_date': 'voucher_date', 'debit': 'paid_amount', 'docstatus': 0, 'parent': 'POS', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'cash_bank_account', 'name': 'GLMDetail00014', 'idx': 5, 'against_voucher_type': '', 'modified': '2010-12-14 20:15:04', 'against': 'debit_to', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/GL Mapper/Payable Voucher/Payable Voucher.txt b/accounts/GL Mapper/Payable Voucher/Payable Voucher.txt
new file mode 100644
index 0000000..eeeea70
--- /dev/null
+++ b/accounts/GL Mapper/Payable Voucher/Payable Voucher.txt
@@ -0,0 +1 @@
+[{'doc_type': 'Payable Voucher', 'modified_by': 'nabin@webnotestech.com', 'name': 'Payable Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-05-26 16:48:58', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'amount', 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'expense_head', 'name': 'GLMDetail00002', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'parent:credit_to', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': 'purchase_tax_details', 'transaction_date': 'parent:voucher_date', 'debit': "value:d.fields.get('category') != 'For Valuation' and d.fields.get('add_deduct_tax') == 'Add' and d.fields.get('tax_amount') or 0", 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00003', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'parent:credit_to', 'credit': "value:d.fields.get('category') != 'For Valuation' and d.fields.get('add_deduct_tax') == 'Deduct' and d.fields.get('tax_amount') or 0", 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'tax_code', 'name': 'GLMDetail00004', 'idx': 3, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'credit_to', 'credit': 'ded_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': 'name', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'credit_to', 'name': 'GLMDetail00005', 'idx': 4, 'against_voucher_type': "value:'Payable Voucher'", 'modified': '2010-05-26 16:48:58', 'against': 'against_expense_account', 'credit': 'total_amount_to_pay', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/GL Mapper/Receivable Voucher/Receivable Voucher.txt b/accounts/GL Mapper/Receivable Voucher/Receivable Voucher.txt
new file mode 100644
index 0000000..72d0175
--- /dev/null
+++ b/accounts/GL Mapper/Receivable Voucher/Receivable Voucher.txt
@@ -0,0 +1 @@
+[{'doc_type': 'Receivable Voucher', 'modified_by': 'Administrator', 'name': 'Receivable Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-05-17 08:59:14', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Receivable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'income_account', 'name': 'GLMDetail00006', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-05-17 08:59:14', 'against': 'parent:debit_to', 'credit': 'amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center_other_charges', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'other_charges', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Receivable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00007', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-05-17 08:59:14', 'against': 'parent:debit_to', 'credit': 'tax_amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'Administrator', 'against_voucher': 'name', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'grand_total', 'docstatus': 0, 'parent': 'Receivable Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'debit_to', 'name': 'GLMDetail00008', 'idx': 3, 'against_voucher_type': "value:'Receivable Voucher'", 'modified': '2010-05-17 08:59:14', 'against': 'against_income_account', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/Module Def/Accounts/Accounts.txt b/accounts/Module Def/Accounts/Accounts.txt
new file mode 100644
index 0000000..3b57c5d
--- /dev/null
+++ b/accounts/Module Def/Accounts/Accounts.txt
@@ -0,0 +1,737 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-09-25 10:50:37',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': 'GL Mapper, Journal Voucher\nGL Mapper, Payable Voucher\nGL Mapper, Receivable Voucher\nDocType Label, Receivable Voucher\nDocType Label, Payable Voucher\nDocType Label, QA Inspection Report\nDocType Label, Ticket',
+		'file_list': 'finance.gif,FileData/00210',
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-12-08 10:13:30',
+		'modified': '2011-05-24 14:48:44',
+		'modified_by': 'Administrator',
+		'module_desc': 'Data about your payables, receivables and books of accounts',
+		'module_icon': 'Accounts.gif',
+		'module_label': 'Accounts',
+		'module_name': 'Accounts',
+		'module_page': None,
+		'module_seq': 5,
+		'name': 'Accounts',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': "var acc_set_tips = function() {\n  $c_obj('Module Tip Control', 'get_tip', 'accounts', function(r,rt) { \n    if(r.message) {\n      $(parent.tip_area).html('<b>Tip: </b>' + r.message).css('display','block');\n    }\n  } );\n}\n\nacc_set_tips();"
+	},
+	{
+		'click_function': "show_chart_browser('Accounts Browser','Account')",
+		'creation': '2010-10-04 17:16:24',
+		'description': 'Manage your accounts',
+		'display_name': 'Chart of Accounts',
+		'doc_name': 'Accounts Browser',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01178',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': "show_chart_browser('Accounts Browser','Cost Center')",
+		'creation': '2010-10-05 12:51:20',
+		'description': 'Manage your cost centers',
+		'display_name': 'Chart of Cost Centers',
+		'doc_name': 'Accounts Browser',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01183',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': 'Regular journal entry',
+		'display_name': 'Journal Voucher',
+		'doc_name': 'Journal Voucher',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'voucher_type\nvoucher_date\nfiscal_year\ntotal_debit\ntotal_credit',
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01012',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': 'Outgoing Invoice to your customers',
+		'display_name': 'Sales Invoice',
+		'doc_name': 'Receivable Voucher',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'voucher_date\ndue_date\ndebit_to\ngrand_total\noutstanding_amount',
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01013',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': 'Incoming invoice from your service providers',
+		'display_name': 'Purchase Invoice',
+		'doc_name': 'Payable Voucher',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'voucher_date\ncredit_to\nbill_no\ngrand_total\noutstanding_amount',
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01014',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': 'Profit & Loss and Balance Sheet builder',
+		'display_name': 'Financial Statements',
+		'doc_name': 'Financial Statements',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'table.gif',
+		'idx': 6,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01015',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': 'Update your actual clearance dates and find out if bank ledger tallies with your bank statement.',
+		'display_name': 'Bank Reconciliation',
+		'doc_name': 'Bank Reconciliation',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01016',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'TDS Payment',
+		'doc_name': 'TDS Payment',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'MDI01017',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'TDS Return Acknowledgement',
+		'doc_name': 'TDS Return Acknowledgement',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01018',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Form 16A',
+		'doc_name': 'Form 16A',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01019',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-10-25 17:25:22',
+		'description': 'Account closing entry (Profit Booking) on any date',
+		'display_name': 'Period Closing Voucher',
+		'doc_name': 'Period Closing Voucher',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01188',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-05-25 10:54:07',
+		'description': 'You can export balance of selected ledgers within a specific period',
+		'display_name': 'Ledger Balance Export',
+		'doc_name': 'Ledger Balance Export',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 12,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01302',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'General Ledger',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 13,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01021',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Accounts Receivable',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 14,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01022',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Accounts Payable',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 15,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01023',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Bank Reconciliation Statement',
+		'doc_name': 'Journal Voucher Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 16,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01024',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Trial Balance',
+		'doc_name': 'Account',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 17,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01025',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Sales Register',
+		'doc_name': 'Receivable Voucher',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 18,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01026',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Purchase Register',
+		'doc_name': 'Payable Voucher',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 19,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01027',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Bank Clearance report',
+		'doc_name': 'Journal Voucher Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 20,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01028',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Monthly Ledger Summary Report',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 21,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01031',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Collection Report',
+		'doc_name': 'Journal Voucher Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 22,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01032',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Total amout collection for a period - Customerwise',
+		'doc_name': 'Account',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 23,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01033',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Payment Report',
+		'doc_name': 'Journal Voucher Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 24,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01034',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-01-19 17:41:27',
+		'description': None,
+		'display_name': 'Itemwise Sales Register',
+		'doc_name': 'RV Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 25,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01267',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Itemwise Purchase Register',
+		'doc_name': 'PV Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 26,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01035',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Cost Center wise Expense',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 27,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01036',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'TDS Return',
+		'doc_name': 'TDS Payment Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 28,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01038',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Budget Variance Report',
+		'doc_name': 'Budget Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 29,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01039',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': None,
+		'display_name': 'Payment Receipt Report',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 30,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01040',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:37',
+		'description': 'Track total commission given to your Business Associate',
+		'display_name': 'Business Associate Commission Report',
+		'doc_name': 'Receivable Voucher',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 31,
+		'modified': '2011-05-25 10:54:07',
+		'modified_by': 'Administrator',
+		'name': 'MDI01041',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-09-25 10:50:37',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2011-03-07 17:24:33',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'MDR00302',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts Manager'
+	},
+	{
+		'creation': '2010-09-25 10:50:37',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2011-03-07 17:24:33',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'MDR00303',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts User'
+	},
+	{
+		'creation': '2010-09-25 10:50:37',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2011-03-07 17:24:33',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'MDR00304',
+		'owner': 'Administrator',
+		'parent': 'Accounts',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2011-03-07 17:24:33',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2011-03-07 17:24:33',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'MDR00328',
+		'owner': 'umair@iwebnotes.com',
+		'parent': 'Accounts',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'testrole'
+	}
+]
\ No newline at end of file
diff --git a/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt b/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt
new file mode 100755
index 0000000..7f6137d
--- /dev/null
+++ b/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt
@@ -0,0 +1,18 @@
+[
+	{
+		'creation': '2011-03-25 15:26:02',
+		'docstatus': 0,
+		'doctype': 'Print Format',
+		'html': '<!--  p.big {line-height: 200%}  .noborder td { border: 0px solid #fff; }   -->\n<div style="position: relative;">\n<h3><script>doc.company</script><br /> <br /> \n<hr />\nPAYMENT ADVICE</h3>\n<table class="noborder" style="width: 100%;">\n<tbody>\n<tr>\n<td style="vertical-align: top;" width="50%">To :<br />\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</td>\n<td width="50%">\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="30%">Voucher No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndoc.name\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Voucher Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.voucher_date)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_no)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n<br /> <strong>We are pleased to enclose our cheque in full/part Settlement of your under noted bills</strong> <br /> \n<hr />\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="70%">&nbsp;</td>\n<td width="15%">Total :</td>\n<td class="pos_left" width="15%">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td colspan="3">Narration :\n<script type="text/javascript">// <![CDATA[\nreplace_newlines(doc.remark)\n// ]]></script>\n<br /><br /><br /></td>\n</tr>\n</tbody>\n</table>\n<div style="position: absolute; top: 14cm; left: 0cm;">Prepared By</div>\n<div style="position: absolute; top: 14cm; left: 5.5cm;">Authorised Signatory</div>\n<div style="position: absolute; top: 14cm; left: 11cm;">Received Payment as Above</div>\n<div style="position: absolute; top: 16.4cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 6cm;"><strong>A/c Payee</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.9cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</div>\n<div style="position: absolute; top: 17.9cm; left: 1cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</div>\n<div style="position: absolute; top: 18.6cm; left: 1cm; width: 7cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount_in_words\n// ]]></script>\n</div>\n<div style="position: absolute; top: 19.7cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</div>\n</div>',
+		'idx': None,
+		'modified': '2011-03-28 12:33:24',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Cheque Printing Format',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/Print Format/Form 16A Print Format/Form 16A Print Format.txt b/accounts/Print Format/Form 16A Print Format/Form 16A Print Format.txt
new file mode 100644
index 0000000..e8cb6c6
--- /dev/null
+++ b/accounts/Print Format/Form 16A Print Format/Form 16A Print Format.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Form 16A Print Format', 'parent': None, 'creation': '2009-05-29 12:23:01', 'modified': '2010-09-27 17:27:06', 'module': 'Accounts', 'doctype': 'Print Format', 'idx': None, 'parenttype': None, 'html': '<html>\n  <script>\n    function get_letter_head(){\n      var cp = locals[\'Control Panel\'][\'Control Panel\'];\n  \t  if(cp.letter_head !=\'None\' && cp.letter_head !=\'\') {return cp.letter_head; }\n    }\n  </script>\n<body>\n<table border = "1" style=\'border-collapse: collapse;\'>\n <tr>\n   <td>\n    <div style="border-bottom: 1px solid; padding-bottom: 5px; width:100%"><script>get_letter_head()</script></div>\n   </td>\n </tr>\n <tr>\n   <td colspan = "3"><h1 align = "center"><b>FORM No. 16 A</b></h1>\n   <p align="right">Certificate No:<script>doc.name</script></p>\n   <p align = "center">[See rule 31 (1)(b)]</p>\n   <h2 align = "center"><b>Certifiction of deduction of tax at source under section 203 of the Income-tax Act, 1961</b></h2>\n   <p>[For interest on securities; dividends; interests other than \'interests on securities\';winnings from lottery or crossword puzzle;\n      winnings from horse race; payments to contractors and sub-contractors;insurance comission;payments to\n      \n      non-resident sportsmen/ sports associations;payments in respect of deposits under National Savings Scheme:\n      payments on account of repurchase of units by Mutual Fund or Unit Trust of India; commission, remuneration or prize\n     \n      on sale of lottery tickets; comission or brokerage;rent;fees for professional or technical services;royalty and any sum \n      under section 28(va);income in respect of units; payment of compensation on acquisition of certain immovable property;\n\n      other sums under section 195; income in respect of units of non-residents referred to in section 196A; income from units\n      referred to in section 196B;income from foreign currency bonds or shares of an Indian Company referred to in section</p>\n      196C; income of Foreign Institutional Investors from securities referred to in section 196D]\n   </td> \n  </tr>\n\n  <tr>\n    <td width="30%">Name and address of person deducing tax</td>\n    <td width="40%">Acknowledgement No.s of all quarterly statements of TDS under sub-section(3) of section 200 as provided by TIN Facilitation Centre or NSDL web-site</td>\n    <td width="30%">Name and address of the person to whom payment is made or in whose account it is credited</td>\n  </tr>\n  \n  <tr>\n    <td>\n      <table>\n        <tr><script>doc.company</script></tr><br><br>\n        <tr><script>replace_newlines(doc.company_address)</script></tr>\n      </table>\n    </td>\n    <td>\n      <script>print_table(\'Form 16A\', doc.name, \'form_16A_ack_details\',\'Form 16A Ack Detail\',  [\'quarter\',\'ack_no\'], [\'Quarter\' , \'Acknowledgement No.\'] , [\'40%\',\'60%\']).innerHTML</script>\n    </td>\n    <td>\n      <table>\n        <tr><script>doc.party_name</script></tr><br><br>\n        <tr><script>replace_newlines(doc.party_address)</script></tr>\n      </table>\n    </td>\n  </tr>\n  \n  <tr>\n    <td>\n      <table>\n        <tr><b>Registration Details OF THE DEDUCTOR</b></tr><br>\n        <tr><script>replace_newlines(doc.registration_details)</script></tr>\n      </table>\n    </td>\n    \n    <td>\n      <table>\n        <tr><b><center>NATURE OF PAYMENT</center></b></tr><br><br>\n        <tr><b><center><script>doc.tds_category</script></center></b></tr>\n        \n      </table>\n    </td>\n    \n    <td>\n      <table>\n        <tr><b>PAN NO. OF THE PAYEE</b></tr><br>\n        <tr><script>doc.pan_number</script></tr>\n        \n      </table>\n    </td>\n  </tr>\n  \n  <tr>\n    <td align = "center" colspan ="3"><b>DETAILS OF PAYMENT, TAX DEDUCTION AND DEPOSIT OF TAX INTO CENTRAL GOVERNMENT ACCOUNT</b>\n    <p align = "center">(The deductor is to provide transaction wise details of tax deducted and deposited)</p>\n  </tr>\n  \n  <tr>\n    <td colspan="3">\n      <script>print_table(\'Form 16A\', doc.name, \'form_16A_tax_details\',\'Form 16A Tax Detail\', [\'SR\',\'amount_paid\', \'date_of_payment\',\'tds_main\',\'surcharge\',\'cess_on_tds\',\'total_tax_deposited\',\'cheque_no\',\'bsr_code\',\'tax_deposited_date\',\'challan_no\'], [\'S No.\' , \'Amount paid / credited\',\'Date of payment / credit\',\'TDS (Rs.)\',\'Surcharge (Rs.)\',\'Cess on TDS(Rs.)\',\'Total Tax Deposited (Rs.)\',\'Cheque/DD no.(if any)\',\'BSR code on bank branch\', \'Date on which tax deposited(dd/mm/yy)\',\'Transfer Voucher/Challan Identification no.\'] ,  [\'3%\', \'10%\',\'10%\', \'10%\',\'10%\',\'6%\',\'10%\' ,\'10%\',\'7%\' ,\'10%\',\'7%\',\'7%\'] ).innerHTML</script>\n    </td>\n  </tr>\n  \n  <tr>\n    <td colspan="3">\n      Certified that a sum of Rs. <script>doc.total_amount</script> has been deducted at source and paid to the credit of the Central Government as per details given above <br><br><br><br>\n      <p align="right"> Signature of person responsible for deduction of tax \n    </td>\n  </tr>\n  \n  <tr>\n    <td colspan="3">\n      <table width="100%" border="0">\n        <tr>\n          <td width="50%">Place: <script>doc.place</script></td>\n          <td width="50%" align="right">Full Name: <script>doc.full_name</script></td>\n        </tr>\n        <tr>\n          <td width="50%">Date: <script>date.str_to_user(doc.dt)</script></td>\n          <td width="50%" align="right">Designation: <script>doc.designation</script></td>\n        </tr>\n      </table>\n    </td>\n  </tr>\n  \n</table>\n</body>\n</html>', 'owner': 'Administrator', 'docstatus': 0, 'standard': 'Yes', 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt b/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt
new file mode 100755
index 0000000..a7c0847
--- /dev/null
+++ b/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt
@@ -0,0 +1,18 @@
+[
+	{
+		'creation': '2011-03-25 17:30:45',
+		'docstatus': 0,
+		'doctype': 'Print Format',
+		'html': '<div style="position: relative;">\n<h3 align="center"><script>doc.company</script>\n</div>\n\n<font size="4">\n<table class=\'simpletable\'>\n<tr>\n<td><b> Receipt No.: </b></td>\n<td><script>doc.name</script></td>\n</tr>\n<tr>\n<td><b> Date : </b></td>\n<td><script>date.str_to_user(doc.voucher_date)</script></td>\n</tr>      \n<tr>\n<td><b> Remark: </b></td>\n<td><script> doc.remark </script></td>\n</tr>\n<tr>\n<td><b> Received From: </b></td>\n<td><b><script> doc.pay_to_rec_from </script></b></td>\n</tr>\n</table>\n<br>\n\n<div><b><script>doc.total_amount</script></b> </td></div><br>\n<div style="text-align:left"><b><script>doc.total_amount_in_words</script></b></div><br>\n<div>This receipt is issued subject to realization of the Cheque</div>\n</font>\n<br>\n<table class="noborder">\n<tr>\n<td style = "text-align = right;"><h3>For <script>doc.company</script>,</h3><br><div>(Authorised Signatory)</div></td>\n</tr>\n</table>',
+		'idx': None,
+		'modified': '2011-03-28 12:31:40',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Payment Receipt Voucher',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
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"
new file mode 100644
index 0000000..1949eb6
--- /dev/null
+++ "b/accounts/TDS Rate Chart/Rate chart \05001-07-2010\051/Rate chart \05001-07-2010\051.txt"
@@ -0,0 +1 @@
+[{'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
new file mode 100644
index 0000000..0dfcd95
--- /dev/null
+++ b/accounts/TDS Rate Chart/TDS Rate Chart October 2009 Onwards/TDS Rate Chart October 2009 Onwards.txt
@@ -0,0 +1 @@
+[{'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
new file mode 100644
index 0000000..14ce215
--- /dev/null
+++ b/accounts/TDS Rate Chart/TDS Rate Chart for 2009-10/TDS Rate Chart for 2009-10.txt
@@ -0,0 +1 @@
+[{'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/__init__.py b/accounts/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/__init__.py
diff --git a/accounts/doctype/__init__.py b/accounts/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/__init__.py
diff --git a/accounts/doctype/account/__init__.py b/accounts/doctype/account/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/account/__init__.py
diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js
new file mode 100644
index 0000000..856b58a
--- /dev/null
+++ b/accounts/doctype/account/account.js
@@ -0,0 +1,87 @@
+// Fetch parent details
+// -----------------------------------------
+cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit');
+cur_frm.add_fetch('parent_account', 'is_pl_account', 'is_pl_account');
+
+// Hide tax rate based on account type
+// -----------------------------------------
+cur_frm.cscript.account_type = function(doc, cdt, cdn) {
+  if(doc.account_type == 'Tax') unhide_field(['tax_rate']);
+  else hide_field(['tax_rate']);
+}
+
+// Onload
+// -----------------------------------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.account_type(doc, cdt, cdn);
+  // hide India specific fields
+  var cp = locals['Control Panel']['Control Panel'];
+  if(cp.country == 'India')
+    unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
+  else
+    hide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
+}
+
+// Refresh
+// -----------------------------------------
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  root_acc = ['	Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)'];
+  if(inList(root_acc, doc.account_name))
+    cur_frm.perm = [[1,0,0], [1,0,0]];
+  cur_frm.cscript.hide_unhide_group_ledger(doc);
+}
+
+// Hide/unhide group or ledger
+// -----------------------------------------
+cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
+  hide_field(['Convert to Group', 'Convert to Ledger']);
+  if (cstr(doc.group_or_ledger) == 'Group') unhide_field('Convert to Ledger');
+  else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('Convert to Group');
+}
+
+// Convert group to ledger
+// -----------------------------------------
+cur_frm.cscript['Convert to Ledger'] = function(doc, cdt, cdn) {
+  $c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) {
+    if(r.message == 1) {
+      doc.group_or_ledger = 'Ledger';
+      refresh_field('group_or_ledger');
+      cur_frm.cscript.hide_unhide_group_ledger(doc);
+    }
+  });
+}
+
+// Convert ledger to group
+// -----------------------------------------
+cur_frm.cscript['Convert to Group'] = function(doc, cdt, cdn) {
+  $c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) {
+    if(r.message == 1) {
+      doc.group_or_ledger = 'Group';
+      refresh_field('group_or_ledger');
+      cur_frm.cscript.hide_unhide_group_ledger(doc);
+    }
+  });
+}
+
+// Master name get query
+// -----------------------------------------
+cur_frm.fields_dict['master_name'].get_query=function(doc){
+ if (doc.master_type){
+    return 'SELECT `tab'+doc.master_type+'`.name FROM `tab'+doc.master_type+'` WHERE `tab'+doc.master_type+'`.name LIKE "%s" and `tab'+doc.master_type+'`.docstatus != 2 ORDER BY `tab'+doc.master_type+'`.name LIMIT 50';
+  }
+  else alert("Please select master type");
+}
+
+// Get customer/supplier address
+// -----------------------------------------
+cur_frm.cscript.master_name = function(doc,cdt,cdn){
+  if(doc.master_name){
+    get_server_fields('get_address','','',doc,cdt,cdn);
+  }
+}
+
+// parent account get query
+// -----------------------------------------
+cur_frm.fields_dict['parent_account'].get_query = function(doc){
+  return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND `tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
+}
diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py
new file mode 100644
index 0000000..ff85666
--- /dev/null
+++ b/accounts/doctype/account/account.py
@@ -0,0 +1,259 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d,dl
+		self.nsm_parent_field = 'parent_account'
+
+	def autoname(self):
+		company_abbr = sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+		self.doc.name = self.doc.account_name.strip() + ' - ' + company_abbr
+
+	# Get customer/supplier address
+	# ==================================================================
+	def get_address(self):		
+		add=sql("Select address from `tab%s` where name='%s'"%(self.doc.master_type,self.doc.master_name))
+		ret={'address':add[0][0]}
+		return cstr(ret)
+
+
+	# check whether master name entered for supplier/customer
+	# ==================================================================
+	def validate_master_name(self):
+		if (self.doc.master_type == 'Customer' or self.doc.master_type == 'Supplier') and not self.doc.master_name:
+			msgprint("Message: Please enter Master Name once the account is created.")
+
+			
+	# Rate is mandatory for tax account	 
+	# ==================================================================
+	def validate_rate_for_tax(self):
+		if self.doc.account_type == 'Tax' and not self.doc.tax_rate:
+			msgprint("Please Enter Rate", raise_exception=1)
+
+	# Fetch Parent Details and validation for account not to be created under ledger
+	# ==================================================================
+	def validate_parent(self):
+		if self.doc.parent_account:
+			par = sql("select name, group_or_ledger, is_pl_account, debit_or_credit from tabAccount where name =%s",self.doc.parent_account)
+			if not par:
+				msgprint("Parent account does not exists", raise_exception=1)
+			elif par and par[0][0] == self.doc.name:
+				msgprint("You can not assign itself as parent account", raise_exception=1)
+			elif par and par[0][1] != 'Group':
+				msgprint("Parent account can not be a ledger", raise_exception=1)
+			elif par and self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit:
+				msgprint("You can not move a %s account under %s account" % (self.doc.debit_or_credit, par[0][3]), raise_exception=1)
+			elif par and not self.doc.is_pl_account:
+				self.doc.is_pl_account = par[0][2]
+				self.doc.debit_or_credit = par[0][3]
+	
+	# Account name must be unique
+	# ==================================================================
+	def validate_duplicate_account(self):
+		if (self.doc.__islocal or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
+			msgprint("Account Name already exists, please rename", raise_exception=1)
+				
+	# validate root details
+	# ==================================================================
+	def validate_root_details(self):
+		#does not exists parent
+		if self.doc.account_name in ['Income','Source of Funds', 'Expenses','Application of Funds'] and self.doc.parent_account:
+			msgprint("You can not assign parent for root account", raise_exception=1)
+
+		# Debit / Credit
+		if self.doc.account_name in ['Income','Source of Funds']:
+			self.doc.debit_or_credit = 'Credit'
+		elif self.doc.account_name in ['Expenses','Application of Funds']:
+			self.doc.debit_or_credit = 'Debit'
+				
+		# Is PL Account 
+		if self.doc.account_name in ['Income','Expenses']:
+			self.doc.is_pl_account = 'Yes'
+		elif self.doc.account_name in ['Source of Funds','Application of Funds']:
+			self.doc.is_pl_account = 'No'
+
+	# Convert group to ledger
+	# ==================================================================
+	def convert_group_to_ledger(self):
+		if self.check_if_child_exists():
+			msgprint("Account: %s has existing child. You can not convert this account to ledger" % (self.doc.name), raise_exception=1)
+		elif self.check_prev_bal_exists():
+			msgprint("Account with balance can not be converted to ledger.", raise_exception=1)
+		else:
+			self.doc.group_or_ledger = 'Ledger'
+			self.doc.save()
+			return 1
+
+	# Convert ledger to group
+	# ==================================================================
+	def convert_ledger_to_group(self):
+		if self.check_prev_bal_exists():
+			msgprint("Account with balance can not be converted to group.", raise_exception=1)
+		else:
+			self.doc.group_or_ledger = 'Group'
+			self.doc.save()
+			return 1
+
+	# Check if any previous balance exists
+	# ==================================================================
+	def check_prev_bal_exists(self):
+		bal = sql("select balance from `tabAccount Balance` where parent = '%s' and ifnull(balance, 0) > 0" % (self.doc.name))
+		return bal and flt(bal[0][0]) or 0
+
+	# check if child exists
+	# ==================================================================
+	def check_if_child_exists(self):
+		return sql("select name from `tabAccount` where parent_account = %s and docstatus<2", self.doc.name)
+	
+	# Update balance
+	# ==================================================================
+	def update_balance(self, fy, period_det, flag = 1):
+		# update in all parents
+		for p in period_det:
+			sql("update `tabAccount Balance` t1, `tabAccount` t2 set t1.balance = t1.balance + (%s), t1.opening = t1.opening + (%s), t1.debit = t1.debit + (%s), t1.credit = t1.credit + (%s) where t1.period = %s and t1.account = t2.name and t2.lft<=%s and t2.rgt>=%s", (flt(flag)*flt(p[1]), flt(flag)*flt(p[2]), flt(flag)*flt(p[3]), flt(flag)*flt(p[4]), p[0], self.doc.lft, self.doc.rgt))
+
+
+	# change parent balance
+	# ==================================================================
+	def change_parent_bal(self):
+		period_det = []
+		fy = sql("select name from `tabFiscal Year` where if(ifnull(is_fiscal_year_closed, 'No'),ifnull(is_fiscal_year_closed, 'No'), 'No') = 'No'")
+		for f in fy:
+			# get my opening, balance
+			per = sql("select period, balance, opening, debit, credit from `tabAccount Balance` where account = %s and fiscal_year = %s", (self.doc.name, f[0]))
+			for p in per:
+				period_det.append([p[0], p[1], p[2], p[3], p[4]])
+
+		# deduct balance from old_parent
+		op = get_obj('Account',self.doc.old_parent)
+		op.update_balance(fy, period_det, -1)
+			
+		# add to new parent_account
+		flag = 1
+		if op.doc.debit_or_credit != self.doc.debit_or_credit:
+			flag = -1
+
+		get_obj('Account', self.doc.parent_account).update_balance(fy, period_det, flag)
+		msgprint('Balances updated')
+	
+	# VALIDATE
+	# ==================================================================
+	def validate(self): 
+		self.validate_master_name()
+		self.validate_rate_for_tax()
+		self.validate_parent()
+		self.validate_duplicate_account()
+		self.validate_root_details()
+	
+		# Defaults
+		if not self.doc.parent_account:
+			self.doc.parent_account = ''
+		
+		# parent changed	 
+		if self.doc.old_parent and self.doc.parent_account and (self.doc.parent_account != self.doc.old_parent):
+			self.change_parent_bal()
+						 
+	# Add current fiscal year balance
+	# ==================================================================
+	def set_year_balance(self):
+		p = sql("select name, start_date, end_date, fiscal_year from `tabPeriod` where docstatus != 2 and period_type in ('Month', 'Year')")
+		for d in p:
+			if not sql("select name from `tabAccount Balance` where account=%s and period=%s", (self.doc.name, d[0])):
+				ac = Document('Account Balance')
+				ac.account = self.doc.name
+				ac.period = d[0]
+				ac.start_date = d[1].strftime('%Y-%m-%d')
+				ac.end_date = d[2].strftime('%Y-%m-%d')
+				ac.fiscal_year = d[3]
+				ac.opening = 0
+				ac.debit = 0
+				ac.credit = 0
+				ac.balance = 0
+				ac.save(1)
+
+	# Update Node Set Model
+	# ==================================================================
+	def update_nsm_model(self):
+		import webnotes
+		import webnotes.utils.nestedset
+		webnotes.utils.nestedset.update_nsm(self)
+			
+	# ON UPDATE
+	# ==================================================================
+	def on_update(self):
+		# update nsm
+		self.update_nsm_model()		
+		# Add curret year balance
+		self.set_year_balance()
+		
+
+	# Check user role for approval process
+	# ==================================================================
+	def get_authorized_user(self):
+		# Check logged-in user is authorized
+		if get_value('Manage Account', None, 'credit_controller') in webnotes.user.get_roles():
+			return 1
+			
+	# Check Credit limit for customer
+	# ==================================================================
+	def check_credit_limit(self, account, company, tot_outstanding):
+		# Get credit limit
+		credit_limit_from = 'Customer'
+
+		cr_limit = sql("select t1.credit_limit from tabCustomer t1, `tabAccount` t2 where t2.name='%s' and t1.name = t2.master_name" % account)
+		credit_limit = cr_limit and flt(cr_limit[0][0]) or 0
+		if not credit_limit:
+			credit_limit = get_value('Company', company, 'credit_limit')
+			credit_limit_from = 'global settings in the Company'
+		
+		# If outstanding greater than credit limit and not authorized person raise exception
+		if credit_limit > 0 and flt(tot_outstanding) > credit_limit and not self.get_authorized_user():
+			msgprint("Total Outstanding amount (%s) for <b>%s</b> can not be greater than credit limit (%s). To change your credit limit settings, please update the <b>%s</b>" \
+				% (fmt_money(tot_outstanding), account, fmt_money(credit_limit), credit_limit_from), raise_exception=1)
+			
+	# Account with balance cannot be inactive
+	# ==================================================================
+	def check_balance_before_trash(self):
+		if flt(self.get_curr_bal()) != 0:
+			msgprint("Account with existing balance can not be trashed", raise_exception=1)
+		if self.check_if_child_exists():
+			msgprint("Child account exists for this account. You can not make trash this account.", raise_exception=1)
+
+
+	# get current year balance
+	# ==================================================================
+	def get_curr_bal(self):
+		bal = sql("select balance from `tabAccount Balance` where period = '%s' and parent = '%s'" % (get_defaults()['fiscal_year'], self.doc.name))
+		return bal and flt(bal[0][0]) or 0
+
+	# On Trash
+	# ==================================================================
+	def on_trash(self): 
+		# Check balance before trash
+		self.check_balance_before_trash()
+		# rebuild tree
+		set(self.doc,'old_parent', '')
+		self.update_nsm_model()
+
+	# On restore
+	# ==================================================================
+	def on_restore(self):
+		# rebuild tree
+		self.update_nsm_model()
diff --git a/accounts/doctype/account/account.txt b/accounts/doctype/account/account.txt
new file mode 100644
index 0000000..3d82261
--- /dev/null
+++ b/accounts/doctype/account/account.txt
@@ -0,0 +1,1290 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': 1,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:51',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-18 14:30:09',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Account',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'debit_or_credit, group_or_ledger',
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 145
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00042',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00043',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00044',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00045',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00046',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00047',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00048',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:51',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2010-08-08 17:08:51',
+		'modified_by': 'Administrator',
+		'name': 'PERM00049',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Properties',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000166',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000167',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'account_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Account Name',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00433',
+		'no_copy': 1,
+		'oldfieldname': 'account_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'parent_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Parent Account',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00434',
+		'no_copy': None,
+		'oldfieldname': 'parent_account',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'level',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 0,
+		'label': 'Level',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00435',
+		'no_copy': None,
+		'oldfieldname': 'level',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': 'Ledger',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'group_or_ledger',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Group or Ledger',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00436',
+		'no_copy': None,
+		'oldfieldname': 'group_or_ledger',
+		'oldfieldtype': 'Select',
+		'options': '\nLedger\nGroup',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Convert to Group',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000163',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Convert to Ledger',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000164',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'debit_or_credit',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Debit or Credit',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00441',
+		'no_copy': None,
+		'oldfieldname': 'debit_or_credit',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_pl_account',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 1,
+		'label': 'Is PL Account',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00437',
+		'no_copy': None,
+		'oldfieldname': 'is_pl_account',
+		'oldfieldtype': 'Select',
+		'options': 'Yes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'account_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 1,
+		'label': 'Account Type',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00439',
+		'no_copy': None,
+		'oldfieldname': 'account_type',
+		'oldfieldtype': 'Select',
+		'options': '\nFixed Asset Account\nBank or Cash\nExpense Account\nTax\nIncome Account\nChargeable',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': 'If Account Type is "Tax" then the default rate is required.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tax_rate',
+		'fieldtype': 'Currency',
+		'hidden': 0,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00440',
+		'no_copy': None,
+		'oldfieldname': 'tax_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000168',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'freeze_account',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Freeze Account',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00438',
+		'no_copy': None,
+		'oldfieldname': 'freeze_account',
+		'oldfieldtype': 'Select',
+		'options': 'No\nYes',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00442',
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_days',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Credit Days',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00443',
+		'no_copy': None,
+		'oldfieldname': 'credit_days',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_limit',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Credit Limit',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00444',
+		'no_copy': None,
+		'oldfieldname': 'credit_limit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'master_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Master Type',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00453',
+		'no_copy': None,
+		'oldfieldname': 'master_type',
+		'oldfieldtype': 'Select',
+		'options': '\nNA\nSupplier\nCustomer\nEmployee',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'master_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Master Name',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00454',
+		'no_copy': None,
+		'oldfieldname': 'master_name',
+		'oldfieldtype': 'Link',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00455',
+		'no_copy': None,
+		'oldfieldname': 'address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'TDS',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000169',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pan_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'PAN Number',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00451',
+		'no_copy': None,
+		'oldfieldname': 'pan_number',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_applicable',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'TDS Applicable',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00452',
+		'no_copy': None,
+		'oldfieldname': 'tds_applicable',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'TDS Details',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00456',
+		'no_copy': None,
+		'oldfieldname': 'tds_details',
+		'oldfieldtype': 'Table',
+		'options': 'TDS Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Balances',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000170',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'account_balances',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Account Balances',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00446',
+		'no_copy': None,
+		'oldfieldname': 'account_balances',
+		'oldfieldtype': 'Table',
+		'options': 'Account Balance',
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': "Don't delete this field at any cost",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'old_parent',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Old Parent',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00447',
+		'no_copy': 1,
+		'oldfieldname': 'old_parent',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': "Don't delete this field at any cost",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lft',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 28,
+		'in_filter': 1,
+		'label': 'Lft',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00448',
+		'no_copy': 1,
+		'oldfieldname': 'lft',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 3,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': "Don't delete this field at any cost",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rgt',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 29,
+		'in_filter': 1,
+		'label': 'Rgt',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00449',
+		'no_copy': 1,
+		'oldfieldname': 'rgt',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 3,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': 'FL00457',
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/account_balance/__init__.py b/accounts/doctype/account_balance/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/account_balance/__init__.py
diff --git a/accounts/doctype/account_balance/account_balance.txt b/accounts/doctype/account_balance/account_balance.txt
new file mode 100644
index 0000000..437cfb7
--- /dev/null
+++ b/accounts/doctype/account_balance/account_balance.txt
@@ -0,0 +1,417 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': '_ACB.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:51',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 0,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-23 12:37:39',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Account Balance',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'account, period, fiscal_year, balance',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 28
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-05-09 10:50:48',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': None,
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': '000000174',
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-05-09 10:50:48',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': None,
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': '000000175',
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Account',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': '000000176',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'period',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Period',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL00458',
+		'no_copy': None,
+		'oldfieldname': 'period',
+		'oldfieldtype': 'Link',
+		'options': 'Period',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'opening',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Opening',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL00462',
+		'no_copy': None,
+		'oldfieldname': 'opening',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-26 09:43:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'debit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Debit',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL04062',
+		'no_copy': None,
+		'oldfieldname': 'debit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-26 09:43:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Credit',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL04063',
+		'no_copy': None,
+		'oldfieldname': 'credit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'balance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Balance',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL00463',
+		'no_copy': None,
+		'oldfieldname': 'balance',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL00459',
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Link',
+		'options': 'Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'start_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Start Date',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL00460',
+		'no_copy': None,
+		'oldfieldname': 'start_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'end_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'End Date',
+		'modified': '2011-05-09 10:50:48',
+		'modified_by': 'Administrator',
+		'name': 'FL00461',
+		'no_copy': None,
+		'oldfieldname': 'end_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Account Balance',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/accounts_setup/__init__.py b/accounts/doctype/accounts_setup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/accounts_setup/__init__.py
diff --git a/accounts/doctype/accounts_setup/accounts_setup.js b/accounts/doctype/accounts_setup/accounts_setup.js
new file mode 100644
index 0000000..61fd374
--- /dev/null
+++ b/accounts/doctype/accounts_setup/accounts_setup.js
@@ -0,0 +1,3 @@
+cur_frm.cscript['Repost GL'] = function(doc,dt,dn) {
+  $c_obj('GL Control','repost_gl','',function(r,rt) {alert('Done')});
+}
\ No newline at end of file
diff --git a/accounts/doctype/accounts_setup/accounts_setup.py b/accounts/doctype/accounts_setup/accounts_setup.py
new file mode 100644
index 0000000..9e3ea62
--- /dev/null
+++ b/accounts/doctype/accounts_setup/accounts_setup.py
@@ -0,0 +1,43 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def get_bal(self,arg):
+    msgprint(arg)
+    bal = sql("select balance,debit_or_credit from tabAccount where name=%s", arg)
+    msgprint(bal)
+    return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
+
+  def on_update(self):
+    set_default('fiscal_year', self.doc.current_fiscal_year)
+    ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", self.doc.current_fiscal_year)[0][0]
+    set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
+    set_default('year_end_date', get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
+
+  def get_bank_defaults(self, arg):
+    return {
+      'def_bv_type': self.doc.default_bank_voucher_type,
+      'def_bv_series': self.doc.default_bank_voucher_series,
+      'def_bank_account': self.doc.default_bank_account,
+      'bank_balance': self.get_bal(self.doc.default_bank_account),
+      'acc_balance': self.get_bal(arg),
+    }
\ No newline at end of file
diff --git a/accounts/doctype/accounts_setup/accounts_setup.txt b/accounts/doctype/accounts_setup/accounts_setup.txt
new file mode 100644
index 0000000..8beeac4
--- /dev/null
+++ b/accounts/doctype/accounts_setup/accounts_setup.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:35:16', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': 1, 'dt_template': '<div style="margin:16px">\n\nCurrent Fiscal Year is <span></span><br><br>\n\nB/S Difference is <span></span><br><br>\n\n1. <span class="link_type" onclick="loadpage(\'Accounts Browser\')">Manage the Chart of Accounts</span><br><br>\n\n2. Close Fiscal Year <div>Message</div><br><br>\n\n3. Start A New Fiscal Year\n   <div><select></select></div><br><br>\n\n4. Change Fiscal Year <div><select></select></div> - Change<br><br>\n\n5. Set Series<br>\n- Journal Voucher<br>\n- Expense Voucher (Bill)<br>\n- Invoice<br>\n\n</div>\n', 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': 0, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Accounts Setup', 'idx': None, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': '<pre style="text-align: left;"></pre>', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:35:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Current Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Accounts Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01323', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-06-11 19:29:54', 'parenttype': 'DocType', 'fieldname': 'current_fiscal_year', 'fieldtype': 'Link', 'options': 'Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:35:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Default Bank Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Accounts Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01324', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-06-11 19:29:54', 'parenttype': 'DocType', 'fieldname': 'default_bank_account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:35:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Default Bank Voucher Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Accounts Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01325', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-06-11 19:29:54', 'parenttype': 'DocType', 'fieldname': 'default_bank_voucher_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:35:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Default Bank Voucher Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Accounts Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01326', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-06-11 19:29:54', 'parenttype': 'DocType', 'fieldname': 'default_bank_voucher_series', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:35:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Repost GL', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Accounts Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01327', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-06-11 19:29:54', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/advance_adjustment_detail/__init__.py b/accounts/doctype/advance_adjustment_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/advance_adjustment_detail/__init__.py
diff --git a/accounts/doctype/advance_adjustment_detail/advance_adjustment_detail.txt b/accounts/doctype/advance_adjustment_detail/advance_adjustment_detail.txt
new file mode 100644
index 0000000..de5e283
--- /dev/null
+++ b/accounts/doctype/advance_adjustment_detail/advance_adjustment_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-22 14:56:16', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 24, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Advance Adjustment Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2009-05-22 14:56:16', 'doctype': 'DocField', 'oldfieldname': 'journal_voucher', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Journal Voucher', 'width': '250px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Adjustment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02126', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-12-15 14:34:41', 'parenttype': 'DocType', 'fieldname': 'journal_voucher', 'fieldtype': 'Link', 'options': 'Journal Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-05-28 12:21:27', 'doctype': 'DocField', 'oldfieldname': 'jv_detail_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Journal Voucher Detail No', 'width': '120px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Advance Adjustment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02226', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-12-15 14:34:41', 'parenttype': 'DocType', 'fieldname': 'jv_detail_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-05-22 14:56:16', 'doctype': 'DocField', 'oldfieldname': 'advance_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Advance amount', 'width': '120px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Adjustment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02127', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-12-15 14:34:41', 'parenttype': 'DocType', 'fieldname': 'advance_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-05-28 12:22:02', 'doctype': 'DocField', 'oldfieldname': 'allocated_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Allocated amount', 'width': '120px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Advance Adjustment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02227', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-12-15 14:34:41', 'parenttype': 'DocType', 'fieldname': 'allocated_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Small Text', 'creation': '2009-05-28 14:19:30', 'doctype': 'DocField', 'oldfieldname': 'remarks', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Remarks', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Adjustment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02231', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-12-15 14:34:41', 'parenttype': 'DocType', 'fieldname': 'remarks', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/advance_allocation_detail/__init__.py b/accounts/doctype/advance_allocation_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/advance_allocation_detail/__init__.py
diff --git a/accounts/doctype/advance_allocation_detail/advance_allocation_detail.txt b/accounts/doctype/advance_allocation_detail/advance_allocation_detail.txt
new file mode 100644
index 0000000..532f801
--- /dev/null
+++ b/accounts/doctype/advance_allocation_detail/advance_allocation_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-06-11 13:16:20', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 20, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Advance Allocation Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2009-06-11 13:16:20', 'doctype': 'DocField', 'oldfieldname': 'journal_voucher', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Journal Voucher', 'width': '180px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02297', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'journal_voucher', 'fieldtype': 'Link', 'options': 'Journal Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Date', 'creation': '2009-06-11 13:16:20', 'doctype': 'DocField', 'oldfieldname': 'jv_detail_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Journal Voucher Detail No', 'width': '80px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02298', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'jv_detail_no', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-06-11 13:16:20', 'doctype': 'DocField', 'oldfieldname': 'advance_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Advance Amount', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02300', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'advance_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-06-11 13:16:20', 'doctype': 'DocField', 'oldfieldname': 'allocated_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Allocated Amount', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02301', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'allocated_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-11 13:16:20', 'doctype': 'DocField', 'oldfieldname': 'tds_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'TDS Amount', 'width': '80px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02302', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'tds_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-11 18:12:48', 'doctype': 'DocField', 'oldfieldname': 'tds_allocated', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'TDS Allocated', 'width': '80px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02305', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'tds_allocated', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Small Text', 'creation': '2009-06-11 13:16:20', 'doctype': 'DocField', 'oldfieldname': 'remarks', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Remarks', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Advance Allocation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02299', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-04-15 16:54:44', 'parenttype': 'DocType', 'fieldname': 'remarks', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/bank_reconciliation/__init__.py b/accounts/doctype/bank_reconciliation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/bank_reconciliation/__init__.py
diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/accounts/doctype/bank_reconciliation/bank_reconciliation.js
new file mode 100644
index 0000000..5c5dece
--- /dev/null
+++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -0,0 +1,4 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn){
+  // add page head
+  var ph = new PageHeader(cur_frm.fields_dict['Head HTML'].wrapper, 'Bank Reconciliation', '');
+}
\ No newline at end of file
diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
new file mode 100644
index 0000000..8434f62
--- /dev/null
+++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -0,0 +1,49 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def get_details(self):
+    if not (self.doc.bank_account and self.doc.from_date and self.doc.to_date):
+      msgprint("Bank Account, From Date and To Date are Mandatory")
+      return
+  
+    dl = sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and (t1.cheque_no is not null or t1.cheque_no != '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
+    
+    self.doc.clear_table(self.doclist, 'entries')
+    self.doc.total_amount = 0.0
+
+    for d in dl:
+      nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', 1, self.doclist)
+      nl.posting_date = str(d[5])
+      nl.voucher_id = str(d[0])
+      nl.cheque_number = str(d[1])
+      nl.cheque_date = str(d[2])
+      nl.debit = flt(d[3])
+      nl.credit = flt(d[4])
+      nl.against_account = d[6]
+      self.doc.total_amount += flt(flt(d[4]) - flt(d[3]))
+
+  def update_details(self):
+    for d in getlist(self.doclist, 'entries'):
+      if d.clearance_date:
+        sql("update `tabJournal Voucher` set clearance_date = %s where name=%s", (d.clearance_date, d.voucher_id))
+    msgprint("Updated")
\ No newline at end of file
diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.txt b/accounts/doctype/bank_reconciliation/bank_reconciliation.txt
new file mode 100644
index 0000000..4b47fa7
--- /dev/null
+++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-04-10 15:10:52', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': 1, 'allow_email': 1, 'dt_template': None, 'hide_heading': 1, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Bank Reconciliation', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-23 13:53:32', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00274', 'parent': 'Bank Reconciliation', 'read': 1, 'create': 1, 'creation': '2009-04-10 15:10:52', 'modified': '2010-09-23 13:53:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00275', 'parent': 'Bank Reconciliation', 'read': 1, 'create': None, 'creation': '2009-04-10 15:10:52', 'modified': '2010-09-23 13:53:32', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01161', 'parent': 'Bank Reconciliation', 'read': 1, 'create': 1, 'creation': '2010-09-06 17:53:25', 'modified': '2010-09-23 13:53:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'sneha@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-05-04 12:00:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Head HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04972', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-10 15:10:52', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Bank Account', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select account head of the bank where cheque was deposited.', 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01770', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': 'bank_account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-05-15 17:07:58', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'From Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02084', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': 'from_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-05-15 17:07:58', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'To Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02083', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': 'to_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-10 15:10:52', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get Non Reconciled Entries', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01768', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-10 15:10:52', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Entries', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01771', 'idx': 6, 'default': '', 'colour': 'White:FFF', 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': 'entries', 'fieldtype': 'Table', 'options': 'Bank Reconciliation Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-10 15:28:42', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Update Clearance Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01778', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-10 15:10:52', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Total Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bank Reconciliation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01769', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-23 13:53:32', 'parenttype': 'DocType', 'fieldname': 'total_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/bank_reconciliation_detail/__init__.py b/accounts/doctype/bank_reconciliation_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/bank_reconciliation_detail/__init__.py
diff --git a/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt b/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt
new file mode 100644
index 0000000..203d98a
--- /dev/null
+++ b/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-04-10 15:13:36', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Bank Reconciliation Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-23 13:57:17', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-04-10 15:13:36', 'doctype': 'DocField', 'oldfieldname': 'voucher_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Voucher ID', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01772', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'voucher_id', 'fieldtype': 'Link', 'options': 'Journal Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-15 17:03:23', 'doctype': 'DocField', 'oldfieldname': 'against_account', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Against Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02081', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'against_account', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-07-31 17:22:06', 'doctype': 'DocField', 'oldfieldname': 'posting_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Posting Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': 'The date at which current entry will get or has actually executed.', 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02688', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'posting_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-04-10 15:13:36', 'doctype': 'DocField', 'oldfieldname': 'cheque_number', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cheque Number', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01773', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'cheque_number', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-04-10 15:13:36', 'doctype': 'DocField', 'oldfieldname': 'cheque_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cheque Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01774', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'cheque_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-04-10 15:13:36', 'doctype': 'DocField', 'oldfieldname': 'debit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Debit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01775', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'debit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-04-10 15:13:36', 'doctype': 'DocField', 'oldfieldname': 'credit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Credit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01776', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'credit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-04-10 15:13:36', 'doctype': 'DocField', 'oldfieldname': 'clearance_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Clearance Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Bank Reconciliation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01777', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-23 13:57:17', 'parenttype': 'DocType', 'fieldname': 'clearance_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/budget_control/__init__.py b/accounts/doctype/budget_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/budget_control/__init__.py
diff --git a/accounts/doctype/budget_control/budget_control.js b/accounts/doctype/budget_control/budget_control.js
new file mode 100644
index 0000000..3d4d1c1
--- /dev/null
+++ b/accounts/doctype/budget_control/budget_control.js
@@ -0,0 +1,59 @@
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    
+  # Get monthly budget
+  #-------------------
+  def get_monthly_budget(self, distribution_id, cfy, st_date, post_dt, budget_allocated):
+    
+    # get month_list
+    st_date, post_dt = getdate(st_date), getdate(post_dt)
+    
+    if distribution_id:
+      if st_date.month <= post_dt.month:
+        tot_per_allocated = sql("select ifnull(sum(percentage_allocation),0) from `tabBudget Distribution Detail` where parent='%s' and idx between '%s' and '%s'" % (distribution_id, st_date.month, post_dt.month))[0][0]
+
+      if st_date.month > post_dt.month:
+    
+        tot_per_allocated = flt(sql("select ifnull(sum(percentage_allocation),0) from `tabBudget Distribution Detail` where parent='%s' and idx between '%s' and '%s'" % (distribution_id, st_date.month, 12 ))[0][0])
+        tot_per_allocated = flt(tot_per_allocated)  + flt(sql("select ifnull(sum(percentage_allocation),0) from `tabBudget Distribution Detail` where parent='%s' and idx between '%s' and '%s'" % (distribution_id, 1, post_dt.month))[0][0])
+     
+      return (flt(budget_allocated) * flt(tot_per_allocated)) / 100
+    period_diff = sql("select PERIOD_DIFF('%s','%s')" % (post_dt.strftime('%Y%m'), st_date.strftime('%Y%m')))
+    
+    return (flt(budget_allocated) * (flt(period_diff[0][0]) + 1)) / 12
+    
+  def validate_budget(self, acct, cost_center, actual, budget, action):
+    # action if actual exceeds budget
+    if flt(actual) > flt(budget):
+      msgprint("Your monthly expense "+ cstr((action == 'stop') and "will exceed" or "has exceeded") +" budget for <b>Account - "+cstr(acct)+" </b> under <b>Cost Center - "+ cstr(cost_center) + "</b>"+cstr((action == 'Stop') and ", you can not have this transaction." or "."))
+      if action == 'Stop': raise Exception
+
+  def check_budget(self,le_list,cancel):
+    # get value from record
+    acct, cost_center, debit, credit, post_dt, cfy, company  = le_list
+
+    # get allocated budget
+    bgt = sql("select t1.budget_allocated, t1.actual, t2.distribution_id from `tabBudget Detail` t1, `tabCost Center` t2 where t1.account='%s' and t1.parent=t2.name and t2.name = '%s' and t1.fiscal_year='%s'" % (acct,cost_center,cfy), as_dict =1)
+    curr_amt = ((cancel and -1  or 1) * flt(debit)) + ((cancel and 1  or -1) *  flt(credit))
+    
+    if bgt and bgt[0]['budget_allocated']:
+      # check budget flag in Company
+      bgt_flag = sql("select yearly_bgt_flag, monthly_bgt_flag from `tabCompany` where name = '%s'" % company, as_dict =1)
+      
+      if bgt_flag and bgt_flag[0]['monthly_bgt_flag'] in ['Stop', 'Warn']:
+        # get start date and last date
+        st_date = get_value('Fiscal Year', cfy, 'year_start_date').strftime('%Y-%m-%d')
+        lt_date = sql("select LAST_DAY('%s')" % post_dt)
+        
+        # get Actual
+        actual = get_obj('GL Control').get_period_difference(acct + '~~~' + cstr(st_date) + '~~~' + cstr(lt_date[0][0]), cost_center)
+      
+        # Get Monthly  budget
+        budget = self.get_monthly_budget(bgt and bgt[0]['distribution_id'] or '' , cfy, st_date, post_dt, bgt[0]['budget_allocated'])
+      
+        # validate monthly budget
+        self.validate_budget(acct, cost_center, flt(actual) + flt(curr_amt), budget, 'monthly_bgt_flag')
+
+      # update actual against budget allocated in cost center
+      sql("update `tabBudget Detail` set actual = ifnull(actual,0) + %s where account = '%s' and fiscal_year = '%s' and parent = '%s'" % (curr_amt,cstr(acct),cstr(cfy),cstr(cost_center)))
\ No newline at end of file
diff --git a/accounts/doctype/budget_control/budget_control.py b/accounts/doctype/budget_control/budget_control.py
new file mode 100644
index 0000000..ec28bfc
--- /dev/null
+++ b/accounts/doctype/budget_control/budget_control.py
@@ -0,0 +1,78 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    
+  # Get monthly budget
+  #-------------------
+  def get_monthly_budget(self, distribution_id, cfy, st_date, post_dt, budget_allocated):
+    
+    # get month_list
+    st_date, post_dt = getdate(st_date), getdate(post_dt)
+    
+    if distribution_id:
+      if st_date.month <= post_dt.month:
+        tot_per_allocated = sql("select ifnull(sum(percentage_allocation),0) from `tabBudget Distribution Detail` where parent='%s' and idx between '%s' and '%s'" % (distribution_id, st_date.month, post_dt.month))[0][0]
+
+      if st_date.month > post_dt.month:
+    
+        tot_per_allocated = flt(sql("select ifnull(sum(percentage_allocation),0) from `tabBudget Distribution Detail` where parent='%s' and idx between '%s' and '%s'" % (distribution_id, st_date.month, 12 ))[0][0])
+        tot_per_allocated = flt(tot_per_allocated)  + flt(sql("select ifnull(sum(percentage_allocation),0) from `tabBudget Distribution Detail` where parent='%s' and idx between '%s' and '%s'" % (distribution_id, 1, post_dt.month))[0][0])
+     
+      return (flt(budget_allocated) * flt(tot_per_allocated)) / 100
+    period_diff = sql("select PERIOD_DIFF('%s','%s')" % (post_dt.strftime('%Y%m'), st_date.strftime('%Y%m')))
+    
+    return (flt(budget_allocated) * (flt(period_diff[0][0]) + 1)) / 12
+    
+  def validate_budget(self, acct, cost_center, actual, budget, action):
+    # action if actual exceeds budget
+    if flt(actual) > flt(budget):
+      msgprint("Your monthly expense "+ cstr((action == 'stop') and "will exceed" or "has exceeded") +" budget for <b>Account - "+cstr(acct)+" </b> under <b>Cost Center - "+ cstr(cost_center) + "</b>"+cstr((action == 'Stop') and ", you can not have this transaction." or "."))
+      if action == 'Stop': raise Exception
+
+  def check_budget(self,le_list,cancel):
+    # get value from record
+    acct, cost_center, debit, credit, post_dt, cfy, company  = le_list
+
+    # get allocated budget
+    bgt = sql("select t1.budget_allocated, t1.actual, t2.distribution_id from `tabBudget Detail` t1, `tabCost Center` t2 where t1.account='%s' and t1.parent=t2.name and t2.name = '%s' and t1.fiscal_year='%s'" % (acct,cost_center,cfy), as_dict =1)
+    curr_amt = ((cancel and -1  or 1) * flt(debit)) + ((cancel and 1  or -1) *  flt(credit))
+    
+    if bgt and bgt[0]['budget_allocated']:
+      # check budget flag in Company
+      bgt_flag = sql("select yearly_bgt_flag, monthly_bgt_flag from `tabCompany` where name = '%s'" % company, as_dict =1)
+      
+      if bgt_flag and bgt_flag[0]['monthly_bgt_flag'] in ['Stop', 'Warn']:
+        # get start date and last date
+        st_date = get_value('Fiscal Year', cfy, 'year_start_date').strftime('%Y-%m-%d')
+        lt_date = sql("select LAST_DAY('%s')" % post_dt)
+        
+        # get Actual
+        actual = get_obj('GL Control').get_period_difference(acct + '~~~' + cstr(st_date) + '~~~' + cstr(lt_date[0][0]), cost_center)
+      
+        # Get Monthly  budget
+        budget = self.get_monthly_budget(bgt and bgt[0]['distribution_id'] or '' , cfy, st_date, post_dt, bgt[0]['budget_allocated'])
+      
+        # validate monthly budget
+        self.validate_budget(acct, cost_center, flt(actual) + flt(curr_amt), budget, 'monthly_bgt_flag')
+
+      # update actual against budget allocated in cost center
+      sql("update `tabBudget Detail` set actual = ifnull(actual,0) + %s where account = '%s' and fiscal_year = '%s' and parent = '%s'" % (curr_amt,cstr(acct),cstr(cfy),cstr(cost_center)))
\ No newline at end of file
diff --git a/accounts/doctype/budget_control/budget_control.txt b/accounts/doctype/budget_control/budget_control.txt
new file mode 100644
index 0000000..babca75
--- /dev/null
+++ b/accounts/doctype/budget_control/budget_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-03-04 14:18:59', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 24, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Budget Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/doctype/budget_detail/__init__.py b/accounts/doctype/budget_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/budget_detail/__init__.py
diff --git a/accounts/doctype/budget_detail/budget_detail.txt b/accounts/doctype/budget_detail/budget_detail.txt
new file mode 100644
index 0000000..6c8bedb
--- /dev/null
+++ b/accounts/doctype/budget_detail/budget_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-06-05 16:50:56', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'CBD/.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Budget Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-06-05 16:50:56', 'doctype': 'DocField', 'oldfieldname': 'account', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Account', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02268', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-28 13:18:00', 'parenttype': 'DocType', 'fieldname': 'account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-05 16:50:56', 'doctype': 'DocField', 'oldfieldname': 'budget_allocated', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Budget Allocated', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02269', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-28 13:18:00', 'parenttype': 'DocType', 'fieldname': 'budget_allocated', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-05 16:50:56', 'doctype': 'DocField', 'oldfieldname': 'actual', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Actual', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Budget Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02270', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-28 13:18:00', 'parenttype': 'DocType', 'fieldname': 'actual', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-06-05 16:50:56', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02272', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-07-28 13:18:00', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/budget_distribution/__init__.py b/accounts/doctype/budget_distribution/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/budget_distribution/__init__.py
diff --git a/accounts/doctype/budget_distribution/budget_distribution.js b/accounts/doctype/budget_distribution/budget_distribution.js
new file mode 100644
index 0000000..03e36f7
--- /dev/null
+++ b/accounts/doctype/budget_distribution/budget_distribution.js
@@ -0,0 +1,9 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  if(doc.__islocal){
+    var callback1 = function(r,rt){
+      refresh_field('budget_distribution_details');
+    }
+    
+    $c('runserverobj',args={'method' : 'get_months', 'docs' : compress_doclist([doc])},callback1);
+  }
+}
\ No newline at end of file
diff --git a/accounts/doctype/budget_distribution/budget_distribution.py b/accounts/doctype/budget_distribution/budget_distribution.py
new file mode 100644
index 0000000..1ac1b8b
--- /dev/null
+++ b/accounts/doctype/budget_distribution/budget_distribution.py
@@ -0,0 +1,42 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc,self.doclist = doc,doclist
+    
+  def get_months(self):
+    month_list = ['January','February','March','April','May','June','July','August','September','October','November','December']
+    idx =1
+    for m in month_list:
+      mnth = addchild(self.doc,'budget_distribution_details','Budget Distribution Detail',1,self.doclist)
+      mnth.month = m or ''
+      mnth.idx = idx
+      idx += 1
+      
+  def validate(self):
+    total = 0
+    for d in getlist(self.doclist,'budget_distribution_details'):
+      total = flt(total) + flt(d.percentage_allocation)
+    if total > 100:
+      msgprint("Percentage Allocation should not exceed 100%.")
+      raise Exception
+    elif total < 100:
+      msgprint("Percentage Allocation should not recede 100%.")
+      raise Exception
\ No newline at end of file
diff --git a/accounts/doctype/budget_distribution/budget_distribution.txt b/accounts/doctype/budget_distribution/budget_distribution.txt
new file mode 100644
index 0000000..47e4b73
--- /dev/null
+++ b/accounts/doctype/budget_distribution/budget_distribution.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-06-05 16:56:17', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 24, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:distribution_id', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Budget Distribution', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': 'Title Case', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00309', 'parent': 'Budget Distribution', 'read': 1, 'create': 1, 'creation': '2009-06-05 16:56:17', 'modified': '2010-05-03 08:45:56', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00312', 'parent': 'Budget Distribution', 'read': 1, 'create': None, 'creation': '2009-06-09 17:48:11', 'modified': '2010-04-28 11:28:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00313', 'parent': 'Budget Distribution', 'read': 1, 'create': None, 'creation': '2009-06-09 17:48:11', 'modified': '2010-04-28 11:28:51', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 3, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00552', 'parent': 'Budget Distribution', 'read': 1, 'create': 1, 'creation': '2009-12-31 12:10:55', 'modified': '2010-05-03 08:45:56', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00553', 'parent': 'Budget Distribution', 'read': 1, 'create': 0, 'creation': '2009-12-31 12:10:55', 'modified': '2010-04-28 11:28:51', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00554', 'parent': 'Budget Distribution', 'read': 1, 'create': None, 'creation': '2009-12-31 12:10:55', 'modified': '2010-04-28 11:28:51', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-06-05 16:56:17', 'doctype': 'DocField', 'oldfieldname': 'distribution_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Distribution ID', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Distribution', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02273', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-28 11:28:51', 'parenttype': 'DocType', 'fieldname': 'distribution_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-06-05 16:56:17', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Distribution', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02274', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-28 11:28:51', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-06-05 16:56:17', 'doctype': 'DocField', 'oldfieldname': 'budget_distribution_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Budget Distribution Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Distribution', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02275', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-28 11:28:51', 'parenttype': 'DocType', 'fieldname': 'budget_distribution_details', 'fieldtype': 'Table', 'options': 'Budget Distribution Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Budget Distribution', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04829', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-28 11:28:51', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/budget_distribution_detail/__init__.py b/accounts/doctype/budget_distribution_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/budget_distribution_detail/__init__.py
diff --git a/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt b/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
new file mode 100644
index 0000000..98966e0
--- /dev/null
+++ b/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-06-05 17:42:48', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'BDD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Budget Distribution Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-06-05 17:42:48', 'doctype': 'DocField', 'oldfieldname': 'month', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Month', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': None, 'parent': 'Budget Distribution Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02276', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-19 15:53:59', 'parenttype': 'DocType', 'fieldname': 'month', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-05 17:42:48', 'doctype': 'DocField', 'oldfieldname': 'percentage_allocation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Percentage Allocation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Budget Distribution Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02277', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-19 15:53:59', 'parenttype': 'DocType', 'fieldname': 'percentage_allocation', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-09 15:31:58', 'doctype': 'DocField', 'oldfieldname': 'aggregate_percentage', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Aggregate Percentage', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': None, 'parent': 'Budget Distribution Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02290', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-19 15:53:59', 'parenttype': 'DocType', 'fieldname': 'aggregate_percentage', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/cost_center/__init__.py b/accounts/doctype/cost_center/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/cost_center/__init__.py
diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js
new file mode 100644
index 0000000..e3ce63f
--- /dev/null
+++ b/accounts/doctype/cost_center/cost_center.js
@@ -0,0 +1,39 @@
+$import(Tips Common)
+
+//Account filtering for cost center
+cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) {
+  var mydoc = locals[this.doctype][this.docname];
+  return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company_name + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50';
+  }
+
+cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){
+  return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company_name="'+ doc.company_name+'" AND `tabCost Center`.company_name is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50';
+}
+
+//parent cost center
+cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
+  if(!doc.company_name){
+    alert('Please enter company name first');
+  }
+}
+
+//company abbr
+cur_frm.cscript.company_name = function(doc,cdt,cdn){
+  get_server_fields('get_abbr','','',doc,cdt,cdn,1);
+}
+
+//onload if cost center is group
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  if(!doc.__islocal && doc.docstatus == 0){
+    get_field(doc.doctype,'group_or_ledger',doc.name).permlevel = 1;
+    refresh_field('group_or_ledger');
+    get_field(doc.doctype,'company_name',doc.name).permlevel = 1;
+    refresh_field('company_name');
+  }
+ 
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py
new file mode 100644
index 0000000..dea00ec
--- /dev/null
+++ b/accounts/doctype/cost_center/cost_center.py
@@ -0,0 +1,58 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+    self.nsm_parent_field = 'parent_cost_center'
+        
+  def autoname(self):
+    #company_abbr = sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+    self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr   
+ 
+      
+  def get_abbr(self):
+    abbr = sql("select abbr from tabCompany where company_name='%s'"%(self.doc.company_name))[0][0] or ''
+    ret = {
+      'company_abbr'  : abbr
+    }
+    return cstr(ret)
+
+  def validate(self): 
+
+    # Cost Center name must be unique
+    # ---------------------------
+
+    if (self.doc.__islocal or (not self.doc.name)) and sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
+      msgprint("Cost Center Name already exists, please rename")
+      raise Exception
+      
+    check_acc_list = []
+    for d in getlist(self.doclist, 'budget_details'):
+      if [d.account, d.fiscal_year] in check_acc_list:
+        msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year))
+        raise Exception
+      if [d.account, d.fiscal_year] not in check_acc_list: check_acc_list.append([d.account, d.fiscal_year])
+      
+  def on_update(self):
+    # update Node Set Model
+    import webnotes
+    import webnotes.utils.nestedset
+    # update Node Set Model
+    webnotes.utils.nestedset.update_nsm(self)
diff --git a/accounts/doctype/cost_center/cost_center.txt b/accounts/doctype/cost_center/cost_center.txt
new file mode 100644
index 0000000..6aeaf50
--- /dev/null
+++ b/accounts/doctype/cost_center/cost_center.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:19', 'search_fields': 'name,parent_cost_center', 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 108, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:cost_center_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': 'Master', 'name': 'Cost Center', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-30 18:18:39', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00852', 'parent': 'Cost Center', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:27:45', 'modified': '2010-11-30 18:18:39', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00853', 'parent': 'Cost Center', 'read': 1, 'create': 1, 'creation': '2010-04-26 16:27:45', 'modified': '2010-11-30 18:18:39', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00862', 'parent': 'Cost Center', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:47:40', 'modified': '2010-11-30 18:18:39', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00151', 'parent': 'Cost Center', 'read': 1, 'create': 0, 'creation': '2009-03-12 14:05:37', 'modified': '2010-11-30 18:18:39', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00310', 'parent': 'Cost Center', 'read': 1, 'create': 1, 'creation': '2009-06-08 11:37:06', 'modified': '2010-11-30 18:18:39', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00311', 'parent': 'Cost Center', 'read': 1, 'create': None, 'creation': '2009-06-08 11:37:06', 'modified': '2010-11-30 18:18:39', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04835', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:19', 'doctype': 'DocField', 'oldfieldname': 'cost_center_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 0, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Cost Center Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL00338', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'cost_center_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:19', 'doctype': 'DocField', 'oldfieldname': 'parent_cost_center', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Parent Cost Center', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select company name first.', 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00339', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'parent_cost_center', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-06-08 10:49:36', 'doctype': 'DocField', 'oldfieldname': 'company_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02281', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'company_name', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-06-08 10:49:36', 'doctype': 'DocField', 'oldfieldname': 'company_abbr', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Company Abbr', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02280', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'company_abbr', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2009-08-10 17:03:04', 'doctype': 'DocField', 'oldfieldname': 'group_or_ledger', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Group or Ledger', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02706', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'group_or_ledger', 'fieldtype': 'Select', 'options': '\nGroup\nLedger', 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-07-28 13:17:53', 'doctype': 'DocField', 'oldfieldname': 'distribution_id', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Distribution Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05721', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'distribution_id', 'fieldtype': 'Link', 'options': 'Budget Distribution', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-06-05 16:46:56', 'doctype': 'DocField', 'oldfieldname': 'budget_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Budget Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02267', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'budget_details', 'fieldtype': 'Table', 'options': 'Budget Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2009-03-12 12:09:19', 'doctype': 'DocField', 'oldfieldname': 'lft', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'lft', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00343', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'lft', 'fieldtype': 'Int', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2009-03-12 12:09:19', 'doctype': 'DocField', 'oldfieldname': 'rgt', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'rgt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00344', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'rgt', 'fieldtype': 'Int', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:19', 'doctype': 'DocField', 'oldfieldname': 'old_parent', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'old_parent', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Cost Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00345', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-11-30 18:18:39', 'parenttype': 'DocType', 'fieldname': 'old_parent', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/fiscal_year/__init__.py b/accounts/doctype/fiscal_year/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/fiscal_year/__init__.py
diff --git a/accounts/doctype/fiscal_year/fiscal_year.js b/accounts/doctype/fiscal_year/fiscal_year.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/accounts/doctype/fiscal_year/fiscal_year.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/accounts/doctype/fiscal_year/fiscal_year.py b/accounts/doctype/fiscal_year/fiscal_year.py
new file mode 100644
index 0000000..7afb037
--- /dev/null
+++ b/accounts/doctype/fiscal_year/fiscal_year.py
@@ -0,0 +1,188 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d,dl
+		
+	def repost(self):
+		if not in_transaction:
+			sql("start transaction")
+				
+		self.clear_account_balances()
+		self.create_account_balances()
+		self.update_opening()
+		self.post_entries()
+		sql("commit")
+		msgprint("Account balance reposted")
+
+	def clear_account_balances(self):
+		# balances clear - `tabAccount Balance` for fiscal year
+		sql("update `tabAccount Balance` set opening=0, balance=0, debit=0, credit=0 where fiscal_year=%s", self.doc.name)
+
+	def create_account_balances(self):
+		# get periods
+		period_list = self.get_period_list()
+		cnt = 0
+		
+		# get accounts
+		al = sql("select name from tabAccount")
+		
+		for a in al:
+			# check
+			if sql("select count(*) from `tabAccount Balance` where fiscal_year=%s and account=%s", (self.doc.name, a[0]))[0][0] < 13:
+				for p in period_list:
+					# check if missing
+					if not sql("select name from `tabAccount Balance` where period=%s and account=%s and fiscal_year=%s", (p[0], a[0], self.doc.name)):
+						d = Document('Account Balance')
+						d.account = a[0]
+						d.period = p[0]
+						d.start_date = p[1].strftime('%Y-%m-%d')
+						d.end_date = p[2].strftime('%Y-%m-%d')
+						d.fiscal_year = p[3]
+						d.debit = 0
+						d.credit = 0
+						d.opening = 0
+						d.balance = 0
+						d.save(1)
+						cnt += 1
+				if cnt % 100 == 0:
+					sql("commit")
+					sql("start transaction")
+		return cnt
+				
+	# Get periods(month and year)
+	#=================================
+	def get_period_list(self):
+		periods = []
+		pl = sql("SELECT name, start_date, end_date, fiscal_year FROM tabPeriod WHERE fiscal_year = '%s' and period_type in ('Month', 'Year') order by start_date ASC, end_date DESC" % self.doc.name)
+		for p in pl:
+			periods.append([p[0], p[1], p[2], p[3]])
+		return periods
+
+	# ====================================================================================
+	def update_opening(self):
+		# set opening from last year closing
+		abl = sql("select t1.account, t1.balance from `tabAccount Balance` t1, tabAccount t2 where t1.period=%s and t2.company=%s and ifnull(t2.is_pl_account, 'No') = 'No' and t1.account = t2.name for update", (self.doc.past_year, self.doc.company))
+		
+		cnt = 0
+		for ab in abl:
+			if cnt % 100 == 0: 
+				sql("commit")
+				sql("start transaction")
+		
+			sql("update `tabAccount Balance` set opening=%s where period=%s and account=%s", (ab[1], self.doc.name, ab[0]))
+			sql("update `tabAccount Balance` set balance=%s where fiscal_year=%s and account=%s", (ab[1], self.doc.name, ab[0]))
+			cnt += 1
+		
+		return cnt
+			
+	def get_account_details(self, account):
+		return sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", account)[0]
+
+	# ====================================================================================
+	def post_entries(self):
+		sql("LOCK TABLE `tabGL Entry` WRITE")
+		# post each gl entry (batch or complete)
+		gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s", (self.doc.name, self.doc.company))
+		account_details = {}
+
+		cnt = 0
+		for entry in gle:
+			# commit in batches of 100
+			if cnt % 100 == 0: 
+				sql("commit")
+				sql("start transaction")
+			cnt += 1
+			#print cnt
+
+			if not account_details.has_key(entry[1]):
+				account_details[entry[1]] = self.get_account_details(entry[1])
+			
+			det = account_details[entry[1]]
+			diff = flt(entry[2])-flt(entry[3])
+			if det[0]=='Credit': diff = -diff
+
+			# build dict
+			p = {
+				'debit': flt(entry[2])
+				,'credit':flt(entry[3])
+				,'opening': entry[4]=='Yes' and diff or 0
+				
+				# end date conditino only if it is not opening
+				,'end_date_condition':(entry[4]!='Yes' and ("and ab.end_date >= '"+entry[5].strftime('%Y-%m-%d')+"'") or '')
+				,'diff': diff
+				,'lft': det[1]
+				,'rgt': det[2]
+				,'posting_date': entry[5]
+				,'fiscal_year': self.doc.name
+			}
+		
+			sql("""update `tabAccount Balance` ab, `tabAccount` a 
+					set 
+						ab.debit = ifnull(ab.debit,0) + %(debit)s
+						,ab.credit = ifnull(ab.credit,0) + %(credit)s
+						,ab.opening = ifnull(ab.opening,0) + %(opening)s
+						,ab.balance = ifnull(ab.balance,0) + %(diff)s
+					where
+						a.lft <= %(lft)s
+						and a.rgt >= %(rgt)s
+						and ab.account = a.name
+						%(end_date_condition)s
+						and ab.fiscal_year = '%(fiscal_year)s' """ % p)
+
+		sql("UNLOCK TABLES")
+
+
+
+	# Clear PV/RV outstanding
+	# ====================================================================================
+	def clear_outstanding(self):
+		# clear o/s of current year
+		sql("update `tabPayable Voucher` set outstanding_amount = 0 where fiscal_year=%s and company=%s", (self.doc.name, self.doc.company))
+		sql("update `tabReceivable Voucher` set outstanding_amount = 0 where fiscal_year=%s and company=%s", (self.doc.name, self.doc.company))
+
+	# Update Voucher Outstanding
+	def update_voucher_outstanding(self):
+		# Clear outstanding
+		self.clear_outstanding()
+		sql("LOCK TABLE `tabGL Entry` WRITE")
+		against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and is_cancelled='No' and company=%s group by against_voucher, against_voucher_type for update", (self.doc.name, self.doc.company))
+		for d in against_voucher:
+			# get voucher balance
+			bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (d[0], d[1]))
+			bal = bal and flt(bal[0][0]) or 0.0
+			if d[1] == 'Payable Voucher':
+				bal = -bal
+			# set voucher balance
+			sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (d[1], bal, d[0]))
+		sql("UNLOCK TABLES")
+
+	# ====================================================================================
+	# Generate periods
+	def create_periods(self):
+		get_obj('Period Control').generate_periods(self.doc.name)
+
+	# on update
+	def on_update(self):
+		if not self.doc.is_fiscal_year_closed:
+			self.is_fiscal_year_closed = 'No'
+			self.doc.save()
+		self.create_periods()
+		self.create_account_balances()
diff --git a/accounts/doctype/fiscal_year/fiscal_year.txt b/accounts/doctype/fiscal_year/fiscal_year.txt
new file mode 100644
index 0000000..144b5d1
--- /dev/null
+++ b/accounts/doctype/fiscal_year/fiscal_year.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:04:09', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:year', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': 'Master', 'name': 'Fiscal Year', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-04 15:31:05', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00150', 'parent': 'Fiscal Year', 'read': 1, 'create': 1, 'creation': '2009-03-12 14:03:39', 'modified': '2010-11-04 15:31:05', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00026', 'parent': 'Fiscal Year', 'read': 1, 'create': 1, 'creation': '2009-03-12 12:04:09', 'modified': '2010-11-04 15:31:05', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-07-31 12:54:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Year Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05771', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04845', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:04:09', 'doctype': 'DocField', 'oldfieldname': 'year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Year Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00270', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'year', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-06-15 14:24:01', 'doctype': 'DocField', 'oldfieldname': 'abbreviation', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Abbreviation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02336', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'abbreviation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-03-12 12:04:09', 'doctype': 'DocField', 'oldfieldname': 'year_start_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Year Start Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00271', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'year_start_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-05-28 11:44:12', 'doctype': 'DocField', 'oldfieldname': 'is_fiscal_year_closed', 'owner': 'nabin@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Year Closed', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05105', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'is_fiscal_year_closed', 'fieldtype': 'Select', 'options': '\nNo\nYes', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-07-31 12:54:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Repost Accounts', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': "Click on the button below to reset balances from your previous year's closing and repost your balances. You can use this if your previous year balance sheet has been changed and you wish to update your current accounts.", 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05772', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-05-04 16:20:41', 'doctype': 'DocField', 'oldfieldname': 'past_year', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Past Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01963', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'past_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-04 22:26:15', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02700', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-05-04 16:20:42', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Repost Account Balances', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01964', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'repost', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-05-27 15:40:53', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Repost Voucher Outstanding', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Fiscal Year', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05101', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-11-04 15:31:05', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_voucher_outstanding', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/form_16a/__init__.py b/accounts/doctype/form_16a/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/form_16a/__init__.py
diff --git a/accounts/doctype/form_16a/form_16a.js b/accounts/doctype/form_16a/form_16a.js
new file mode 100644
index 0000000..75af394
--- /dev/null
+++ b/accounts/doctype/form_16a/form_16a.js
@@ -0,0 +1,32 @@
+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
new file mode 100644
index 0000000..ef2c8ac
--- /dev/null
+++ b/accounts/doctype/form_16a/form_16a.py
@@ -0,0 +1,106 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,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 cstr(ret)
+
+  # Get party details
+  #------------------
+  def get_party_det(self):
+    party_det=sql("Select pan_number, address from `tabAccount` where name = '%s'" % self.doc.party_name)
+    ret = {
+      'pan_number': cstr(party_det[0][0]) ,
+      'party_address': cstr(party_det[0][1])
+    }    
+    return cstr(ret)
+
+  # Get TDS Return acknowledgement
+  #-------------------------------
+  def get_return_ack_details(self):
+    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.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_no 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)
+    
+    self.doc.total_amount = flt(tot)
+
+  # on update
+  def on_update(self):
+    obj = get_obj('Feed Control', 'Feed Control')
+    
+    obj.make_feed(self.doc)
diff --git a/accounts/doctype/form_16a/form_16a.txt b/accounts/doctype/form_16a/form_16a.txt
new file mode 100644
index 0000000..2d48d9d
--- /dev/null
+++ b/accounts/doctype/form_16a/form_16a.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-05-27 16:00:30', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 75, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Form 16A', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-27 16:55:09', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00854', 'parent': 'Form 16A', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:27:45', 'modified': '2010-09-27 16:55:09', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00855', 'parent': 'Form 16A', 'read': 1, 'create': 1, 'creation': '2010-04-26 16:27:45', 'modified': '2010-09-27 16:55:09', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00864', 'parent': 'Form 16A', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:47:40', 'modified': '2010-09-27 16:55:09', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00865', 'parent': 'Form 16A', 'read': 1, 'create': 1, 'creation': '2010-04-26 16:47:40', 'modified': '2010-09-27 16:55:09', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00303', 'parent': 'Form 16A', 'read': 1, 'create': 1, 'creation': '2009-05-27 16:00:30', 'modified': '2010-09-27 16:55:09', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00304', 'parent': 'Form 16A', 'read': 1, 'create': None, 'creation': '2009-05-27 16:00:30', 'modified': '2010-09-27 16:55:09', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'modified_by': 'Administrator', 'name': 'DF000009', 'parent': 'Form 16A', 'format': 'Form 16A Print Format', 'creation': '2009-05-29 12:27:13', 'modified': '2010-09-27 16:55:09', 'doctype': 'DocFormat', 'idx': 1, 'parenttype': 'DocType', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'formats'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Basic Info', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02199', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-09-27 14:46:12', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06135', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': 'from_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'From Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02200', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'from_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': 'to_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'To Date', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02201', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'to_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-29 14:44:49', 'doctype': 'DocField', 'oldfieldname': 'tds_category', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'TDS Category', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02234', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'tds_category', 'fieldtype': 'Link', 'options': 'TDS Category', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': 'party_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Party Name', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02198', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'party_name', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-05-28 16:29:18', 'doctype': 'DocField', 'oldfieldname': 'party_address', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Address', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02232', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'party_address', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': 'pan_number', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'PAN No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02197', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'pan_number', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02196', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-16 11:23:15', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05384', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02192', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-05-27 16:00:30', 'doctype': 'DocField', 'oldfieldname': 'company_address', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company Address', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02194', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'company_address', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-08 13:33:54', 'doctype': 'DocField', 'oldfieldname': 'registration_details', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Registration Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05881', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'registration_details', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-05-27 16:28:38', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Return Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02214', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-09-15 14:51:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get Return Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06115', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_return_ack_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-05-28 11:02:22', 'doctype': 'DocField', 'oldfieldname': 'form_16A_ack_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Form 16A Ack Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02220', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'form_16A_ack_details', 'fieldtype': 'Table', 'options': 'Form 16A Ack Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-05-28 11:02:22', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Payment Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02219', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-05-27 17:22:49', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get TDS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02216', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_tds', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-05-27 16:28:38', 'doctype': 'DocField', 'oldfieldname': 'form_16A_tax_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tax Details', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02215', 'idx': 19, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'form_16A_tax_details', 'fieldtype': 'Table', 'options': 'Form 16A Tax Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': 'total_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Total Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02251', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'total_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02252', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-09-27 14:46:12', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06136', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': 'place', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Place', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02253', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'place', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': 'dt', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02254', 'idx': 24, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'dt', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02255', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': 'full_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Full Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02256', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'full_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 16:27:04', 'doctype': 'DocField', 'oldfieldname': 'designation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02257', 'idx': 27, 'default': None, 'colour': None, 'modified': '2010-09-27 16:55:09', 'parenttype': 'DocType', 'fieldname': 'designation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ 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
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/form_16a_ack_detail/__init__.py
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
new file mode 100644
index 0000000..1bd6e3f
--- /dev/null
+++ b/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-28 10:54:48', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Form 16A Ack Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-05-28 10:54:48', 'doctype': 'DocField', 'oldfieldname': 'quarter', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Quarter', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Ack Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02217', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-05-28 10:54:48', 'parenttype': 'DocType', 'fieldname': 'quarter', 'fieldtype': 'Select', 'options': '\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-28 10:54:48', 'doctype': 'DocField', 'oldfieldname': 'ack_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Acknowledgement No.', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Ack Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02218', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-05-28 10:54:48', 'parenttype': 'DocType', 'fieldname': 'ack_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ 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
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/form_16a_tax_detail/__init__.py
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
new file mode 100644
index 0000000..4e606df
--- /dev/null
+++ b/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-27 16:23:52', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Form 16A Tax Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-27 16:53:54', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'amount_paid', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amount paid / credited', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02203', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'amount_paid', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'date_of_payment', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Date of payment / credit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02204', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'date_of_payment', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'tds_main', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'TDS(Main)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02205', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'tds_main', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'surcharge', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Surcharge', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02206', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'surcharge', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-09-27 16:53:54', 'doctype': 'DocField', 'oldfieldname': 'cess_on_tds', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cess on TDS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06137', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'cess_on_tds', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'total_tax_deposited', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Total Tax Deposited', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02209', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'total_tax_deposited', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'cheque_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cheque / DD No.', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02210', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'cheque_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'bsr_code', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'BSR Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02211', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'bsr_code', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'tax_deposited_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tax Deposited Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02212', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'tax_deposited_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-27 16:23:52', 'doctype': 'DocField', 'oldfieldname': 'challan_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Challan No.', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form 16A Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02213', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-27 16:53:54', 'parenttype': 'DocType', 'fieldname': 'challan_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/gl_control/__init__.py b/accounts/doctype/gl_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/gl_control/__init__.py
diff --git a/accounts/doctype/gl_control/gl_control.js b/accounts/doctype/gl_control/gl_control.js
new file mode 100644
index 0000000..8f8d786
--- /dev/null
+++ b/accounts/doctype/gl_control/gl_control.js
@@ -0,0 +1,367 @@
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    self.entries = []
+
+  # Get Company List
+  # ----------------
+  def get_companies(self,arg=''):
+    d = get_defaults()
+    ret = sql("select name, abbr from tabCompany where docstatus != 2")
+    pl = {}
+    for r in ret:
+      inc = get_value('Account','Income - '+r[1], 'balance')
+      exp = get_value('Account','Expenses - '+r[1], 'balance')
+      pl[r[0]] = flt(flt(inc) - flt(exp))
+    return {'cl':[r[0] for r in ret], 'pl':pl}
+
+  # Get current balance
+  # --------------------
+  def get_bal(self,arg):
+    ac, fy = arg.split('~~~')
+    det = sql("select t1.balance, t2.debit_or_credit from `tabAccount Balance` t1, `tabAccount` t2 where t1.period = %s and t2.name=%s and t1.parent = t2.name", (fy, ac))
+    bal = det and flt(det[0][0]) or 0
+    dr_or_cr = det and flt(det[0][1]) or ''
+    return fmt_money(bal) + ' ' + dr_or_cr
+
+  def get_period_balance(self,arg):
+    acc, f, t = arg.split('~~~')
+    c, fy = '', get_defaults()['fiscal_year']
+
+    det = sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
+    if f: c += (' and t1.posting_date >= "%s"' % f)
+    if t: c += (' and t1.posting_date <= "%s"' % t)
+    bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' and ifnull(is_opening, 'No') = 'No' %s" % (acc, c))
+    bal = bal and flt(bal[0][0]) or 0
+
+    if det[0][0] != 'Debit':
+      bal = (-1) * bal
+
+    # add opening for balance sheet accounts
+    if det[0][3] == 'No':
+      opening = flt(sql("select opening from `tabAccount Balance` where parent=%s and period=%s", (acc, fy))[0][0])
+      bal = bal + opening
+
+    return flt(bal)
+
+
+  def get_period_difference(self,arg, cost_center =''):
+    # used in General Ledger Page Report
+    # used for Budget where cost center passed as extra argument
+    acc, f, t = arg.split('~~~')
+    c, fy = '', get_defaults()['fiscal_year']
+
+    det = sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
+    if f: c += (' and t1.posting_date >= "%s"' % f)
+    if t: c += (' and t1.posting_date <= "%s"' % t)
+    if cost_center: c += (' and t1.cost_center = "%s"' % cost_center)
+    bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' %s" % (acc, c))
+    bal = bal and flt(bal[0][0]) or 0
+
+    if det[0][0] != 'Debit':
+      bal = (-1) * bal
+
+    return flt(bal)
+
+  # Get Children (for tree)
+  # -----------------------
+  def get_cl(self, arg):
+    fy = get_defaults()['fiscal_year']
+    parent, parent_acc_name, company, type = arg.split(',')
+    
+    # get children account details
+    if type=='Account':
+      if parent=='Root':
+        cl = sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where t1.parent_account is NULL or t1.parent_account='' and t1.docstatus != 2 and t1.company=%s and t1.name = t2.parent and t2.period = %s order by t1.name asc", (company, fy),as_dict=1)
+      else:
+        cl = sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where t1.parent_account=%s and t1.docstatus != 2 and t1.company=%s and t1.name = t2.parent and t2.period = %s order by t1.name asc",(parent, company, fy) ,as_dict=1)
+
+      # remove Decimals
+      for c in cl: c['balance'] = flt(c['balance'])
+      
+    # get children cost center details
+    elif type=='Cost Center':
+      if parent=='Root':
+        cl = sql("select name,group_or_ledger, cost_center_name from `tabCost Center`  where parent_cost_center is NULL or parent_cost_center='' and docstatus != 2 and company_name=%s order by name asc",(company),as_dict=1)
+      else:
+        cl = sql("select name,group_or_ledger,cost_center_name from `tabCost Center` where parent_cost_center=%s and docstatus != 2 and company_name=%s order by name asc",(parent,company),as_dict=1)
+    
+    return {'parent':parent, 'parent_acc_name':parent_acc_name, 'cl':cl}
+    
+  # Add a new account
+  # -----------------
+  def add_ac(self,arg):
+    arg = eval(arg)
+    ac = Document('Account')
+    for d in arg.keys():
+      ac.fields[d] = arg[d]
+    ac.old_parent = ''      
+    ac_obj = get_obj(doc=ac)
+    ac_obj.validate()
+    ac_obj.doc.save(1)
+    ac_obj.on_update()
+
+    return ac_obj.doc.name
+  
+  # Add a new cost center
+  #----------------------
+  def add_cc(self,arg):
+    arg = eval(arg)
+    cc = Document('Cost Center')
+    # map fields
+    for d in arg.keys():
+      cc.fields[d] = arg[d]
+    # map company abbr
+    other_info = sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
+    cc.company_abbr = other_info and other_info[0][0] or arg['company_abbr']
+    
+    cc_obj = get_obj(doc=cc)
+    cc_obj.validate()
+    cc_obj.doc.save(1)
+    cc_obj.on_update()
+
+    return cc_obj.doc.name
+    
+    
+
+  # Get field values from the voucher
+  #------------------------------------------
+  def get_val(self, src, d, parent=None):
+    if not src: 
+      return None
+    if src.startswith('parent:'):
+      return parent.fields[src.split(':')[1]]
+    elif src.startswith('value:'):
+      return eval(src.split(':')[1])
+    elif src:
+      return d.fields.get(src)  
+      
+  def check_if_in_list(self, le):
+    for e in self.entries:
+      if e.account == le.account and (cstr(e.against_voucher)==cstr(le.against_voucher)) and (cstr(e.against_voucher_type)==cstr(le.against_voucher_type)) and (cstr(e.cost_center)==cstr(le.cost_center)):
+        return [e]
+    return 0
+  
+  # Make a dictionary(le) for every gl entry and append to a list(self.entries)
+  #----------------------------------------------------------------------------
+  def make_single_entry(self,parent,d,le_map,cancel):
+    if self.get_val(le_map['account'], d, parent) and (self.get_val(le_map['debit'], d, parent) or self.get_val(le_map['credit'], d, parent)):
+      flist = ['account','cost_center','against','debit','credit','remarks','voucher_type','voucher_no','transaction_date','posting_date','fiscal_year','against_voucher','against_voucher_type','company','is_opening', 'aging_date']
+
+      # Check budget before gl entry
+      #check budget only if account is expense account
+      is_expense_acct = sql("select name from tabAccount where is_pl_account='Yes' and debit_or_credit='Debit' and name=%s",self.get_val(le_map['account'], d, parent))
+      if is_expense_acct and self.get_val(le_map['cost_center'], d, parent):
+        get_obj('Budget Control').check_budget([self.get_val(le_map[k], d, parent) for k in flist if k in ['account','cost_center','debit','credit','posting_date','fiscal_year','company']],cancel)
+      
+      # Create new GL entry object and map values
+      le = Document('GL Entry')
+      for k in flist:
+        le.fields[k] = self.get_val(le_map[k], d, parent)
+            
+      # if there is already an entry in this account then just add it to that entry
+      same_head = self.check_if_in_list(le)
+      if same_head:
+        same_head = same_head[0]
+        same_head.debit  = flt(same_head.debit)  + flt(le.debit)
+        same_head.credit = flt(same_head.credit) + flt(le.credit)
+      else:
+        self.entries.append(le)
+    
+  # Save GL Entries     
+  # ----------------
+  def save_entries(self, cancel, adv_adj):
+    for le in self.entries:
+      # cancel
+      if cancel:
+        tmp=le.debit
+        le.debit, le.credit = le.credit, tmp      
+        
+      le_obj = get_obj(doc=le)
+      # validate except on_cancel
+      if not cancel:
+        le_obj.validate()
+
+      # save
+      le.save(1)
+      le_obj.on_update(adv_adj)
+    
+      # update total debit / credit
+      self.td += flt(le.debit)
+      self.tc += flt(le.credit)
+      
+  # Make Multiple Entries
+  # ---------------------
+  def make_gl_entries(self, doc, doclist, cancel=0, adv_adj = 0):
+    # get entries
+    le_map_list = sql("select * from `tabGL Mapper Detail` where parent = %s", doc.doctype, as_dict=1)
+
+    self.td, self.tc = 0.0, 0.0
+
+    for le_map in le_map_list:    
+      if le_map['table_field']:
+        for d in getlist(doclist,le_map['table_field']):
+          # purchase_tax_details is the table of other charges in purchase cycle
+          if le_map['table_field'] != 'purchase_tax_details' or (le_map['table_field'] == 'purchase_tax_details' and d.fields.get('category') != 'For Valuation'):
+            self.make_single_entry(doc,d,le_map,cancel)
+      else:
+        self.make_single_entry(None,doc,le_map,cancel)
+        
+    # save entries
+    self.save_entries(cancel,adv_adj)
+    
+    # check total debit / credit
+    # Due to old wrong entries (total debit != total credit) some voucher could be cancelled
+    if abs(self.td - self.tc) > 0.001 and not cancel:
+      msgprint("Debit and Credit not equal for this voucher: Diff (Debit) is %s" % (self.td-self.tc))
+      raise Exception
+
+    # set as cancelled
+    if cancel:
+      vt, vn = self.get_val(le_map['voucher_type'],  doc, doc), self.get_val(le_map['voucher_no'],  doc, doc)
+      sql("update `tabGL Entry` set is_cancelled='Yes' where voucher_type=%s and voucher_no=%s", (vt, vn))
+  
+  # Get account balance on any date
+  # -------------------------------
+
+  def get_as_on_balance(self, account_name, fiscal_year, as_on, credit_or_debit, is_pl, lft, rgt, ysd):
+    # get total transaction value for the current year
+    bal = bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s and t1.is_opening = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and t1.is_cancelled = 'No'", (ysd,as_on,lft, rgt))
+    bal = bal and (flt(bal[0][0]) - flt(bal[0][1])) or 0
+    
+    if credit_or_debit == 'Credit' and bal:
+      bal = -bal
+      
+    # Add opening balance with the transaction value
+    if is_pl=='No':
+      op = sql("select opening from `tabAccount Balance` where parent=%s and period=%s", (account_name, fiscal_year))
+      op = op and op[0][0] or 0
+      bal += flt(op)
+    return flt(bal)
+ 
+  # ADVANCE ALLOCATION
+  #-------------------
+  def get_advances(self, obj, account_head, table_name,table_field_name, dr_or_cr):
+    jv_detail = 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.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.doc.clear_table(obj.doclist,table_field_name)
+    # Create advance table
+    for d in jv_detail:
+      add = addchild(obj.doc, table_field_name, table_name, 1, obj.doclist)
+      add.journal_voucher = d[0]
+      add.jv_detail_no = d[3]
+      add.remarks = d[1]
+      add.advance_amount = flt(d[2])
+      add.allocate_amount = 0
+      if table_name == 'Advance Allocation Detail':
+        add.tds_amount = flt(d[4])
+  
+  # Clear rows which is not adjusted
+  #-------------------------------------
+  def clear_advances(self, obj,table_name,table_field_name):
+    for d in getlist(obj.doclist,table_field_name):
+      if not flt(d.allocated_amount):
+        sql("update `tab%s` set parent = '' where name = '%s' and parent = '%s'" % (table_name, d.name, d.parent))
+        d.parent = ''
+          
+  # Update aginst document in journal voucher
+  #------------------------------------------
+  def update_against_document_in_jv(self, obj, table_field_name, against_document_no, against_document_doctype, account_head, dr_or_cr,doctype):
+    for d in getlist(obj.doclist, table_field_name):
+      self.validate_jv_entry(d, account_head, dr_or_cr)
+      if flt(d.advance_amount) == flt(d.allocated_amount):
+        # cancel JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj =1)
+
+        # update ref in JV Detail
+        sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Payable Voucher' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
+        
+        # re-submit JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj =1)
+
+      elif flt(d.advance_amount) > flt(d.allocated_amount):
+        # cancel JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj = 1)
+        
+        # add extra entries
+        self.add_extra_entry(jv_obj, d.journal_voucher, d.jv_detail_no, flt(d.allocated_amount), account_head, doctype, dr_or_cr, against_document_no)
+        
+        # re-submit JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj = 1)
+      else:
+        msgprint("Allocation amount cannot be greater than advance amount")
+        raise Exception
+  
+  # Add extra row in jv detail for unadjusted amount
+  #--------------------------------------------------
+  def add_extra_entry(self,jv_obj,jv,jv_detail_no, allocate, account_head, doctype, dr_or_cr, against_document_no):
+    # get old entry details
+    
+    jvd = sql("select %s, cost_center, balance, against_account from `tabJournal Voucher Detail` where name = '%s'" % (dr_or_cr,jv_detail_no))
+    advance = jvd and flt(jvd[0][0]) or 0
+    balance = flt(advance) - flt(allocate)
+
+    # update old entry
+    sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Payable Voucher" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
+
+    # new entry with balance amount
+    add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1, jv_obj.doclist)
+    add.account = account_head
+    add.cost_center = cstr(jvd[0][1])
+    add.balance = cstr(jvd[0][2])
+    add.fields[dr_or_cr] = balance
+    add.against_account = cstr(jvd[0][3])
+    add.is_advance = 'Yes'
+    add.save(1)
+  
+  # check if advance entries are still valid
+  # ----------------------------------------
+  def validate_jv_entry(self, d, account_head, dr_or_cr):
+    # 1. check if there is already a voucher reference
+    # 2. check if amount is same
+    # 3. check if is_advance is 'Yes'
+    # 4. check if jv is submitted
+    ret = sql("select t2.%s from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and (t2.against_voucher = '' || t2.against_voucher is null) and (t2.against_invoice = '' || t2.against_invoice is null) and t2.account = '%s' and t1.name = '%s' and t2.name = '%s' and t2.is_advance = 'Yes' and t1.docstatus=1 and t2.%s = %s" % ( dr_or_cr, account_head, d.journal_voucher, d.jv_detail_no, dr_or_cr, d.advance_amount))
+    if (not ret):
+      msgprint("Please click on 'Get Advances Paid' button as the advance entries have been changed.")
+      raise Exception
+    return
+
+##############################################################################
+# Repair Outstanding Amount
+##############################################################################
+  def repair_voucher_outstanding(self, voucher_obj):
+    msg = []
+
+    # Get Balance from GL Entries
+    bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
+    bal = bal and flt(bal[0][0]) or 0.0
+    if cstr(voucher_obj.doc.doctype) == 'Payable Voucher':
+      bal = -bal
+
+    # Check outstanding Amount
+    if flt(voucher_obj.doc.outstanding_amount) != flt(bal):
+      msgprint('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
+      msg.append('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
+
+      # set voucher balance
+      #sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
+      set(voucher_obj.doc, 'outstanding_amount', flt(bal))
+
+    # Send Mail
+    if msg:
+      email_msg = """ Dear Administrator,
+
+In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:-
+
+%s
+
+""" % (get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))
+
+      sendmail(['jai@webnotestech.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
+    # Acknowledge User
+    msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found."))
diff --git a/accounts/doctype/gl_control/gl_control.py b/accounts/doctype/gl_control/gl_control.py
new file mode 100644
index 0000000..028c8ec
--- /dev/null
+++ b/accounts/doctype/gl_control/gl_control.py
@@ -0,0 +1,399 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    self.entries = []
+
+  # Get Company List
+  # ----------------
+  def get_companies(self,arg=''):
+    #d = get_defaults()
+    ret = sql("select name, abbr from tabCompany where docstatus != 2")
+    #pl = {}
+    #for r in ret:
+    #  inc = get_value('Account','Income - '+r[1], 'balance')
+    #  exp = get_value('Account','Expenses - '+r[1], 'balance')
+    #  pl[r[0]] = flt(flt(inc) - flt(exp))
+    
+    return {'cl':[r[0] for r in ret]}#, 'pl':pl}
+
+  # Get current balance
+  # --------------------
+  def get_bal(self,arg):
+    ac, fy = arg.split('~~~')
+    det = sql("select t1.balance, t2.debit_or_credit from `tabAccount Balance` t1, `tabAccount` t2 where t1.period = %s and t2.name=%s and t1.account = t2.name", (fy, ac))
+    bal = det and flt(det[0][0]) or 0
+    dr_or_cr = det and flt(det[0][1]) or ''
+    return fmt_money(bal) + ' ' + dr_or_cr
+
+  def get_period_balance(self,arg):
+    acc, f, t = arg.split('~~~')
+    c, fy = '', get_defaults()['fiscal_year']
+
+    det = sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
+    if f: c += (' and t1.posting_date >= "%s"' % f)
+    if t: c += (' and t1.posting_date <= "%s"' % t)
+    bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' and ifnull(is_opening, 'No') = 'No' %s" % (acc, c))
+    bal = bal and flt(bal[0][0]) or 0
+
+    if det[0][0] != 'Debit':
+      bal = (-1) * bal
+
+    # add opening for balance sheet accounts
+    if det[0][3] == 'No':
+      opening = flt(sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))[0][0])
+      bal = bal + opening
+
+    return flt(bal)
+
+
+  def get_period_difference(self,arg, cost_center =''):
+    # used in General Ledger Page Report
+    # used for Budget where cost center passed as extra argument
+    acc, f, t = arg.split('~~~')
+    c, fy = '', get_defaults()['fiscal_year']
+
+    det = sql("select debit_or_credit, lft, rgt, is_pl_account from tabAccount where name=%s", acc)
+    if f: c += (' and t1.posting_date >= "%s"' % f)
+    if t: c += (' and t1.posting_date <= "%s"' % t)
+    if cost_center: c += (' and t1.cost_center = "%s"' % cost_center)
+    bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1 where t1.account='%s' %s" % (acc, c))
+    bal = bal and flt(bal[0][0]) or 0
+
+    if det[0][0] != 'Debit':
+      bal = (-1) * bal
+
+    return flt(bal)
+
+  # Get Children (for tree)
+  # -----------------------
+  def get_cl(self, arg):
+
+    fy = get_defaults()['fiscal_year']
+    parent, parent_acc_name, company, type = arg.split(',')
+    
+    # get children account details
+    if type=='Account':
+
+      if parent=='Root Node':
+
+        cl = sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where ifnull(t1.parent_account, '') = '' and t1.docstatus != 2 and t1.company=%s and t1.name = t2.account and t2.period = %s order by t1.name asc", (company, fy),as_dict=1)
+      else:
+        cl = sql("select t1.name, t1.group_or_ledger, t1.debit_or_credit, t2.balance, t1.account_name from tabAccount t1, `tabAccount Balance` t2 where ifnull(t1.parent_account, '')=%s and t1.docstatus != 2 and t1.company=%s and t1.name = t2.account and t2.period = %s order by t1.name asc",(parent, company, fy) ,as_dict=1)
+
+      # remove Decimals
+      for c in cl: c['balance'] = flt(c['balance'])
+      
+    # get children cost center details
+    elif type=='Cost Center':
+      if parent=='Root Node':
+        cl = sql("select name,group_or_ledger, cost_center_name from `tabCost Center`  where ifnull(parent_cost_center, '')='' and docstatus != 2 and company_name=%s order by name asc",(company),as_dict=1)
+      else:
+        cl = sql("select name,group_or_ledger,cost_center_name from `tabCost Center` where ifnull(parent_cost_center, '')=%s and docstatus != 2 and company_name=%s order by name asc",(parent,company),as_dict=1)
+    return {'parent':parent, 'parent_acc_name':parent_acc_name, 'cl':cl}
+    
+  # Add a new account
+  # -----------------
+  def add_ac(self,arg):
+    arg = eval(arg)
+    ac = Document('Account')
+    for d in arg.keys():
+      ac.fields[d] = arg[d]
+    ac.old_parent = ''      
+    ac_obj = get_obj(doc=ac)
+    ac_obj.validate()
+    ac_obj.doc.save(1)
+    ac_obj.on_update()
+
+    return ac_obj.doc.name
+  
+  # Add a new cost center
+  #----------------------
+  def add_cc(self,arg):
+    arg = eval(arg)
+    cc = Document('Cost Center')
+    # map fields
+    for d in arg.keys():
+      cc.fields[d] = arg[d]
+    # map company abbr
+    other_info = sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
+    cc.company_abbr = other_info and other_info[0][0] or arg['company_abbr']
+    
+    cc_obj = get_obj(doc=cc)
+    cc_obj.validate()
+    cc_obj.doc.save(1)
+    cc_obj.on_update()
+
+    return cc_obj.doc.name
+    
+    
+  # Get field values from the voucher
+  #------------------------------------------
+  def get_val(self, src, d, parent=None):
+    if not src: 
+      return None
+    if src.startswith('parent:'):
+      return parent.fields[src.split(':')[1]]
+    elif src.startswith('value:'):
+      return eval(src.split(':')[1])
+    elif src:
+      return d.fields.get(src)  
+      
+  def check_if_in_list(self, le):
+    for e in self.entries:
+      if e.account == le.account and (cstr(e.against_voucher)==cstr(le.against_voucher)) and (cstr(e.against_voucher_type)==cstr(le.against_voucher_type)) and (cstr(e.cost_center)==cstr(le.cost_center)):
+        return [e]
+    return 0
+  
+  # Make a dictionary(le) for every gl entry and append to a list(self.entries)
+  #----------------------------------------------------------------------------
+  def make_single_entry(self,parent,d,le_map,cancel, merge_entries):
+    if self.get_val(le_map['account'], d, parent) and (self.get_val(le_map['debit'], d, parent) or self.get_val(le_map['credit'], d, parent)):
+      flist = ['account','cost_center','against','debit','credit','remarks','voucher_type','voucher_no','transaction_date','posting_date','fiscal_year','against_voucher','against_voucher_type','company','is_opening', 'aging_date']
+
+      # Check budget before gl entry
+      #check budget only if account is expense account
+      is_expense_acct = sql("select name from tabAccount where is_pl_account='Yes' and debit_or_credit='Debit' and name=%s",self.get_val(le_map['account'], d, parent))
+      if is_expense_acct and self.get_val(le_map['cost_center'], d, parent):
+        get_obj('Budget Control').check_budget([self.get_val(le_map[k], d, parent) for k in flist if k in ['account','cost_center','debit','credit','posting_date','fiscal_year','company']],cancel)
+      
+      # Create new GL entry object and map values
+      le = Document('GL Entry')
+      for k in flist:
+        le.fields[k] = self.get_val(le_map[k], d, parent)
+            
+      # if there is already an entry in this account then just add it to that entry
+      same_head = self.check_if_in_list(le)
+      if same_head and merge_entries:
+        same_head = same_head[0]
+        same_head.debit  = flt(same_head.debit)  + flt(le.debit)
+        same_head.credit = flt(same_head.credit) + flt(le.credit)
+      else:
+        self.entries.append(le)
+    
+  # Save GL Entries     
+  # ----------------
+  def save_entries(self, cancel, adv_adj, update_outstanding):
+    for le in self.entries:
+      # cancel
+      if cancel or flt(le.debit) < 0 or flt(le.credit) < 0:
+        tmp=le.debit
+        le.debit, le.credit = abs(flt(le.credit)), abs(flt(tmp))
+      
+
+      le_obj = get_obj(doc=le)
+      # validate except on_cancel
+      if not cancel:
+        le_obj.validate()
+
+      # save
+      le.save(1)
+      le_obj.on_update(adv_adj, cancel, update_outstanding)
+
+      # update total debit / credit
+      self.td += flt(le.debit)
+      self.tc += flt(le.credit)
+      
+  # Make Multiple Entries
+  # ---------------------
+  def make_gl_entries(self, doc, doclist, cancel=0, adv_adj = 0, use_mapper='', merge_entries = 1, update_outstanding='Yes'):
+    # get entries  
+    le_map_list = sql("select * from `tabGL Mapper Detail` where parent = %s", use_mapper or doc.doctype, as_dict=1)
+    self.td, self.tc = 0.0, 0.0
+    for le_map in le_map_list:
+      if le_map['table_field']:
+        for d in getlist(doclist,le_map['table_field']):
+          # purchase_tax_details is the table of other charges in purchase cycle
+          if le_map['table_field'] != 'purchase_tax_details' or (le_map['table_field'] == 'purchase_tax_details' and d.fields.get('category') != 'For Valuation'):
+            self.make_single_entry(doc,d,le_map,cancel, merge_entries)
+      else:
+        self.make_single_entry(None,doc,le_map,cancel, merge_entries)
+        
+    # save entries
+    self.save_entries(cancel, adv_adj, update_outstanding)
+    
+    # check total debit / credit
+    # Due to old wrong entries (total debit != total credit) some voucher could be cancelled
+    if abs(self.td - self.tc) > 0.001 and not cancel:
+      msgprint("Debit and Credit not equal for this voucher: Diff (Debit) is %s" % (self.td-self.tc))
+      raise Exception
+
+    # set as cancelled
+    if cancel:
+      vt, vn = self.get_val(le_map['voucher_type'],  doc, doc), self.get_val(le_map['voucher_no'],  doc, doc)
+      sql("update `tabGL Entry` set is_cancelled='Yes' where voucher_type=%s and voucher_no=%s", (vt, vn))
+
+  # Get account balance on any date
+  # -------------------------------
+  def get_as_on_balance(self, account_name, fiscal_year, as_on, credit_or_debit, lft, rgt):
+    # initialization
+    det = sql("select start_date, opening from `tabAccount Balance` where period = %s and account = %s", (fiscal_year, account_name))
+    from_date, opening, debit_bal, credit_bal, closing_bal = det and det[0][0] or getdate(nowdate()), det and flt(det[0][1]) or 0, 0, 0, det and flt(det[0][1]) or 0
+
+    # prev month closing
+    prev_month_det = sql("select end_date, debit, credit, balance from `tabAccount Balance` where account = %s and end_date <= %s and fiscal_year = %s order by end_date desc limit 1", (account_name, as_on, fiscal_year))
+    if prev_month_det:
+      from_date = getdate(add_days(prev_month_det[0][0].strftime('%Y-%m-%d'), 1))
+      opening = 0
+      debit_bal = flt(prev_month_det[0][1])
+      credit_bal = flt(prev_month_det[0][2])
+      closing_bal = flt(prev_month_det[0][3])
+
+    # curr month transaction
+    if getdate(as_on) >= from_date:
+      curr_month_bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s and ifnull(t1.is_opening, 'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_cancelled, 'No') = 'No'", (from_date, as_on, lft, rgt))
+      curr_debit_amt, curr_credit_amt = flt(curr_month_bal[0][0]), flt(curr_month_bal[0][1])
+      debit_bal = curr_month_bal and debit_bal + curr_debit_amt or debit_bal
+      credit_bal = curr_month_bal and credit_bal + curr_credit_amt or credit_bal
+
+      if credit_or_debit == 'Credit':
+        curr_debit_amt, curr_credit_amt = -1*flt(curr_month_bal[0][0]), -1*flt(curr_month_bal[0][1])
+      closing_bal = closing_bal + curr_debit_amt - curr_credit_amt
+
+    return flt(debit_bal), flt(credit_bal), flt(closing_bal)
+
+
+  # ADVANCE ALLOCATION
+  #-------------------
+  def get_advances(self, obj, account_head, table_name,table_field_name, dr_or_cr):
+    jv_detail = 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))
+    # clear advance table
+    obj.doc.clear_table(obj.doclist,table_field_name)
+    # Create advance table
+    for d in jv_detail:
+      add = addchild(obj.doc, table_field_name, table_name, 1, obj.doclist)
+      add.journal_voucher = d[0]
+      add.jv_detail_no = d[3]
+      add.remarks = d[1]
+      add.advance_amount = flt(d[2])
+      add.allocate_amount = 0
+      if table_name == 'Advance Allocation Detail':
+        add.tds_amount = flt(d[4])
+  
+  # Clear rows which is not adjusted
+  #-------------------------------------
+  def clear_advances(self, obj,table_name,table_field_name):
+    for d in getlist(obj.doclist,table_field_name):
+      if not flt(d.allocated_amount):
+        sql("update `tab%s` set parent = '' where name = '%s' and parent = '%s'" % (table_name, d.name, d.parent))
+        d.parent = ''
+          
+  # Update aginst document in journal voucher
+  #------------------------------------------
+  def update_against_document_in_jv(self, obj, table_field_name, against_document_no, against_document_doctype, account_head, dr_or_cr,doctype):
+    for d in getlist(obj.doclist, table_field_name):
+      self.validate_jv_entry(d, account_head, dr_or_cr)
+      if flt(d.advance_amount) == flt(d.allocated_amount):
+        # cancel JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj =1)
+
+        # update ref in JV Detail
+        sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Payable Voucher' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
+        
+        # re-submit JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj =1)
+
+      elif flt(d.advance_amount) > flt(d.allocated_amount):
+        # cancel JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj = 1)
+        
+        # add extra entries
+        self.add_extra_entry(jv_obj, d.journal_voucher, d.jv_detail_no, flt(d.allocated_amount), account_head, doctype, dr_or_cr, against_document_no)
+        
+        # re-submit JV
+        jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
+        get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj = 1)
+      else:
+        msgprint("Allocation amount cannot be greater than advance amount")
+        raise Exception
+  
+  # Add extra row in jv detail for unadjusted amount
+  #--------------------------------------------------
+  def add_extra_entry(self,jv_obj,jv,jv_detail_no, allocate, account_head, doctype, dr_or_cr, against_document_no):
+    # get old entry details
+    
+    jvd = sql("select %s, cost_center, balance, against_account from `tabJournal Voucher Detail` where name = '%s'" % (dr_or_cr,jv_detail_no))
+    advance = jvd and flt(jvd[0][0]) or 0
+    balance = flt(advance) - flt(allocate)
+
+    # update old entry
+    sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Payable Voucher" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
+
+    # new entry with balance amount
+    add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1, jv_obj.doclist)
+    add.account = account_head
+    add.cost_center = cstr(jvd[0][1])
+    add.balance = cstr(jvd[0][2])
+    add.fields[dr_or_cr] = balance
+    add.against_account = cstr(jvd[0][3])
+    add.is_advance = 'Yes'
+    add.save(1)
+  
+  # check if advance entries are still valid
+  # ----------------------------------------
+  def validate_jv_entry(self, d, account_head, dr_or_cr):
+    # 1. check if there is already a voucher reference
+    # 2. check if amount is same
+    # 3. check if is_advance is 'Yes'
+    # 4. check if jv is submitted
+    ret = sql("select t2.%s from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and (t2.against_voucher = '' or t2.against_voucher is null) and (t2.against_invoice = '' or t2.against_invoice is null) and t2.account = '%s' and t1.name = '%s' and t2.name = '%s' and t2.is_advance = 'Yes' and t1.docstatus=1 and t2.%s = %s" % ( dr_or_cr, account_head, d.journal_voucher, d.jv_detail_no, dr_or_cr, d.advance_amount))
+    if (not ret):
+      msgprint("Please click on 'Get Advances Paid' button as the advance entries have been changed.")
+      raise Exception
+    return
+
+##############################################################################
+# Repair Outstanding Amount
+##############################################################################
+  def repair_voucher_outstanding(self, voucher_obj):
+    msg = []
+
+    # Get Balance from GL Entries
+    bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
+    bal = bal and flt(bal[0][0]) or 0.0
+    if cstr(voucher_obj.doc.doctype) == 'Payable Voucher':
+      bal = -bal
+
+    # Check outstanding Amount
+    if flt(voucher_obj.doc.outstanding_amount) != flt(bal):
+      msgprint('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
+      msg.append('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
+
+      # set voucher balance
+      #sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
+      set(voucher_obj.doc, 'outstanding_amount', flt(bal))
+
+    # Send Mail
+    if msg:
+      email_msg = """ Dear Administrator,
+
+In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:-
+
+%s
+
+""" % (get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))
+
+      sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
+    # Acknowledge User
+    msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found."))
diff --git a/accounts/doctype/gl_control/gl_control.txt b/accounts/doctype/gl_control/gl_control.txt
new file mode 100644
index 0000000..b1964be
--- /dev/null
+++ b/accounts/doctype/gl_control/gl_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-06 11:45:17', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 300, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'GL Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-18 16:35:29', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/doctype/gl_entry/__init__.py b/accounts/doctype/gl_entry/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/gl_entry/__init__.py
diff --git a/accounts/doctype/gl_entry/gl_entry.js b/accounts/doctype/gl_entry/gl_entry.js
new file mode 100644
index 0000000..9f34ad8
--- /dev/null
+++ b/accounts/doctype/gl_entry/gl_entry.js
@@ -0,0 +1,202 @@
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+
+  # Validate mandatory
+  #-------------------
+  def check_mandatory(self):
+    # Following fields are mandatory in GL Entry
+    mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
+    for k in mandatory:
+      if not self.doc.fields.get(k):
+        msgprint("%s is mandatory for GL Entry" % k)
+        raise Exception
+        
+    # Zero value transaction is not allowed
+    if not (flt(self.doc.debit) or flt(self.doc.credit)):
+      msgprint("GL Entry: Debit or Credit amount is mandatory for %s" % self.doc.account)
+      raise Exception
+      
+    # Debit and credit can not done at the same time
+    if flt(self.doc.credit) != 0 and flt(self.doc.debit) != 0:
+      msgprint("Sorry you cannot credit and debit under same account head.")
+      raise Exception, "Validation Error."
+    
+  # Cost center is required only if transaction made against pl account
+  #--------------------------------------------------------------------
+  def pl_must_have_cost_center(self):
+    if sql("select name from tabAccount where name=%s and is_pl_account='Yes'", self.doc.account):
+      if not self.doc.cost_center and not self.doc.voucher_type != 'Period Closing Entry':
+        msgprint("Error: Cost Center must be specified for PL Account: %s" % self.doc.account_name)
+        raise Exception
+    else: # not pl
+      if self.doc.cost_center:
+        self.doc.cost_center = ''
+    
+  # Account must be ledger, active and not freezed
+  #-----------------------------------------------
+  def validate_account_details(self, adv_adj):
+    ret = sql("select group_or_ledger, docstatus, freeze_account, company from tabAccount where name=%s", self.doc.account)
+    
+    # 1. Checks whether Account type is group or ledger
+    if ret and ret[0][0]=='Group':
+      msgprint("Error: All accounts must be Ledgers. Account %s is a group" % self.doc.account)
+      raise Exception
+
+    # 2. Checks whether Account is active
+    if ret and ret[0][1]==2:
+      msgprint("Error: All accounts must be Active. Account %s moved to Trash" % self.doc.account)
+      raise Exception
+      
+    # 3. Account has been freezed for other users except account manager
+    if ret and ret[0][2]== 'Yes' and not adv_adj and not 'Accounts Manager' in session['data']['roles']:
+      msgprint("Error: Account %s has been freezed. Only Accounts Manager can do transaction against this account." % self.doc.account)
+      raise Exception
+      
+    # 4. Check whether account is within the company
+    if ret and ret[0][3] != self.doc.company:
+      msgprint("Account: %s does not belong to the company: %s" % (self.doc.account, self.doc.company))
+      raise Exception
+      
+  # Posting date must be in selected fiscal year and fiscal year is active
+  #-------------------------------------------------------------------------
+  def validate_posting_date(self):
+    fy = sql("select docstatus, year_start_date from `tabFiscal Year` where name=%s ", self.doc.fiscal_year)
+    ysd = fy[0][1]
+    yed = get_last_day(get_first_day(ysd,0,11))
+    pd = getdate(self.doc.posting_date)
+    if fy[0][0] == 2:
+      msgprint("Fiscal Year is not active. You can restore it from Trash")
+      raise Exception
+    if pd < ysd or pd > yed:
+      msgprint("Posting date must be in the Selected Financial Year")
+      raise Exception
+      
+  
+  # Nobody can do GL Entries where posting date is before freezing date except 'Accounts Manager'
+  #----------------------------------------------------------------------------------------------
+  def check_freezing_date(self, adv_adj):
+    if not adv_adj:
+      pd,fd = getdate(self.doc.posting_date),0
+      acc_frozen_upto = get_obj(dt = 'Manage Account').doc.acc_frozen_upto or ''
+      if acc_frozen_upto:
+        fd = getdate(acc_frozen_upto)
+      
+      bde_auth_role = get_value( 'Manage Account', None,'bde_auth_role')
+      if fd and pd <= fd and (bde_auth_role and not bde_auth_role in session['data']['roles']):
+        msgprint("Message:You are not authorized to do back dated entries for account: %s before %s." % (self.doc.account, str(fd)))
+        raise Exception
+
+  # create new bal if not exists
+  #-----------------------------
+  def create_new_balances(self, ac_obj, p, amt):
+    ac = addchild(ac_obj.doc, 'account_balances', 'Account Balance', 1)
+    ac.period = p[0]
+    ac.start_date = p[1].strftime('%Y-%m-%d')
+    ac.end_date = p[2].strftime('%Y-%m-%d')
+    ac.fiscal_year = p[3]
+    ac.opening = 0
+    ac.balance = amt
+    ac.save()
+
+  # Post Balance
+  # ------------
+  def post_balance(self, acc):
+    # get details
+    lft = sql("select lft, rgt, debit_or_credit from `tabAccount` where name='%s'" % acc)
+
+    # amount to debit
+    amt = flt(self.doc.debit) - flt(self.doc.credit)
+    if lft[0][2] == 'Credit': amt = -amt
+
+    # get periods
+    periods = self.get_period_list(self.doc.posting_date, self.doc.fiscal_year)
+    
+    acc_obj = get_obj('Account', self.doc.account)
+    for p in periods:
+      if not sql("select name from `tabAccount Balance` where parent=%s and period=%s", (self.doc.account, p[0])):
+        self.create_new_balances(acc_obj, p, amt)
+      else:
+        # update current
+        pl = sql("update `tabAccount Balance` t1, `tabAccount` t2 set t1.balance = t1.balance + %s where t2.lft<=%s and t2.rgt>=%s and t1.parent = t2.name and t1.period = '%s'" % (amt, cint(lft[0][0]), cint(lft[0][1]), p[0]))
+
+    # update opening
+    if self.doc.is_opening=='Yes':
+      pl = sql("update `tabAccount Balance` t1, `tabAccount` t2 set t1.opening = ifnull(t1.opening,0) + %s where t2.lft<=%s and t2.rgt>=%s and t1.parent = t2.name and t1.period = '%s'" % (amt, cint(lft[0][0]), cint(lft[0][1]), self.doc.fiscal_year))
+    
+  # Get periods(month and year)
+  #-----------------------------
+  def get_period_list(self, dt, fy):
+    pl = sql("SELECT name, start_date, end_date, fiscal_year FROM tabPeriod WHERE end_date >='%s' and fiscal_year = '%s' and period_type in ('Month', 'Year')" % (dt,fy))
+    return pl
+
+  # Voucher Balance
+  # ---------------  
+  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=='Payable Voucher':
+      # amount to debit
+      bal = -bal
+      
+      # Check if tds applicable
+      tds = sql("select total_tds_on_voucher from `tabPayable Voucher` 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)))
+      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))
+    
+          
+  # Total outstanding can not be greater than credit limit for any time for any customer
+  #---------------------------------------------------------------------------------------------
+  def check_credit_limit(self):
+    #check for user role Freezed
+    master_type=sql("select master_type from `tabAccount` where name='%s' " %self.doc.account)
+    tot_outstanding = 0  #needed when there is no GL Entry in the system for that acc head
+    if (self.doc.voucher_type=='Journal Voucher' or self.doc.voucher_type=='Receivable Voucher') and (master_type and master_type[0][0]=='Customer'):
+      dbcr=sql("select sum(debit),sum(credit) from `tabGL Entry` where account = '%s' and is_cancelled='No'" % self.doc.account)
+      if dbcr:
+        tot_outstanding = flt(dbcr[0][0])-flt(dbcr[0][1])+flt(self.doc.debit)-flt(self.doc.credit)
+      get_obj('Account',self.doc.account).check_credit_limit(self.doc.account, self.doc.company, tot_outstanding)
+  
+  #for opening entry account can not be pl account
+  #-----------------------------------------------
+  def check_pl_account(self):
+    if self.doc.is_opening=='Yes':
+      is_pl_account=sql("select is_pl_account from `tabAccount` where name='%s'"%(self.doc.account))
+      if is_pl_account and is_pl_account[0][0]=='Yes':
+        msgprint("For opening balance entry account can not be a PL account")
+        raise Exception
+
+  # Validate
+  # --------
+  def validate(self):  # not called on cancel
+    self.check_mandatory()
+    self.pl_must_have_cost_center()
+    self.validate_posting_date()
+    self.doc.is_cancelled = 'No' # will be reset by GL Control if cancelled
+    self.check_credit_limit()
+    self.check_pl_account()
+
+  # On Update
+  #----------
+  def on_update(self,adv_adj):
+    # Account must be ledger, active and not freezed
+    self.validate_account_details(adv_adj)
+    
+    # Posting date must be after freezing date
+    self.check_freezing_date(adv_adj)
+    
+    # Update current account balance
+    self.post_balance(self.doc.account)
+    
+    # Update outstanding amt on against voucher
+    if self.doc.against_voucher:
+      self.update_outstanding_amt()
\ No newline at end of file
diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py
new file mode 100644
index 0000000..5d39760
--- /dev/null
+++ b/accounts/doctype/gl_entry/gl_entry.py
@@ -0,0 +1,251 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d, dl
+
+	# Validate mandatory
+	#-------------------
+	def check_mandatory(self):
+		# Following fields are mandatory in GL Entry
+		mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
+		for k in mandatory:
+			if not self.doc.fields.get(k):
+				msgprint("%s is mandatory for GL Entry" % k)
+				raise Exception
+				
+		# Zero value transaction is not allowed
+		if not (flt(self.doc.debit) or flt(self.doc.credit)):
+			msgprint("GL Entry: Debit or Credit amount is mandatory for %s" % self.doc.account)
+			raise Exception
+			
+		# Debit and credit can not done at the same time
+		if flt(self.doc.credit) != 0 and flt(self.doc.debit) != 0:
+			msgprint("Sorry you cannot credit and debit under same account head.")
+			raise Exception, "Validation Error."
+		
+	# Cost center is required only if transaction made against pl account
+	#--------------------------------------------------------------------
+	def pl_must_have_cost_center(self):
+		if sql("select name from tabAccount where name=%s and is_pl_account='Yes'", self.doc.account):
+			if not self.doc.cost_center and self.doc.voucher_type != 'Period Closing Voucher':
+				msgprint("Error: Cost Center must be specified for PL Account: %s" % self.doc.account)
+				raise Exception
+		else: # not pl
+			if self.doc.cost_center:
+				self.doc.cost_center = ''
+		
+	# Account must be ledger, active and not freezed
+	#-----------------------------------------------
+	def validate_account_details(self, adv_adj):
+		ret = sql("select group_or_ledger, docstatus, freeze_account, company from tabAccount where name=%s", self.doc.account)
+		
+		# 1. Checks whether Account type is group or ledger
+		if ret and ret[0][0]=='Group':
+			msgprint("Error: All accounts must be Ledgers. Account %s is a group" % self.doc.account)
+			raise Exception
+
+		# 2. Checks whether Account is active
+		if ret and ret[0][1]==2:
+			msgprint("Error: All accounts must be Active. Account %s moved to Trash" % self.doc.account)
+			raise Exception
+			
+		# 3. Account has been freezed for other users except account manager
+		if ret and ret[0][2]== 'Yes' and not adv_adj and not 'Accounts Manager' in webnotes.user.get_roles():
+			msgprint("Error: Account %s has been freezed. Only Accounts Manager can do transaction against this account." % self.doc.account)
+			raise Exception
+			
+		# 4. Check whether account is within the company
+		if ret and ret[0][3] != self.doc.company:
+			msgprint("Account: %s does not belong to the company: %s" % (self.doc.account, self.doc.company))
+			raise Exception
+			
+	# Posting date must be in selected fiscal year and fiscal year is active
+	#-------------------------------------------------------------------------
+	def validate_posting_date(self):
+		fy = sql("select docstatus, year_start_date from `tabFiscal Year` where name=%s ", self.doc.fiscal_year)
+		ysd = fy[0][1]
+		yed = get_last_day(get_first_day(ysd,0,11))
+		pd = getdate(self.doc.posting_date)
+		if fy[0][0] == 2:
+			msgprint("Fiscal Year is not active. You can restore it from Trash")
+			raise Exception
+		if pd < ysd or pd > yed:
+			msgprint("Posting date must be in the Selected Financial Year")
+			raise Exception
+			
+	
+	# Nobody can do GL Entries where posting date is before freezing date except authorized person
+	#----------------------------------------------------------------------------------------------
+	def check_freezing_date(self, adv_adj):
+		if not adv_adj:
+			acc_frozen_upto = get_value('Manage Account', None, 'acc_frozen_upto')
+			if acc_frozen_upto:
+				bde_auth_role = get_value( 'Manage Account', None,'bde_auth_role')
+				if getdate(self.doc.posting_date) <= getdate(acc_frozen_upto) and not bde_auth_role in webnotes.user.get_roles():
+					msgprint("You are not authorized to do/modify back dated accounting entries before %s." % getdate(acc_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
+
+	# create new bal if not exists
+	#-----------------------------
+	def create_new_balances(self, det):
+		# check
+		if sql("select count(t1.name) from `tabAccount Balance` t1, tabAccount t2 where t1.fiscal_year=%s and t2.lft <= %s and t2.rgt >= %s and t2.name = t1.account", (self.doc.fiscal_year, det[0][0], det[0][1]))[0][0] < 13*(cint(det[0][1]) - cint(det[0][0]) +1)/2:
+			period_list = self.get_period_list()
+			accounts = sql("select name from tabAccount where lft <= %s and rgt >= %s" % (det[0][0], det[0][1]))
+
+			for p in period_list:
+				for a in accounts:
+					# check if missing
+					if not sql("select name from `tabAccount Balance` where period=%s and account=%s and fiscal_year=%s", (p[0], a[0], self.doc.fiscal_year)):
+						d = Document('Account Balance')
+						d.account = a[0]
+						d.period = p[0]
+						d.start_date = p[1].strftime('%Y-%m-%d')
+						d.end_date = p[2].strftime('%Y-%m-%d')
+						d.fiscal_year = self.doc.fiscal_year
+						d.debit = 0
+						d.credit = 0
+						d.opening = 0
+						d.balance = 0
+						d.save(1)
+
+	# Post Balance
+	# ------------
+	def post_balance(self, acc, cancel):
+		# get details
+		det = sql("select lft, rgt, debit_or_credit from `tabAccount` where name='%s'" % acc)
+
+		# amount to debit
+		amt = flt(self.doc.debit) - flt(self.doc.credit)
+		if det[0][2] == 'Credit': amt = -amt
+		if cancel:
+			debit = -1 * flt(self.doc.credit)
+			credit = -1 * flt(self.doc.debit)
+		else:
+			debit = flt(self.doc.debit)
+			credit = flt(self.doc.credit)
+		
+		self.create_new_balances(det)
+		
+		# build dict
+		p = {
+			'debit': flt(debit)
+			,'credit':flt(credit)
+			,'opening': self.doc.is_opening=='Yes' and amt or 0
+			# end date condition only if it is not opening
+			,'end_date_condition':(self.doc.is_opening!='Yes' and ("and ab.end_date >= '"+self.doc.posting_date+"'") or '')
+			,'diff': amt
+			,'lft': cint(det[0][0])
+			,'rgt': cint(det[0][1])
+			,'posting_date': self.doc.posting_date
+			,'fiscal_year': self.doc.fiscal_year
+		}
+
+		sql("""update `tabAccount Balance` ab, `tabAccount` a 
+				set 
+					ab.debit = ifnull(ab.debit,0) + %(debit)s
+					,ab.credit = ifnull(ab.credit,0) + %(credit)s
+					,ab.opening = ifnull(ab.opening,0) + %(opening)s
+					,ab.balance = ifnull(ab.balance,0) + %(diff)s
+				where
+					a.lft <= %(lft)s
+					and a.rgt >= %(rgt)s
+					and ab.account = a.name
+					%(end_date_condition)s
+					and ab.fiscal_year = '%(fiscal_year)s' """ % p)
+
+			
+	# Get periods(month and year)
+	#-----------------------------
+	def get_period_list(self):
+		pl = sql("SELECT name, start_date, end_date, fiscal_year FROM tabPeriod WHERE fiscal_year = '%s' and period_type in ('Month', 'Year')" % (self.doc.fiscal_year))
+		return pl
+
+	# Voucher Balance
+	# ---------------	
+	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=='Payable Voucher':
+			# amount to debit
+			bal = -bal
+			
+			# Check if tds applicable
+			tds = sql("select total_tds_on_voucher from `tabPayable Voucher` 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)))
+			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))
+		
+					
+	# Total outstanding can not be greater than credit limit for any time for any customer
+	#---------------------------------------------------------------------------------------------
+	def check_credit_limit(self):
+		#check for user role Freezed
+		master_type=sql("select master_type, master_name from `tabAccount` where name='%s' " %self.doc.account)
+		tot_outstanding = 0	#needed when there is no GL Entry in the system for that acc head
+		if (self.doc.voucher_type=='Journal Voucher' or self.doc.voucher_type=='Receivable Voucher') and (master_type and master_type[0][0]=='Customer' and master_type[0][1]):
+			dbcr = sql("select sum(debit),sum(credit) from `tabGL Entry` where account = '%s' and is_cancelled='No'" % self.doc.account)
+			if dbcr:
+				tot_outstanding = flt(dbcr[0][0])-flt(dbcr[0][1])+flt(self.doc.debit)-flt(self.doc.credit)
+			get_obj('Account',self.doc.account).check_credit_limit(self.doc.account, self.doc.company, tot_outstanding)
+	
+	#for opening entry account can not be pl account
+	#-----------------------------------------------
+	def check_pl_account(self):
+		if self.doc.is_opening=='Yes':
+			is_pl_account=sql("select is_pl_account from `tabAccount` where name='%s'"%(self.doc.account))
+			if is_pl_account and is_pl_account[0][0]=='Yes':
+				msgprint("For opening balance entry account can not be a PL account")
+				raise Exception
+
+	# Validate
+	# --------
+	def validate(self):	# not called on cancel
+		self.check_mandatory()
+		self.pl_must_have_cost_center()
+		self.validate_posting_date()
+		self.doc.is_cancelled = 'No' # will be reset by GL Control if cancelled
+		self.check_credit_limit()
+		self.check_pl_account()
+
+	# On Update
+	#----------
+	def on_update(self,adv_adj, cancel, update_outstanding = 'Yes'):
+		# Account must be ledger, active and not freezed
+		self.validate_account_details(adv_adj)
+		
+		# Posting date must be after freezing date
+		self.check_freezing_date(adv_adj)
+		
+		# Update current account balance
+		self.post_balance(self.doc.account, cancel)
+		
+		# Update outstanding amt on against voucher
+		if self.doc.against_voucher and self.doc.against_voucher_type not in ('Journal Voucher','POS') and update_outstanding == 'Yes':
+			self.update_outstanding_amt()
diff --git a/accounts/doctype/gl_entry/gl_entry.txt b/accounts/doctype/gl_entry/gl_entry.txt
new file mode 100644
index 0000000..85d3c32
--- /dev/null
+++ b/accounts/doctype/gl_entry/gl_entry.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:20', 'search_fields': 'voucher_no,account,posting_date,against_voucher', 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 133, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'GL.#######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': '', 'name': 'GL Entry', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-22 17:00:21', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00033', 'parent': 'GL Entry', 'read': 1, 'create': 0, 'creation': '2009-03-12 12:09:20', 'modified': '2010-11-22 17:00:21', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM01240', 'parent': 'GL Entry', 'read': 1, 'create': None, 'creation': '2010-11-22 16:15:13', 'modified': '2010-11-22 17:00:21', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM01241', 'parent': 'GL Entry', 'read': 1, 'create': None, 'creation': '2010-11-22 17:00:21', 'modified': '2010-11-22 17:00:21', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM01242', 'parent': 'GL Entry', 'read': 1, 'create': None, 'creation': '2010-11-22 17:00:21', 'modified': '2010-11-22 17:00:21', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'posting_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Posting Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date at which current entry will get or has actually executed.', 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00346', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'posting_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'transaction_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Transaction Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date at which current entry is made in system.', 'parent': 'GL Entry', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00347', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'transaction_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-30 17:58:29', 'doctype': 'DocField', 'oldfieldname': 'aging_date', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Aging Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL04932', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'aging_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'account', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00348', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'cost_center', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Cost Center', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL00349', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'cost_center', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'debit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Debit Amt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00350', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'debit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'credit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Credit Amt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00351', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'credit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'against', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Against', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00352', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'against', 'fieldtype': 'Text', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'against_voucher', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Against Voucher', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL00353', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'against_voucher', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'against_voucher_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Against Voucher Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL00354', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'against_voucher_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'voucher_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Voucher Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00355', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'voucher_type', 'fieldtype': 'Select', 'options': 'Journal Voucher\nReceivable Voucher\nPayable Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'voucher_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Voucher No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00356', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'voucher_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'remarks', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Remarks', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL00357', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'remarks', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'is_cancelled', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Is Cancelled', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00358', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'is_cancelled', 'fieldtype': 'Select', 'options': 'No\nYes', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-05-04 15:20:58', 'doctype': 'DocField', 'oldfieldname': 'is_opening', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Is Opening', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01962', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'is_opening', 'fieldtype': 'Select', 'options': 'No\nYes', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-07-21 16:55:39', 'doctype': 'DocField', 'oldfieldname': 'is_advance', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Is Advance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL02619', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'is_advance', 'fieldtype': 'Select', 'options': 'No\nYes', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00359', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Entry', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00360', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-11-22 17:00:21', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/__init__.py b/accounts/doctype/journal_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/journal_voucher/__init__.py
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
new file mode 100644
index 0000000..dce570b
--- /dev/null
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -0,0 +1,158 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  var cp = locals['Control Panel']['Control Panel'];
+  if(doc.__islocal){
+    doc.clearance_date ='';
+    refresh_field('clearance_date');
+  }
+  
+  if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
+
+  if(cp.country == 'India') {
+    unhide_field(['tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','supplier_account']);
+  }
+  else {
+    hide_field(['tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','supplier_account']);
+  }
+}
+
+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.cscript.refresh = cur_frm.cscript.is_opening;
+
+cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(doc) {
+  return "SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company='"+doc.company+"' AND tabAccount.group_or_ledger = 'Ledger' AND tabAccount.docstatus != 2 AND `tabAccount`.%(key)s LIKE '%s' ORDER BY `tabAccount`.name DESC LIMIT 50";
+}
+
+cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc, cdt, cdn) {
+  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';
+}
+
+// Restrict Voucher based on Account
+// ---------------------------------
+cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) {
+  var d = locals[this.doctype][this.docname];
+  return "SELECT `tabPayable Voucher`.name, `tabPayable Voucher`.credit_to, `tabPayable Voucher`.outstanding_amount,`tabPayable Voucher`.bill_no, `tabPayable Voucher`.bill_date FROM `tabPayable Voucher` WHERE `tabPayable Voucher`.credit_to='"+d.account+"' AND `tabPayable Voucher`.outstanding_amount > 0 AND `tabPayable Voucher`.docstatus = 1 AND `tabPayable Voucher`.%(key)s LIKE '%s' ORDER BY `tabPayable Voucher`.name DESC LIMIT 200";
+}
+
+cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) {
+  var d = locals[this.doctype][this.docname];
+  return "SELECT `tabReceivable Voucher`.name, `tabReceivable Voucher`.debit_to, `tabReceivable Voucher`.outstanding_amount FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.debit_to='"+d.account+"' AND `tabReceivable Voucher`.outstanding_amount > 0 AND `tabReceivable Voucher`.docstatus = 1 AND `tabReceivable Voucher`.%(key)s LIKE '%s' ORDER BY `tabReceivable Voucher`.name DESC LIMIT 200";
+}
+
+// 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){
+  var d = locals[cdt][cdn];
+  if(d.idx == 1){
+    d.debit = 0;
+    d.credit = 0;
+  }
+}
+
+// Get Outstanding of Payable & Receivable Voucher
+// -----------------------------------------------
+
+cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.against_voucher && !flt(d.debit)) {
+    args = {'doctype': 'Payable Voucher', 'docname': d.against_voucher }
+    get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
+  }
+}
+
+cur_frm.cscript.against_invoice = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.against_invoice && !flt(d.credit)) {
+    args = {'doctype': 'Receivable Voucher', 'docname': d.against_invoice }
+    get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
+  }
+}
+
+
+// Update Totals
+// ---------------
+cur_frm.cscript.update_totals = function(doc) {
+  var td=0.0; var tc =0.0;
+  var el = getchildren('Journal Voucher Detail', doc.name, 'entries');
+  for(var i in el) {
+    td += flt(el[i].debit);
+    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);
+  refresh_many(['total_debit','total_credit','difference']);
+}
+
+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){
+  cur_frm.refresh();
+  });
+}
+// Get balance
+// -----------
+
+cur_frm.cscript.account = function(doc,dt,dn) {
+  var d = locals[dt][dn];
+  $c_obj('GL Control','get_bal',d.account+'~~~'+doc.fiscal_year, function(r,rt) { d.balance = r.message; refresh_field('balance',d.name,'entries'); });
+} 
+
+cur_frm.cscript.validate = function(doc,cdt,cdn) {
+  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 Receivable Voucher *****************
+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';
+}
+
+
+
+cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
+  if(doc.select_print_heading){
+    // print heading
+    cur_frm.pformat.print_heading = doc.select_print_heading;
+  }
+  else
+    cur_frm.pformat.print_heading = "Journal Voucher";
+}
+
+/****************** Get Accounting Entry *****************/
+cur_frm.cscript['View Ledger Entry'] = function(doc,cdt,cdn){
+  var callback = function(report){
+    report.set_filter('GL Entry', 'Voucher No',doc.name);
+    report.dt.run();
+  }
+  loadreport('GL Entry','General Ledger', callback);
+}
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py
new file mode 100644
index 0000000..cb10555
--- /dev/null
+++ b/accounts/doctype/journal_voucher/journal_voucher.py
@@ -0,0 +1,446 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getTraceback, get_defaults, getdate, has_common, month_name, now, nowdate, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+    self.master_type = {}
+    self.credit_days_for = {}
+    self.credit_days_global = -1
+    self.is_approving_authority = -1
+
+  #--------------------------------------------------------------------------------------------------------
+  # Autoname
+  #--------------------------------------------------------------------------------------------------------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+  #--------------------------------------------------------------------------------------------------------
+  # Fetch outstanding amount from RV/PV
+  #--------------------------------------------------------------------------------------------------------
+  def get_outstanding(self, args):
+    args = eval(args)
+    o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname']))
+    if args['doctype'] == 'Payable Voucher':
+      return cstr({'debit': o_s and flt(o_s[0][0]) or 0})
+    if args['doctype'] == 'Receivable Voucher':
+      return cstr({'credit': o_s and flt(o_s[0][0]) or 0})
+
+  #--------------------------------------------------------------------------------------------------------
+  # Create remarks
+  #--------------------------------------------------------------------------------------------------------
+  def create_remarks(self):
+    r = []
+    if self.doc.cheque_no :
+      if self.doc.cheque_date:
+        r.append('Via cheque #%s dated %s' % (self.doc.cheque_no, formatdate(self.doc.cheque_date)))
+      else :
+        msgprint("Please enter cheque date")
+        raise Exception
+    
+    for d in getlist(self.doclist, 'entries'):
+      if d.against_invoice and d.credit:
+        currency = sql("select currency from `tabReceivable Voucher` where name = '%s'" % d.against_invoice)
+        currency = currency and currency[0][0] or ''
+        r.append('%s %s against Invoice: %s' % (cstr(currency), fmt_money(flt(d.credit)), d.against_invoice))
+      if d.against_voucher and d.debit:
+        bill_no = sql("select bill_no, bill_date, currency from `tabPayable Voucher` where name=%s", d.against_voucher)
+        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)
+
+    if r:
+      self.doc.remark = ("\n").join(r)
+  
+  # --------------------------------------------------------------------------------------------------------
+  # Check user role for approval process
+  # --------------------------------------------------------------------------------------------------------
+  def get_authorized_user(self):
+    if self.is_approving_authority==-1:
+      self.is_approving_authority = 0
+
+      # Fetch credit controller role
+      approving_authority = sql("select value from `tabSingles` where field='credit_controller' and doctype='Manage Account'")
+      approving_authority = approving_authority and approving_authority[0][0] or ''
+	    
+      # Check logged-in user is authorized
+      if approving_authority in webnotes.user.get_roles():
+        self.is_approving_authority = 1
+	      
+	return self.is_approving_authority
+      
+  # get master type
+  # ---------------
+  def get_master_type(self, ac):
+    if not self.master_type.get(ac):
+      self.master_type[ac] = sql("select master_type from `tabAccount` where name=%s", ac)[0][0] or 'None'
+    return self.master_type[ac]
+  
+  # get credit days for
+  # -------------------
+  def get_credit_days_for(self, ac):
+
+    if not self.credit_days_for.has_key(ac):
+      self.credit_days_for[ac] = sql("select credit_days from `tabAccount` where name='%s'" % ac)[0][0] or 0
+
+    if not self.credit_days_for[ac]:
+      if self.credit_days_global==-1:
+        self.credit_days_global = sql("select credit_days from `tabCompany` where name='%s'" % self.doc.company)[0][0] or 0
+      return self.credit_days_global
+    else:
+      return self.credit_days_for[ac]
+  
+  
+  # --------------------------------------------------------------------------------------------------------
+  # Check Credit Days - Cheque Date can not after (Posting date + Credit Days)
+  # --------------------------------------------------------------------------------------------------------
+  def check_credit_days(self):
+    date_diff = 0
+    if self.doc.cheque_date:
+      date_diff = (getdate(self.doc.cheque_date)-getdate(self.doc.posting_date)).days
+    
+    if date_diff <= 0: return
+    
+    # Get List of Customer Account
+    acc_list = filter(lambda d: self.get_master_type(d.account)=='Customer', getlist(self.doclist,'entries'))
+    
+    for d in acc_list:
+      credit_days = self.get_credit_days_for(d.account)
+      
+      # Check credit days
+      if credit_days > 0 and not self.get_authorized_user() and cint(date_diff) > credit_days:
+        msgprint("Credit Not Allowed: Cannot allow a check that is dated more than %s days after the posting date" % credit_days)
+        raise Exception
+          
+  #--------------------------------------------------------------------------------------------------------
+  # validation of debit/credit account with Debit To Account(RV) or Credit To Account (PV)
+  #--------------------------------------------------------------------------------------------------------
+  def check_account_against_entries(self):
+    for d in getlist(self.doclist,'entries'):
+      if d.against_invoice:
+        acc=sql("select debit_to from `tabReceivable Voucher` where name='%s'"%d.against_invoice)
+        if acc and acc[0][0] != d.account:
+          msgprint("Debit account is not matching with receivable voucher")
+          raise Exception
+      
+      if d.against_voucher:
+        acc=sql("select credit_to from `tabPayable Voucher` where name='%s'"%d.against_voucher)
+        if acc and acc[0][0] != d.account:
+          msgprint("Credit account is not matching with payable voucher")
+          raise Exception
+          
+  #--------------------------------------------------------------------------------------------------------
+  # Validate Cheque Info: Mandatory for Bank/Contra voucher
+  #--------------------------------------------------------------------------------------------------------  
+  def validate_cheque_info(self):
+    if self.doc.voucher_type in ['Bank Voucher']:
+      if not self.doc.cheque_no or not self.doc.cheque_date:
+        msgprint("Cheque No & Cheque Date is required for " + cstr(self.doc.voucher_type))
+        raise Exception
+        
+    if self.doc.cheque_date and not self.doc.cheque_no:
+      msgprint("Cheque No is mandatory if you entered Cheque Date")
+      raise Exception
+      
+  #--------------------------------------------------------------------------------------------------------
+  # Gives reminder for making is_advance = 'Yes' in Advance Entry
+  #--------------------------------------------------------------------------------------------------------
+  def validate_entries_for_advance(self):
+    for d in getlist(self.doclist,'entries'):
+      if not d.is_advance and not d.against_voucher and not d.against_invoice and d.against_jv:
+        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)
+      
+  #--------------------------------------------------------------------------------------------------------
+  # TDS: Validate tds related fields
+  #--------------------------------------------------------------------------------------------------------
+  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
+    
+    
+
+  #--------------------------------------------------------------------------------------------------------
+  # If TDS applicable , TDS category and supplier account should be mandatory
+  #--------------------------------------------------------------------------------------------------------
+  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
+    
+
+  #--------------------------------------------------------------------------------------------------------
+  # If TDS is not applicable , all related fields should blank
+  #--------------------------------------------------------------------------------------------------------
+  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 = ''
+    
+  #--------------------------------------------------------------------------------------------------------
+  # Get TDS amount
+  #--------------------------------------------------------------------------------------------------------
+  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)
+
+        
+  #--------------------------------------------------------------------------------------------------------
+  # Insert new row to balance total debit and total credit
+  #--------------------------------------------------------------------------------------------------------
+  def get_balance(self):
+    if not getlist(self.doclist,'entries'):
+      msgprint("Please enter atleast 1 entry in 'GL Entries' table")
+    else:
+      flag, self.doc.total_debit, self.doc.total_credit = 0,0,0
+      diff = flt(self.doc.difference)
+      
+      # If any row without amount, set the diff on that row
+      for d in getlist(self.doclist,'entries'):
+        if (d.credit==0 or d.credit is None) and (d.debit==0 or d.debit is None) and (flt(diff) != 0):
+          if diff>0:
+            d.credit = flt(diff)
+          elif diff<0:
+            d.debit = flt(diff)
+          flag = 1
+          
+      # Set the diff in a new row
+      if flag == 0 and (flt(diff) != 0):
+        jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
+        if diff>0:
+          jd.credit = flt(diff)
+        elif diff<0:
+          jd.debit = flt(diff)
+          
+      # Set the total debit, total credit and difference
+      for d in getlist(self.doclist,'entries'):
+        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)
+      
+  #--------------------------------------------------------------------------------------------------------
+  # Set against account
+  #--------------------------------------------------------------------------------------------------------
+  def get_against_account(self):
+    # Debit = Credit
+    debit, credit = 0.0, 0.0
+    debit_list, credit_list = [], []
+    for d in getlist(self.doclist, 'entries'):
+      debit += flt(d.debit)
+      credit += flt(d.credit)
+      if flt(d.debit)>0 and (d.account not in debit_list): debit_list.append(d.account)
+      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
+
+    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))
+      raise Exception
+    
+    # update against account
+    for d in getlist(self.doclist, 'entries'):
+      if flt(d.debit) > 0: d.against_account = ', '.join(credit_list)
+      if flt(d.credit) > 0: d.against_account = ', '.join(debit_list)
+
+
+  # set aging date
+  #---------------
+  def set_aging_date(self):
+    if self.doc.is_opening != 'Yes':
+      self.doc.aging_date = self.doc.posting_date
+    else:
+      # check account type whether supplier or customer
+      exists = ''
+      for d in getlist(self.doclist, 'entries'):
+        exists = sql("select name from tabAccount where account_type in ('Supplier', 'Customer') and name = '%s'" % d.account)
+        if exists:
+          break
+
+      # If cus/supp aging dt is mandatory
+      if exists and not self.doc.aging_date: 
+        msgprint("Aging Date is mandatory for opening entry")
+        raise Exception
+      # otherwise aging dt = posting dt
+      else:
+        self.doc.aging_date = self.doc.posting_date
+
+  # ------------------------
+  # set print format fields
+  # ------------------------
+  def set_print_format_fields(self):
+    for d in getlist(self.doclist, 'entries'):
+      chk_type = sql("select master_type, account_type from `tabAccount` where name='%s'" % d.account)
+      master_type, acc_type = chk_type and cstr(chk_type[0][0]) or '', chk_type and cstr(chk_type[0][1]) or ''
+      if master_type in ['Supplier', 'Customer']:
+        if not self.doc.pay_to_recd_from:
+          self.doc.pay_to_recd_from = get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
+      
+      if acc_type == 'Bank or Cash':
+        amt = cint(d.debit) and d.debit or d.credit
+        self.doc.total_amount = get_defaults()['currency']+'. '+ cstr(amt)
+        self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], cstr(amt))
+
+
+  # --------------------------------
+  # get outstanding invoices values
+  # --------------------------------
+  def get_values(self):
+    cond = (flt(self.doc.write_off_amount) > 0) and ' and outstanding_amount <= '+self.doc.write_off_amount or ''
+    if self.doc.write_off_based_on == 'Accounts Receivable':
+      return sql("select name, debit_to, outstanding_amount from `tabReceivable Voucher` where docstatus = 1 and company = '%s' and outstanding_amount > 0 %s" % (self.doc.company, cond))
+    elif self.doc.write_off_based_on == 'Accounts Payable':
+      return sql("select name, credit_to, outstanding_amount from `tabPayable Voucher` where docstatus = 1 and company = '%s' and outstanding_amount > 0 %s" % (self.doc.company, cond))
+
+
+  # -------------------------
+  # get outstanding invoices
+  # -------------------------
+  def get_outstanding_invoices(self):
+    self.doc.clear_table(self.doclist, 'entries')
+    total = 0
+    for d in self.get_values():
+      total += flt(d[2])
+      jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
+      jd.account = cstr(d[1])
+      if self.doc.write_off_based_on == 'Accounts Receivable':
+        jd.credit = flt(d[2])
+        jd.against_invoice = cstr(d[0])
+      elif self.doc.write_off_based_on == 'Accounts Payable':
+        jd.debit = flt(d[2])
+        jd.against_voucher = cstr(d[0])
+      jd.save(1)
+    jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
+    if self.doc.write_off_based_on == 'Accounts Receivable':
+      jd.debit = total
+    elif self.doc.write_off_based_on == 'Accounts Payable':
+      jd.credit = total
+    jd.save(1)
+
+
+  #--------------------------------------------------------------------------------------------------------
+  # VALIDATE
+  #--------------------------------------------------------------------------------------------------------
+  def validate(self):
+    if not self.doc.is_opening:
+      self.doc.is_opening='No'
+    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()
+    
+    self.validate_against_jv()
+    self.set_print_format_fields()
+
+    #FY and Date validation
+    get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+
+  #--------------------------------------------------------------------------------------------------------
+  # On Update - Update Feed
+  #--------------------------------------------------------------------------------------------------------
+  def on_update(self):
+    pass
+        
+  #--------------------------------------------------------------------------------------------------------
+  # On submit
+  #--------------------------------------------------------------------------------------------------------
+  def on_submit(self):
+    if self.doc.voucher_type in ['Bank Voucher', 'Contra Voucher', 'Journal Entry']:
+      self.check_credit_days()
+    self.check_account_against_entries()
+    get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist)
+
+
+  # validate against jv no
+  def validate_against_jv(self):
+    for d in getlist(self.doclist, 'entries'):
+      if d.against_jv:
+        if d.against_jv == self.doc.name:
+          msgprint("You can not enter current voucher in 'Against JV' column")
+          raise Exception
+        elif not sql("select name from `tabJournal Voucher Detail` where account = '%s' and docstatus = 1 and parent = '%s'" % (d.account, d.against_jv)):
+          msgprint("Against JV: "+ d.against_jv + " is not valid. Please check")
+          raise Exception
+          
+  #--------------------------------------------------------------------------------------------------------
+  # On cancel reverse gl entry
+  #--------------------------------------------------------------------------------------------------------
+  def on_cancel(self):
+    self.check_tds_payment_voucher()
+    get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)
+
+  # 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
diff --git a/accounts/doctype/journal_voucher/journal_voucher.txt b/accounts/doctype/journal_voucher/journal_voucher.txt
new file mode 100644
index 0000000..b0aaaab
--- /dev/null
+++ b/accounts/doctype/journal_voucher/journal_voucher.txt
@@ -0,0 +1,2022 @@
+[
+	{
+		'_last_update': '1303273485',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-06 14:41:47',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Journal Voucher',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'voucher_type,posting_date, due_date, cheque_no',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': ' ',
+		'tag_fields': 'voucher_type',
+		'use_template': None,
+		'version': 307
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:06',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:06',
+		'modified_by': 'Administrator',
+		'name': 'PERM00294',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:06',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:06',
+		'modified_by': 'Administrator',
+		'name': 'PERM00295',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:06',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:06',
+		'modified_by': 'Administrator',
+		'name': 'PERM00296',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:06',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:06',
+		'modified_by': 'Administrator',
+		'name': 'PERM00297',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000488',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': '1. Select Series and Dates',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000489',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000490',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Voucher Type',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01689',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'voucher_type',
+		'oldfieldtype': 'Select',
+		'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-06 18:06:12',
+		'default': None,
+		'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'write_off_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Write Off Amount <=',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': '000000475',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-06 18:06:12',
+		'default': 'Accounts Receivable',
+		'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'write_off_based_on',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Write Off Based On',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': '000000476',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Accounts Receivable\nAccounts Payable',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': 'JV',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01690',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'JV',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Voucher Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01691',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'voucher_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01692',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'due_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Due Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01693',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'due_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01694',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01695',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Link',
+		'options': 'Journal Voucher',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-06 18:06:12',
+		'default': None,
+		'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Get Outstanding Invoices',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': '000000477',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'get_outstanding_invoices',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Server',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000491',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cheque_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Cheque No',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01697',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cheque_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cheque_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Cheque Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01698',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cheque_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'clearance_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Clearance Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01699',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'clearance_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'user_remark',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'User Remark',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01700',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'user_remark',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': 'User Remark will be added to Auto Remark',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remark',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Remark',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01701',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remark',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': '2. Add / Edit GL Entries',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000492',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'entries',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Entries',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01703',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'entries',
+		'oldfieldtype': 'Table',
+		'options': 'Journal Voucher Detail',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Get Balance',
+		'modified': '2011-03-31 15:34:24',
+		'modified_by': 'Administrator',
+		'name': 'FL01704',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Get Balance',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': '000000480',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_debit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Total Debit',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01705',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_debit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_credit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Total Credit',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01706',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_credit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'difference',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Difference',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01707',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'difference',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Addtional Info',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000493',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000494',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bill_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Bill No',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01710',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bill_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bill_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Bill Date',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01711',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bill_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_opening',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': 1,
+		'label': 'Is Opening',
+		'modified': '2011-04-06 18:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01712',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_opening',
+		'oldfieldtype': 'Select',
+		'options': 'No\nYes',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'aging_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Aging Date',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01713',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'aging_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01714',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-31 15:34:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pay_to_recd_from',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Pay To / Recd From',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000326',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-31 15:34:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_amount',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Total Amount',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000327',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-31 15:34:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_amount_in_words',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Total Amount in Words',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000328',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000495',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01716',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01717',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01718',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000496',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'View Ledger Entry',
+		'modified': '2011-03-31 15:34:24',
+		'modified_by': 'Administrator',
+		'name': 'FL01720',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'View Ledger Entry',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000485',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'TDS',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000497',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_applicable',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': 1,
+		'label': 'TDS Applicable',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01722',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'tds_applicable',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_category',
+		'fieldtype': 'Select',
+		'hidden': 0,
+		'icon': None,
+		'idx': 44,
+		'in_filter': 1,
+		'label': 'TDS Category',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01723',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'tds_category',
+		'oldfieldtype': 'Select',
+		'options': 'link:TDS Category',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_account',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Supplier Account',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01724',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'supplier_account',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Get TDS',
+		'modified': '2011-03-31 15:34:24',
+		'modified_by': 'Administrator',
+		'name': 'FL01725',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-06 18:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Get TDS',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000487',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': 'Tax Code will be populated based on account head mentioned in TDS Category master',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tax_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'TDS Account Head',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01726',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'tax_code',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01727',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ded_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-04-06 18:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL01728',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'ded_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Journal Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher_detail/__init__.py b/accounts/doctype/journal_voucher_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/journal_voucher_detail/__init__.py
diff --git a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
new file mode 100644
index 0000000..8ce8574
--- /dev/null
+++ b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:21', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'JVD.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Journal Voucher Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-10-01 16:24:51', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'account', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Account', 'width': '180px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00396', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'cost_center', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cost Center', 'width': '180px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00397', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'cost_center', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'balance', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Balance', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00398', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'balance', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'debit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Debit', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00399', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'debit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'credit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Credit', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00400', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'credit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'against_voucher', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Against Payable', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00401', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'against_voucher', 'fieldtype': 'Link', 'options': 'Payable Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:21', 'doctype': 'DocField', 'oldfieldname': 'against_invoice', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Against Receivable', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00402', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'against_invoice', 'fieldtype': 'Link', 'options': 'Receivable Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2010-10-01 16:24:37', 'doctype': 'DocField', 'oldfieldname': 'against_jv', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Against JV', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06160', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'against_jv', 'fieldtype': 'Link', 'options': 'Journal Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2009-07-22 13:05:33', 'doctype': 'DocField', 'oldfieldname': 'is_advance', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Is Advance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02621', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'is_advance', 'fieldtype': 'Select', 'options': 'No\nYes', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Text', 'creation': '2009-04-04 12:03:17', 'doctype': 'DocField', 'oldfieldname': 'against_account', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Against Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Journal Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01630', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-10-01 16:24:51', 'parenttype': 'DocType', 'fieldname': 'against_account', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/ledger_balance_export/__init__.py b/accounts/doctype/ledger_balance_export/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/ledger_balance_export/__init__.py
diff --git a/accounts/doctype/ledger_balance_export/ledger_balance_export.comp.js b/accounts/doctype/ledger_balance_export/ledger_balance_export.comp.js
new file mode 100644
index 0000000..73f48b5
--- /dev/null
+++ b/accounts/doctype/ledger_balance_export/ledger_balance_export.comp.js
@@ -0,0 +1,2 @@
+
+cur_frm.cscript['Export Report']=function(doc,cdt,cdn){$c_obj_csv(make_doclist(cdt,cdn),'get_report_data','');}
\ No newline at end of file
diff --git a/accounts/doctype/ledger_balance_export/ledger_balance_export.js b/accounts/doctype/ledger_balance_export/ledger_balance_export.js
new file mode 100755
index 0000000..0095b03
--- /dev/null
+++ b/accounts/doctype/ledger_balance_export/ledger_balance_export.js
@@ -0,0 +1,3 @@
+cur_frm.cscript['Export Report'] = function(doc, cdt, cdn) {
+	$c_obj_csv(make_doclist(cdt, cdn), 'get_report_data', '');
+}
diff --git a/accounts/doctype/ledger_balance_export/ledger_balance_export.py b/accounts/doctype/ledger_balance_export/ledger_balance_export.py
new file mode 100755
index 0000000..d6cfc7b
--- /dev/null
+++ b/accounts/doctype/ledger_balance_export/ledger_balance_export.py
@@ -0,0 +1,63 @@
+import webnotes
+from webnotes.utils import add_days, cint, cstr, flt, getdate
+from webnotes.model.doclist import getlist
+from webnotes.model.code import get_obj
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+
+#---------------------------------------------------------------------
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+	# Get fiscal year based on date
+	def get_year(self, dt):
+		yr = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",dt)
+		return yr and yr[0][0] or ''
+
+	# Get gl entries for the period and account
+	def get_gl_entries(self, lft, rgt):
+		gle = sql("select t1.posting_date, t1.voucher_type, t1.voucher_no, t1.debit, t1.credit, t1.remarks from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s and ifnull(t1.is_opening, 'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_cancelled, 'No') = 'No'", (self.doc.from_date, self.doc.to_date, lft, rgt), as_dict=1)
+		entries, dr, cr = [], 0, 0
+		for d in gle:
+			dr, cr = dr + flt(d['debit']), cr + flt(d['credit'])
+			entries.append(['', d['posting_date'], d['voucher_type'], d['voucher_no'], d['debit'], d['credit'], d['remarks']])
+		return entries, dr, cr
+
+	# Get Report Data
+	def get_report_data(self):
+		from_date_year = self.get_year(add_days(self.doc.from_date, -1))
+		to_date_year = self.get_year(self.doc.to_date)
+
+		# result initiatlization
+		header = 'Ledger Balances Between ' + getdate(self.doc.from_date).strftime('%d-%m-%Y') + ' and ' + getdate(self.doc.to_date).strftime('%d-%m-%Y')
+		res = [[header], ['Account', 'Posting Date', 'Voucher Type', 'Voucher No', 'Debit', 'Credit', 'Remarks']]
+		glc = get_obj('GL Control')	
+
+		for d in getlist(self.doclist, 'ledger_details'):
+			# Fetch acc details
+			acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt from tabAccount where name = '%s'" % d.account, as_dict=1)[0]
+
+			# Opening
+			opening = glc.get_as_on_balance(d.account, from_date_year, add_days(self.doc.from_date, -1), acc_det['debit_or_credit'], acc_det['lft'], acc_det['rgt'])[2]
+			if acc_det['debit_or_credit'] == 'Credit':
+				opening = -1*opening
+
+			# GL Entries
+			gle, debit, credit = self.get_gl_entries(acc_det['lft'], acc_det['rgt'])
+
+			# Closing
+			closing = opening + debit - credit
+
+			# Append to result
+			res.append([d.account])
+			res += gle
+			res.append(['', '', '', 'Total Debit/Credit', debit, credit])
+			res.append(['', '', '', 'Opening Balance', opening])
+			res.append(['', '', '', 'Closing Balance', closing])
+			
+		return res
diff --git a/accounts/doctype/ledger_balance_export/ledger_balance_export.txt b/accounts/doctype/ledger_balance_export/ledger_balance_export.txt
new file mode 100755
index 0000000..b3998b4
--- /dev/null
+++ b/accounts/doctype/ledger_balance_export/ledger_balance_export.txt
@@ -0,0 +1,321 @@
+[
+	{
+		'_last_update': '1306229235',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 10:54:06',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Other',
+		'dt_template': None,
+		'hide_heading': 0,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-24 15:22:43',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Ledger Balance Export',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 9
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-05-25 10:54:06',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'PERM00866',
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-05-25 10:54:06',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'PERM00867',
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 11:02:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Select Date Range',
+		'modified': '2011-05-25 11:02:00',
+		'modified_by': 'Administrator',
+		'name': 'FL05003',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 10:54:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'From Date',
+		'modified': '2011-05-25 11:02:00',
+		'modified_by': 'Administrator',
+		'name': 'FL04997',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 10:54:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'To Date',
+		'modified': '2011-05-25 11:02:00',
+		'modified_by': 'Administrator',
+		'name': 'FL04998',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 11:02:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Select ledgers',
+		'modified': '2011-05-25 11:02:00',
+		'modified_by': 'Administrator',
+		'name': 'FL05004',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 10:54:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ledger_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Ledger Details',
+		'modified': '2011-05-25 11:02:00',
+		'modified_by': 'Administrator',
+		'name': 'FL05000',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Ledger Detail',
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 10:54:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Export Report',
+		'modified': '2011-05-25 11:02:00',
+		'modified_by': 'Administrator',
+		'name': 'FL05001',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ledger Balance Export',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/ledger_detail/__init__.py b/accounts/doctype/ledger_detail/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/ledger_detail/__init__.py
diff --git a/accounts/doctype/ledger_detail/ledger_detail.txt b/accounts/doctype/ledger_detail/ledger_detail.txt
new file mode 100755
index 0000000..a9afe96
--- /dev/null
+++ b/accounts/doctype/ledger_detail/ledger_detail.txt
@@ -0,0 +1,95 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 10:54:06',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-24 15:24:03',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Ledger Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 3
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 10:54:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Account',
+		'modified': '2011-05-25 10:54:06',
+		'modified_by': 'Administrator',
+		'name': 'FL05002',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Ledger Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/mode_of_payment/__init__.py b/accounts/doctype/mode_of_payment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/mode_of_payment/__init__.py
diff --git a/accounts/doctype/mode_of_payment/mode_of_payment.js b/accounts/doctype/mode_of_payment/mode_of_payment.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/accounts/doctype/mode_of_payment/mode_of_payment.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/accounts/doctype/mode_of_payment/mode_of_payment.txt b/accounts/doctype/mode_of_payment/mode_of_payment.txt
new file mode 100644
index 0000000..2aeef29
--- /dev/null
+++ b/accounts/doctype/mode_of_payment/mode_of_payment.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-04 12:05:50', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:mode_of_payment', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Mode of Payment', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00997', 'parent': 'Mode of Payment', 'read': 1, 'create': 1, 'creation': '2010-05-04 12:05:50', 'modified': '2010-09-20 09:51:10', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-04 12:05:50', 'doctype': 'DocField', 'oldfieldname': 'mode_of_payment', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Mode of Payment', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mode of Payment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04973', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:10', 'parenttype': 'DocType', 'fieldname': 'mode_of_payment', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/payable_voucher/__init__.py b/accounts/doctype/payable_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/payable_voucher/__init__.py
diff --git a/accounts/doctype/payable_voucher/payable_voucher.js b/accounts/doctype/payable_voucher/payable_voucher.js
new file mode 100644
index 0000000..4a566d3
--- /dev/null
+++ b/accounts/doctype/payable_voucher/payable_voucher.js
@@ -0,0 +1,450 @@
+cur_frm.cscript.tname = "PV Detail";
+cur_frm.cscript.fname = "entries";
+cur_frm.cscript.other_fname = "purchase_tax_details";
+$import(Purchase Other Charges)
+$import(Purchase Common)
+
+// On Load
+// --------
+cur_frm.cscript.onload = function(doc,dt,dn) {
+  var cp = locals['Control Panel']['Control Panel'];
+  
+  if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
+  if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});  
+
+  if(cp.country == 'India') {
+    unhide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
+  }
+  else {
+    hide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
+  }  
+  
+  if(doc.__islocal){
+    if(doc.supplier) {cur_frm.cscript.supplier(doc,dt,dn)}
+    hide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
+  }
+  
+
+  if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);  
+}
+
+// Refresh
+// --------
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+  
+  cur_frm.clear_custom_buttons();
+
+  // Show / Hide button
+  if(doc.docstatus==1 && doc.outstanding_amount > 0)
+    cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript['Make Bank Voucher']);
+  
+  if(doc.docstatus==1) { 
+    unhide_field(['Repair Outstanding Amt']); 
+    cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
+  } else hide_field(['Repair Outstanding Amt']);
+  
+  cur_frm.cscript.is_opening(doc, dt, dn);
+}
+
+
+//Supplier
+cur_frm.cscript.supplier = function(doc,dt,dn) {
+
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];    
+      get_server_fields('get_credit_to','','',doc, dt, dn, 0, callback2);
+  }
+  
+  var callback2 = function(r,rt){
+    var doc = locals[cur_frm.doctype][cur_frm.docname];    
+    var el = getchildren('PV Detail',doc.name,'entries');
+    for(var i in el){
+      if(el[i].item_code && (!el[i].expense_head || !el[i].cost_center)){
+        args = "{'item_code':'" + el[i].item_code + "','expense_head':'" + el[i].expense_head + "','cost_center':'" + el[i].cost_center + "'}";
+        get_server_fields('get_default_values', args, 'entries', doc, el[i].doctype, el[i].name, 1);
+      }
+    }
+    cur_frm.cscript.calc_total(doc);
+  }
+
+  if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1,callback);
+  if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
+}
+
+cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
+  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'].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';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  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';
+}
+
+
+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;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
+  locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
+}
+
+
+cur_frm.cscript.credit_to = function(doc,dt,dn) {
+
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];    
+      if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
+      if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
+      cur_frm.refresh();
+  }
+
+  get_server_fields('get_cust','','',doc,dt,dn,1,callback);  
+}
+
+
+
+// Get Print Heading
+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';
+}
+
+
+//Set expense_head and cost center on adding new row
+//----------------------------------------------
+cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
+  
+  cl = getchildren('PV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
+  acc = '';
+  cc = '';
+
+  for(var i = 0; i<cl.length; i++) {
+    if (cl[i].idx == 1){
+      acc = cl[i].expense_head;
+      cc = cl[i].cost_center;
+    }
+    else{
+      if (! cl[i].expense_head) { cl[i].expense_head = acc; refresh_field('expense_head', cl[i].name, 'entries');}
+      if (! cl[i].cost_center)  {cl[i].cost_center = cc; refresh_field('cost_center', cl[i].name, 'entries');}
+    }
+  }
+}
+
+cur_frm.cscript.is_opening = function(doc, dt, dn) {
+  hide_field('aging_date');
+  if (doc.is_opening == 'Yes') unhide_field('aging_date');
+}
+
+/* ******************************** TRIGGERS **************************************** */
+/*
+// Supplier
+// ---------
+cur_frm.cscript.supplier = function(doc,cdt,cdn){
+  get_server_fields('get_credit_to','','',doc,cdt,cdn);
+}
+*/
+
+// Conversion Rate
+// ----------------
+cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) {
+  cur_frm.cscript.calc_total(doc,cdt,cdn);
+}
+
+// Recalculate Button
+// -------------------
+cur_frm.cscript['Recalculate'] = function(doc, dt, dn) {
+  cur_frm.cscript.calc_total(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','supplier_name','address_display','contact_display','contact_mobile','contact_email']);			  
+	  refresh_many(['credit_to','supplier','supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email','entries','purchase_receipt_main','purchase_order_main']);
+  }
+  get_server_fields('pull_details','','',doc, dt, dn,1,callback);
+}
+
+
+// ========== PV Details Table ============
+
+// Item Code
+// ----------
+cur_frm.cscript.item_code = function(doc,cdt,cdn){
+  var d = locals[cdt][cdn];
+  if(d.item_code){
+    get_server_fields('get_item_details',d.item_code,'entries',doc,cdt,cdn,1);
+  }
+}
+
+// Quantity
+// ---------
+cur_frm.cscript.qty  = function(doc,dt,dn) { cur_frm.cscript.calc_exp_row(doc,dt,dn); }
+
+// Import Rate
+// ------------
+cur_frm.cscript.import_rate = function(doc,dt,dn) {
+  var d = locals[dt][dn];
+  set_multiple('PV Detail', d.name, {'rate': flt(d.import_rate) * flt(doc.conversion_rate) }, 'entries');
+  cur_frm.cscript.calc_exp_row(doc,dt,dn)
+}
+
+
+// ============== TDS ===============
+
+// 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 Tax Detail') cur_frm.cscript.calc_exp_row(doc,dt,dn); 
+}
+
+// Amount
+// -------
+cur_frm.cscript.ded_amount = function(doc,dt,dn) { cur_frm.cscript.calc_total(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('Advance Allocation Detail',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');
+  
+  calc_total_advance(doc, cdt, cdn);
+}
+
+
+// Make Journal Voucher
+// --------------------
+cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
+  cur_frm.cscript.make_jv(cur_frm.doc);
+}
+
+
+/* ***************************** GET QUERY Functions *************************** */
+
+// 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.%(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'
+  } else {
+    return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 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'
+  }
+}
+
+// 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'
+  } else {
+    return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 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'
+  }
+}
+
+// ================== PV Details 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" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
+}
+cur_frm.cscript.expense_head = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  if(d.idx == 1 && d.expense_head){
+    var cl = getchildren('PV Detail', doc.name, 'entries', doc.doctype);
+    for(var i = 0; i < cl.length; i++){
+      if(!cl[i].expense_head) cl[i].expense_head = d.expense_head;
+    }
+  }
+  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';
+}
+
+cur_frm.cscript.cost_center = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  if(d.idx == 1 && d.cost_center){
+    var cl = getchildren('PV Detail', doc.name, 'entries', doc.doctype);
+    for(var i = 0; i < cl.length; i++){
+      if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
+    }
+  }
+  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
+// ---------
+cur_frm.cscript.calc_total = function(doc) {
+  
+   // expense
+  var t_exp = 0.0;
+  var el = getchildren('PV Detail',doc.name,'entries');
+  for(var i in el) {
+   if (flt(el[i].import_rate) > 0){
+     set_multiple('PV Detail', el[i].name, {'rate': flt(doc.conversion_rate) * flt(el[i].import_rate) }, 'entries');
+     set_multiple('PV Detail', el[i].name, {'import_amount': flt(el[i].qty) * flt(el[i].import_rate) }, 'entries');
+   }
+   set_multiple('PV Detail', el[i].name, {'amount': flt(el[i].qty) * flt(el[i].rate) }, 'entries')
+   t_exp += flt(el[i].amount);
+  }
+  doc.net_total = flt(t_exp);
+  refresh_field('net_total');
+  cur_frm.cscript.val_cal_charges(doc, cdt, cdn, cur_frm.cscript.tname, cur_frm.cscript.fname, cur_frm.cscript.other_fname);
+}
+
+
+// Calculate Advance
+// ------------------
+var calc_total_advance = function(doc,cdt,cdn) {
+  var doc = locals[doc.doctype][doc.name];
+  var el = getchildren('Advance Allocation Detail',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);
+  doc.tds_amount_on_advance = flt(tot_tds);
+  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']);
+}
+
+
+cur_frm.cscript.calc_exp_row = function(doc,dt,dn) {
+  var d = locals[dt][dn];
+  d.amount = flt(d.qty * d.rate);
+  refresh_field('amount',dn,'entries');
+  
+  if (!doc.conversion_rate){ doc.conversion_rate = 1; refresh_field('conversion_rate'); }
+  
+  set_multiple('PV Detail', dn, {'import_rate': flt(d.rate) / flt(doc.conversion_rate) }, 'entries');
+  set_multiple('PV Detail', dn, {'import_amount': flt(d.qty) * flt(d.rate) / flt(doc.conversion_rate) }, 'entries');
+  
+  cur_frm.cscript.calc_total(doc)
+}
+
+
+// Make JV
+// --------
+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_series = det.def_bv_series;
+  //jv.voucher_date = doc.voucher_date;
+  //jv.posting_date = doc.posting_date;
+  jv.remark = repl('Payment against voucher %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
+  jv.total_debit = doc.outstanding_amount;
+  jv.total_credit = doc.outstanding_amount;
+  jv.fiscal_year = doc.fiscal_year;
+  jv.company = doc.company;
+  
+  // debit to creditor
+  var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+  d1.account = doc.credit_to;
+  d1.debit = doc.outstanding_amount;
+  //d1.balance = det.acc_balance;
+  d1.against_voucher = doc.name;
+  
+  // credit to bank
+  var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+  //d1.account = det.def_bank_account;
+  //d1.balance = det.bank_balance;
+  d1.credit = doc.outstanding_amount;
+  
+  loaddoc('Journal Voucher', jv.name);
+}
+
+// ***************** Get project name *****************
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+
+cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
+  if(doc.select_print_heading){
+    // print heading
+    cur_frm.pformat.print_heading = doc.select_print_heading;
+  }
+  else
+    cur_frm.pformat.print_heading = "Purchase Invoice";
+}
+
+/* *********************** Client Side Validation **************************** */
+// Validate
+// ---------
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+  is_item_table(doc,cdt,cdn);
+  cur_frm.cscript.calc_total(doc, cdt, cdn);
+  calc_total_advance(doc, cdt, cdn);
+}
+
+/****************** Get Accounting Entry *****************/
+cur_frm.cscript['View Ledger Entry'] = function(){
+  var callback = function(report){
+    report.set_filter('GL Entry', 'Voucher No',cur_frm.doc.name);
+    report.dt.run();
+  }
+  loadreport('GL Entry','General Ledger', callback);
+}
diff --git a/accounts/doctype/payable_voucher/payable_voucher.py b/accounts/doctype/payable_voucher/payable_voucher.py
new file mode 100644
index 0000000..4559de2
--- /dev/null
+++ b/accounts/doctype/payable_voucher/payable_voucher.py
@@ -0,0 +1,507 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl 
+    self.tname = 'PV Detail'
+    self.fname = 'entries'
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.####')
+
+
+# ************************** Trigger Functions ****************************
+
+  # Credit To
+  # ----------
+  def get_credit_to(self):
+    acc_head = sql("select name, credit_days from `tabAccount` where name = %s", (cstr(self.doc.supplier) + " - " + self.get_company_abbr()))    
+    #supp_detail = sql("select supplier_name,address from `tabSupplier` where name = %s", self.doc.supplier, as_dict =1)
+    #ret = {
+    #  'supplier_name' : supp_detail and supp_detail[0]['supplier_name'] or '',
+    #  'supplier_address': supp_detail and supp_detail[0]['address'] or ''
+    #}
+    ret = {}
+    if acc_head and acc_head[0][0]:
+      ret['credit_to'] = acc_head[0][0]
+      if not self.doc.due_date:
+        ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
+    elif not acc_head:
+      msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
+    return cstr(ret)
+    
+  def get_cust(self):
+    ret = {}
+    if self.doc.credit_to:      
+      ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
+      
+    return cstr(ret)  
+
+
+  # Get Default Cost Center and Expense Head from Item Master
+  # ----------------------------------------------------------
+  def get_default_values(self,args):
+    args = eval(args)
+    ret = {}
+    if sql("select name from `tabItem` where name = '%s'" % args['item_code']):
+      if not args['expense_head'] or args['expense_head'] == 'undefined':
+        expense_head = sql("select name from `tabAccount` where account_name in (select purchase_account from `tabItem` where name = '%s')" % args['item_code'])
+        ret['expense_head'] = expense_head and expense_head[0][0] or ''
+      if not args['cost_center'] or args['cost_center'] == 'undefined':
+        cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
+        ret['cost_center'] = cost_center and cost_center[0][0] or ''
+    return cstr(ret)
+     
+  
+  # Get Items based on PO or PR
+  # ----------------------------
+  def pull_details(self):
+    if self.doc.purchase_receipt_main:
+      self.validate_duplicate_docname('purchase_receipt')
+      self.doclist = get_obj('DocType Mapper', 'Purchase Receipt-Payable Voucher').dt_map('Purchase Receipt', 'Payable Voucher', self.doc.purchase_receipt_main, self.doc, self.doclist, "[['Purchase Receipt', 'Payable Voucher'],['Purchase Receipt Detail', 'PV Detail']]")
+
+    elif self.doc.purchase_order_main:
+      self.validate_duplicate_docname('purchase_order')
+      self.doclist = get_obj('DocType Mapper', 'Purchase Order-Payable Voucher').dt_map('Purchase Order', 'Payable Voucher', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Payable Voucher'],['PO Detail', 'PV Detail']]")
+    
+    ret = eval(self.get_credit_to())
+    #self.doc.supplier_name = ret['supplier_name']
+    #self.doc.supplier_address = ret['supplier_address']
+    
+    #self.doc.cst_no =ret['cst_no']
+    #self.doc.bst_no = ret['bst_no']
+    #self.doc.vat_tin_no = ret['vat_tin_no']
+
+    if ret.has_key('credit_to'):
+      self.doc.credit_to = ret['credit_to']
+      
+
+  # Get Item Details
+  # -----------------    
+  def get_item_details(self,arg):
+    item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1)
+    tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
+    t = {}
+    for x in tax: t[x[0]] = flt(x[1])
+    ret = {
+      'item_name' : item_det and item_det[0]['item_name'] or '',
+      'brand' : item_det and item_det[0]['brand'] or '',
+      'description' : item_det and item_det[0]['description'] or '',
+      'item_group'  : item_det and item_det[0]['item_group'] or '',
+      'rate' : 0.00,
+      'qty' : 0.00,
+      'amount' : 0.00,
+      'expense_head' : item_det and item_det[0]['purchase_account'] or '',
+      'cost_center' : item_det and item_det[0]['cost_center'] or '',
+      'item_tax_rate'      : str(t)
+    }
+    return cstr(ret)
+    
+  # Advance Allocation
+  # -------------------
+  def get_advances(self):
+    get_obj('GL Control').get_advances( self, self.doc.credit_to, 'Advance Allocation Detail','advance_allocation_details','debit')
+    
+    
+  # ============= OTHER CHARGES ====================
+  
+  # Get Tax rate if account type is TAX
+  # ------------------------------------
+  def get_rate(self,arg):
+    return get_obj('Purchase Common').get_rate(arg,self)
+
+  # Pull details from other charges master (Get Other Charges)
+  # -----------------------------------------------------------
+  def get_purchase_tax_details(self):
+    return get_obj('Purchase Common').get_purchase_tax_details(self)
+
+
+  def get_rate1(self,acc):
+    rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
+    ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
+    return cstr(ret)
+  
+
+# *************************** Server Utility Functions *****************************
+  # Get Company abbr
+  # -----------------
+  def get_company_abbr(self):
+    return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+
+  # Check whether PO or PR is already fetched
+  # ------------------------------------------
+  def validate_duplicate_docname(self,doctype):
+    for d in getlist(self.doclist, 'entries'): 
+      if doctype == 'purchase_receipt' and cstr(self.doc.purchase_receipt_main) == cstr(d.purchase_receipt):
+        msgprint(cstr(self.doc.purchase_receipt_main) + " purchase receipt details have already been pulled.")
+        raise Exception , " Validation Error. "
+
+      if doctype == 'purchase_order' and cstr(self.doc.purchase_order_main) == cstr(d.purchase_order) and not d.purchase_receipt:
+        msgprint(cstr(self.doc.purchase_order_main) + " purchase order details have already been pulled.")
+        raise Exception , " Validation Error. "
+
+    
+# **************************** VALIDATE ********************************
+
+  # Check for Item.is_Purchase_item = 'Yes' and Item is active
+  # ------------------------------------------------------------------
+  def check_active_purchase_items(self):
+    for d in getlist(self.doclist, 'entries'):
+      if d.item_code:    # extra condn coz item_code is not mandatory in PV
+        valid_item = sql("select docstatus,is_purchase_item from tabItem where name = %s",d.item_code)
+        if valid_item[0][0] == 2:
+          msgprint("Item : '%s' is Inactive, you can restore it from Trash" %(d.item_code))
+          raise Exception
+        if not valid_item[0][1] == 'Yes':
+          msgprint("Item : '%s' is not Purchase Item"%(d.item_code))
+          raise Exception
+          
+  # Check Conversion Rate
+  # ----------------------
+  def check_conversion_rate(self):
+    default_currency = get_obj('Manage Account').doc.default_currency
+    if not default_currency:
+      msgprint('Message: Please enter default currency in Manage Account')
+      raise Exception
+    if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
+      msgprint("Message: Please Enter Appropriate Conversion Rate.")
+      raise Exception        
+
+  # 1. Check whether bill is already booked against this bill no. or not
+  # 2. Add Remarks
+  # ---------------------------------------------------------------------
+  def validate_bill_no(self):
+    if self.doc.bill_no and self.doc.bill_no.lower().strip()  not in ['na', 'not applicable', 'none']:
+      b_no = sql("select bill_no, name, ifnull(is_opening,'') from `tabPayable Voucher` where bill_no = '%s' and credit_to = '%s' and docstatus = 1 and name != '%s' " % (self.doc.bill_no, self.doc.credit_to, self.doc.name))
+      if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
+        msgprint("Please check you have already booked expense against Bill No. %s in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])))
+        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"
+          
+  # Validate Bill No Date
+  # ---------------------
+  def validate_bill_no_date(self):
+    if self.doc.bill_no and not self.doc.bill_date and self.doc.bill_no.lower().strip() not in ['na', 'not applicable', 'none']:
+      msgprint("Please enter Bill Date")
+      raise Exception          
+
+
+ 
+  # Clear Advances
+  # ---------------
+  def clear_advances(self):
+    get_obj('GL Control').clear_advances( self, 'Advance Allocation Detail','advance_allocation_details')
+
+
+  # 1. Credit To Account Exists
+  # 2. Is a Credit Account
+  # 3. Is not a PL Account
+  # ----------------------------
+  def validate_credit_acc(self):
+    acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s'" % self.doc.credit_to)
+    if not acc:
+      msgprint("Account: "+ self.doc.credit_to + "does not exist")
+      raise Exception
+    elif acc[0][0] and acc[0][0] != 'Credit':
+      msgprint("Account: "+ self.doc.credit_to + "is not a credit account")
+      raise Exception
+    elif acc[0][1] and acc[0][1] != 'No':
+      msgprint("Account: "+ self.doc.credit_to + "is a pl account")
+      raise Exception
+  
+  # Validate Acc Head of Supplier and Credit To Account entered
+  # ------------------------------------------------------------
+  def check_for_acc_head_of_supplier(self): 
+    acc_head = sql("select name from `tabAccount` where name = %s", (cstr(self.doc.supplier) + " - " + self.get_company_abbr()))
+    if self.doc.supplier:
+      if acc_head and acc_head[0][0]:
+        if not cstr(acc_head[0][0]) == cstr(self.doc.credit_to):
+          msgprint("Credit To: %s do not match with Supplier: %s for Company: %s i.e. %s" %(self.doc.credit_to,self.doc.supplier,self.doc.company,cstr(acc_head[0][0])))
+          raise Exception, "Validation Error "
+      if not acc_head:
+        msgprint("Supplier %s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
+        raise Exception, "Validation Error "
+        
+  # Check for Stopped PO
+  # ---------------------
+  def check_for_stopped_status(self):
+    check_list = []
+    for d in getlist(self.doclist,'entries'):
+      if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
+        check_list.append(d.purhcase_order)
+        stopped = sql("select name from `tabPurchase Order` where status = 'Stopped' and name = '%s'" % d.purchase_order)
+        if stopped:
+          msgprint("One cannot do any transaction against 'Purchase Order' : %s, it's status is 'Stopped'" % (d.purhcase_order))
+          raise Exception
+          
+  # Validate Supplier
+  # -----------------
+  def validate_supplier(self, d):
+    supplier = ''
+    if d.purchase_order and not d.purchase_order in self.po_list:
+      supplier = sql("select supplier from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0]
+      doctype = 'purchase order'
+      doctype_no = cstr(d.purchase_order)
+      if supplier and not cstr(self.doc.supplier) == cstr(supplier):
+        msgprint("Supplier name %s do not match with supplier name  of %s %s." %(self.doc.supplier,doctype,doctype_no))
+        raise Exception , " Validation Error "
+
+    if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
+      supplier = sql("select supplier from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt)[0][0]
+      doctype = 'purchase receipt'
+      doctype_no = cstr(d.purchase_receipt)
+      if supplier and not cstr(self.doc.supplier) == cstr(supplier):
+        msgprint("Supplier name %s do not match with supplier name  of %s %s." %(self.doc.supplier,doctype,doctype_no))
+        raise Exception , " Validation Error "
+
+  # Validate values with reference document
+  #----------------------------------------
+  def validate_reference_value(self):
+    get_obj('DocType Mapper', 'Purchase Order-Payable Voucher', with_children = 1).validate_reference_value(self, self.doc.name)
+
+        
+  # Validate PO and PR
+  # -------------------
+  def validate_po_pr(self, d):
+    # check po / pr for qty and rates and currency and conversion rate
+
+    # always import_rate must be equal to import_rate of purchase order
+    if d.purchase_order and not d.purchase_order in self.po_list:
+      # currency
+      currency = cstr(sql("select currency from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0])
+      if not cstr(currency) == cstr(self.doc.currency):
+        msgprint("Purchase Order: " + cstr(d.purchase_order) + " currency : " + cstr(currency) + " does not match with currency of current document.")
+        raise Exception
+      # import_rate
+      rate = flt(sql('select import_rate from `tabPO Detail` where item_code=%s and parent=%s and name = %s', (d.item_code, d.purchase_order, d.po_detail))[0][0])
+      if abs(rate - flt(d.import_rate)) > 1:
+        msgprint("Import Rate for %s in the Purchase Order is %s. Rate must be same as Purchase Order Rate" % (d.item_code,rate))
+        raise Exception
+                  
+    if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
+      # currency , conversion_rate
+      data = sql("select currency, conversion_rate from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt, as_dict = 1)
+      if not cstr(data[0]['currency']) == cstr(self.doc.currency):
+        msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " currency : " + cstr(data[0]['currency']) + " does not match with currency of current document.")
+        raise Exception
+      if not flt(data[0]['conversion_rate']) == flt(self.doc.conversion_rate):
+        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)-flt(self.doc.other_tax_deducted)
+          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 str({'rate' : flt(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
+    elif not self.doc.aging_date:
+      msgprint("Aging Date is mandatory for opening entry")
+      raise Exception
+      
+
+  # Set against account for debit to account
+  #------------------------------------------
+  def set_against_expense_account(self):
+    against_acc = []
+    for d in getlist(self.doclist, 'entries'):
+      if d.expense_account not in against_acc:
+        against_acc.append(d.expense_account)
+    self.doc.against_expense_account = ','.join(against_acc)
+
+  #check in manage account if purchase order required or not.
+  # ====================================================================================
+  def po_required(self):
+    res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'po_required'")
+    if res and res[0][0] == 'Yes':
+       for d in getlist(self.doclist,'entries'):
+         if not d.purchase_order:
+           msgprint("Purchse Order No. required against item %s"%d.item_code)
+           raise Exception
+
+  #check in manage account if purchase receipt required or not.
+  # ====================================================================================
+  def pr_required(self):
+    res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'pr_required'")
+    if res and res[0][0] == 'Yes':
+       for d in getlist(self.doclist,'entries'):
+         if not d.purchase_receipt:
+           msgprint("Purchase Receipt No. required against item %s"%d.item_code)
+           raise Exception
+
+  # VALIDATE
+  # ====================================================================================
+  def validate(self):
+    self.po_required()
+    self.pr_required()
+    self.check_active_purchase_items()
+    self.check_conversion_rate()
+    self.validate_bill_no_date()
+    self.validate_bill_no()
+    self.validate_reference_value()
+    self.clear_advances()
+    self.validate_credit_acc()
+    self.check_for_acc_head_of_supplier()
+    self.check_for_stopped_status()
+
+    self.po_list, self.pr_list = [], []
+    for d in getlist(self.doclist, 'entries'):
+      self.validate_supplier(d)
+      self.validate_po_pr(d)
+      if not d.purchase_order in self.po_list:
+        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'
+
+    self.set_aging_date()
+
+    #set against account for credit to
+    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 Purchase Common Obj
+    pc_obj = get_obj(dt='Purchase Common')
+    
+     # get total in words
+    self.doc.in_words = pc_obj.get_total_in_words('Rs', 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
+  # -----------------------------
+  def check_prev_docstatus(self):
+    for d in getlist(self.doclist,'entries'):
+      if d.purchase_order:
+        submitted = sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
+        if not submitted:
+          msgprint("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
+          raise Exception , "Validation Error."
+      if d.purchase_receipt:
+        submitted = sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
+        if not submitted:
+          msgprint("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
+          raise Exception , "Validation Error."
+
+  def update_against_document_in_jv(self, against_document_no, against_document_doctype):
+    get_obj('GL Control').update_against_document_in_jv( self,'advance_allocation_details', against_document_no, against_document_doctype, self.doc.credit_to, 'debit',self.doc.doctype)
+
+  # On Submit
+  # ----------
+  def on_submit(self):
+    self.check_prev_docstatus()
+    
+    # Check for Approving Authority
+    get_obj('Authorization Control').validate_approving_authority(self.doc.doctype,self.doc.company, self.doc.grand_total)
+    
+    
+    # this sequence because outstanding may get -negative
+    get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist)
+    self.update_against_document_in_jv(self.doc.name, self.doc.doctype)
+    get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 1)
+
+
+
+# ********************************* 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()
+    
+    get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, 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
+    
+########################################################################
+# Repair Outstanding
+#######################################################################
+  def repair_pv_outstanding(self):
+    get_obj(dt = 'GL Control').repair_voucher_outstanding(self)
diff --git a/accounts/doctype/payable_voucher/payable_voucher.txt b/accounts/doctype/payable_voucher/payable_voucher.txt
new file mode 100644
index 0000000..f1a8dc9
--- /dev/null
+++ b/accounts/doctype/payable_voucher/payable_voucher.txt
@@ -0,0 +1,3172 @@
+[
+	{
+		'_last_update': '1306307726',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-25 13:57:27',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'Payable Voucher',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'From %(supplier_name)s due on %(due_date)s | %(outstanding_amount)s outstanding',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 517
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00374',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00375',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00376',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00377',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00378',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00379',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': 'supplier',
+		'modified': '2011-02-17 14:34:39',
+		'modified_by': 'umair@iwebnotes.com',
+		'name': 'PERM00380',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Supplier',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2011-05-25 13:59:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05523',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05524',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': 'BILL',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 13:59:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02063',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'BILL\nBILLJ',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'The account to which you will pay (have paid) the money to.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_to',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Credit To',
+		'modified': '2011-05-25 13:59:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02058',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'credit_to',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 13:59:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02061',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Link',
+		'options': 'Payable Voucher',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Supplier',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02059',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier',
+		'oldfieldtype': 'Link',
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Supplier Address',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02060',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:00:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05370',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Contact',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL03777',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:00:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05371',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:00:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05372',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05513',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:00:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05374',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL05525',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Voucher Date',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02064',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'voucher_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'due_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Due Date',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02065',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'due_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02066',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'If not applicable please enter: NA',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bill_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Bill No',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02086',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bill_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bill_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Bill Date',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02087',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bill_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02067',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mode_of_payment',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Mode of Payment',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02097',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'mode_of_payment',
+		'oldfieldtype': 'Select',
+		'options': 'link:Mode of Payment',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05526',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select Items from Purchase Order',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_order_main',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Purchase Order',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02069',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_order_main',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Order',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select Items from Purchase Receipt',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_main',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Purchase Receipt',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02070',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_receipt_main',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02071',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'pull_details',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05527',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Bill Currency',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02088',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': '1',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Bill Conversion Rate',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02089',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05528',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'entries',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Entries',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02072',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'entries',
+		'oldfieldtype': 'Table',
+		'options': 'PV Detail',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Recalculate',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02073',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'Will be calculated automatically when you enter the details',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Net Total',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02074',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Add / Edit taxes and other charges',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05529',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_other_charges',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Purchase Other Charges',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02078',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_other_charges',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Other Charges',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Get Tax Detail',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02079',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_purchase_tax_details',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_tax_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Purchase Tax Details',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02080',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_tax_details',
+		'oldfieldtype': 'Table',
+		'options': 'Purchase Tax Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Calculate Tax',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02081',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Tax Calculation',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05530',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_tax',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Total Tax',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02083',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_tax',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05531',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05532',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_opening',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': 1,
+		'label': 'Is Opening',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02092',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_opening',
+		'oldfieldtype': 'Select',
+		'options': 'No\nYes',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:48:01',
+		'default': None,
+		'depends_on': None,
+		'description': 'Track this Purchase Invoice against any Project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL03778',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'aging_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Aging Date',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02093',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'aging_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02098',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05533',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02094',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02095',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02096',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02090',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'Advances',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05534',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Get Advances Paid',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02100',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_advances',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'advance_allocation_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Advance Allocation Details',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02101',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'advance_allocation_details',
+		'oldfieldtype': 'Table',
+		'options': 'Advance Allocation Detail',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'TDS',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05535',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05536',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_applicable',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'TDS Applicable',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02103',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tds_applicable',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_category',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'TDS Category',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02104',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tds_category',
+		'oldfieldtype': 'Select',
+		'options': 'link:TDS Category',
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': 'Get TDS',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02105',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05537',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tax_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'TDS Account Head',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02106',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tax_code',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02107',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ded_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': None,
+		'label': 'TDS Amount',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02108',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'ded_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05538',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05539',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_added',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': None,
+		'label': 'Other Charges Added',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02111',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_added',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_deducted',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': 'Other Charges Deducted',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02112',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_deducted',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_tds_on_voucher',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': None,
+		'label': 'Total TDS On Voucher',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02113',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_tds_on_voucher',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_amount_on_advance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'TDS Amount On Advance',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02114',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'tds_amount_on_advance',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_advance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Total Advance (Incl. TDS)',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02115',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_advance',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_amount_to_pay',
+		'fieldtype': 'Currency',
+		'hidden': 0,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'Total Amount To Pay',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02116',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_amount_to_pay',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'outstanding_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': 1,
+		'label': 'Outstanding Amount',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02117',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'outstanding_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05540',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': None,
+		'label': 'Grand Total',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02075',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Purchase Invoice.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02076',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 75,
+		'in_filter': None,
+		'label': 'Net Total (Import)',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02119',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_total_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_added_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 76,
+		'in_filter': None,
+		'label': 'Other Charges Added (Import)',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02120',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_added_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_deducted_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 77,
+		'in_filter': None,
+		'label': 'Other Charges Deducted (Import)',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02121',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_deducted_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 78,
+		'in_filter': None,
+		'label': 'Grand Total (Import)',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02122',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words (Import) will be visible once you save the Purchase Invoice.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_import',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 79,
+		'in_filter': None,
+		'label': 'In Words (Import)',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02123',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words_import',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 13:59:16',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 80,
+		'in_filter': None,
+		'label': 'Actions',
+		'modified': '2011-05-25 13:59:16',
+		'modified_by': 'Administrator',
+		'name': 'FL05541',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 81,
+		'in_filter': None,
+		'label': 'Repair Outstanding Amt',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02130',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_pv_outstanding',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'against_expense_account',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 82,
+		'in_filter': None,
+		'label': 'Against Expense Account',
+		'modified': '2011-05-25 13:59:15',
+		'modified_by': 'Administrator',
+		'name': 'FL02131',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'against_expense_account',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Payable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/period_closing_voucher/__init__.py b/accounts/doctype/period_closing_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/period_closing_voucher/__init__.py
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/accounts/doctype/period_closing_voucher/period_closing_voucher.js
new file mode 100644
index 0000000..d6360a5
--- /dev/null
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.js
@@ -0,0 +1,26 @@
+
+//========================== On Load =================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+hide_field('Repost Account Balances');
+  hide_field('next_fiscal_year');
+  hide_field('Repost');
+
+  if (doc.docstatus == 1) { 
+    unhide_field('Repost Account Balances');
+    unhide_field('next_fiscal_year');
+    unhide_field('Repost');
+  }
+}
+
+// ***************** Get Account Head *****************
+cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND `tabAccount`.freeze_account = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
+}
+
+cur_frm.cscript.acc_help = function(doc,dt,dn){
+  show_chart_browser('Accounts Browser','Account');
+}
\ No newline at end of file
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/accounts/doctype/period_closing_voucher/period_closing_voucher.py
new file mode 100644
index 0000000..ed42459
--- /dev/null
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -0,0 +1,196 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    self.td, self.tc = 0, 0
+    self.year_start_date = ''
+    self.year_end_date = ''
+
+
+  # Validate Account Head
+  #============================================================
+  def validate_account_head(self):
+    acc_det = sql("select debit_or_credit, is_pl_account, group_or_ledger, company from `tabAccount` where name = '%s'" % (self.doc.closing_account_head))
+
+    # Account should be under liability 
+    if cstr(acc_det[0][0]) != 'Credit' or cstr(acc_det[0][1]) != 'No':
+      msgprint("Account: %s must be created under 'Source of Funds'" % self.doc.closing_account_head)
+      raise Exception
+   
+    # Account must be a ledger
+    if cstr(acc_det[0][2]) != 'Ledger':
+      msgprint("Account %s must be a ledger" % self.doc.closing_account_head)
+      raise Exception 
+    
+    # Account should belong to company selected 
+    if cstr(acc_det[0][3]) != self.doc.company:
+      msgprint("Account %s does not belong to Company %s ." % (self.doc.closing_account_head, self.doc.company))
+      raise Exception 
+
+  # validate posting date
+  #=============================================================
+  def validate_posting_date(self):
+    yr = sql("select start_date, end_date from `tabPeriod` where period_name = '%s'" % (self.doc.fiscal_year))
+    self.year_start_date = yr and yr[0][0] or ''
+    self.year_end_date = yr and yr[0][1] or ''
+    
+    # Posting Date should be within closing year
+    if getdate(self.doc.posting_date) < self.year_start_date or getdate(self.doc.posting_date) > self.year_end_date:
+      msgprint("Posting Date should be within Closing Fiscal Year")
+      raise Exception
+
+    # Period Closing Entry
+    pce = sql("select name from `tabPeriod Closing Voucher` where posting_date > '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.posting_date, self.doc.fiscal_year))
+    if pce and pce[0][0]:
+      msgprint("Another Period Closing Entry: %s has been made after posting date: %s" % (cstr(pce[0][0]), self.doc.posting_date))
+      raise Exception
+     
+  # Validate closing entry requirement
+  #==========================================================
+  def validate_pl_balances(self):
+    income_bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, tabAccount t2 where t1.account = t2.name and t1.posting_date between '%s' and '%s' and t2.debit_or_credit = 'Credit' and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and t2.is_pl_account = 'Yes' and t2.docstatus < 2 and t2.company = '%s'" % (self.year_start_date, self.doc.posting_date, self.doc.company))
+    expense_bal = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, tabAccount t2 where t1.account = t2.name and t1.posting_date between '%s' and '%s' and t2.debit_or_credit = 'Debit' and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and t2.is_pl_account = 'Yes' and t2.docstatus < 2 and t2.company = '%s'" % (self.year_start_date, self.doc.posting_date, self.doc.company))
+    
+    income_bal = income_bal and income_bal[0][0] or 0
+    expense_bal = expense_bal and expense_bal[0][0] or 0
+    
+    if not income_bal and not expense_bal:
+      msgprint("Both Income and Expense balances are zero. No Need to make Period Closing Entry.")
+      raise Exception
+    
+  # Get account (pl) specific balance
+  #===========================================================
+  def get_pl_balances(self, d_or_c):
+    acc_bal = sql("select  t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.group_or_ledger = 'Ledger' and ifnull(t2.freeze_account, 'No') = 'No' and t2.is_pl_account = 'Yes' and t2.debit_or_credit = '%s' and t2.docstatus < 2 and t2.company = '%s' and t1.posting_date between '%s' and '%s' group by t1.account " % (d_or_c, self.doc.company, self.year_start_date, self.doc.posting_date))
+    return acc_bal
+
+   
+  # Makes GL Entries
+  # ==========================================================
+  def make_gl_entries(self, acc_det):
+    for a in acc_det:
+      if flt(a[1]):
+        fdict = {
+	        'account': a[0], 
+	        'cost_center': '', 
+	        'against': '', 
+	        'debit': flt(a[1]) < 0 and -1*flt(a[1]) or 0,
+	        'credit': flt(a[1]) > 0 and flt(a[1]) or 0,
+	        'remarks': self.doc.remarks, 
+	        'voucher_type': self.doc.doctype, 
+	        'voucher_no': self.doc.name, 
+	        'transaction_date': self.doc.transaction_date, 
+	        'posting_date': self.doc.posting_date, 
+	        'fiscal_year': self.doc.fiscal_year, 
+	        'against_voucher': '', 
+	        'against_voucher_type': '', 
+	        'company': self.doc.company, 
+	        'is_opening': 'No', 
+	        'aging_date': self.doc.posting_date
+        }
+      
+        self.save_entry(fdict)
+   
+ 
+  # Save GL Entry
+  # ==========================================================
+  def save_entry(self, fdict, is_cancel = 'No'):
+    # Create new GL entry object and map values
+    le = Document('GL Entry')
+    for k in fdict:
+      le.fields[k] = fdict[k]
+    
+    le_obj = get_obj(doc=le)
+    # validate except on_cancel
+    if is_cancel == 'No':
+      le_obj.validate()
+      
+      # update total debit / credit except on_cancel
+      self.td += flt(le.credit)
+      self.tc += flt(le.debit)
+
+    # save
+    le.save(1)
+    le_obj.on_update(adv_adj = '')
+    
+
+  # Reposting Balances
+  # ==========================================================
+  def repost_account_balances(self):
+    # Get Next Fiscal Year
+    fy = sql("select name, is_fiscal_year_closed from `tabFiscal Year` where name = '%s' and past_year = '%s'" % (self.doc.next_fiscal_year, self.doc.fiscal_year))
+    if not fy:
+      msgprint("There is no Fiscal Year with Name " + cstr(self.doc.next_fiscal_year) + " and Past Year " + cstr(self.doc.fiscal_year))
+      raise Exception
+   
+    if fy and fy[0][1] == 'Yes':
+      msgprint("Fiscal Year %s has been closed." % cstr(fy[1]))
+      raise Exception
+    
+    # Repost Balances
+    get_obj('Fiscal Year', fy[0][0]).repost()
+ 
+     
+  # Validation
+  # ===========================================================
+  def validate(self):
+  
+    # validate account head
+    self.validate_account_head()
+
+    # validate posting date
+    self.validate_posting_date()
+
+    # check if pl balance:
+    self.validate_pl_balances()
+
+
+  # On Submit
+  # ===========================================================
+  def on_submit(self):
+    
+    # Makes closing entries for Expense Account
+    in_acc_det = self.get_pl_balances('Credit')
+    self.make_gl_entries(in_acc_det)
+
+    # Makes closing entries for Expense Account
+    ex_acc_det = self.get_pl_balances('Debit')
+    self.make_gl_entries(ex_acc_det)
+
+
+    # Makes Closing entry for Closing Account Head
+    bal = self.tc - self.td
+    self.make_gl_entries([[self.doc.closing_account_head, flt(bal)]])
+
+
+  # On Cancel
+  # =============================================================
+  def on_cancel(self):
+    # get all submit entries of current closing entry voucher
+    gl_entries = sql("select account, debit, credit from `tabGL Entry` where voucher_type = 'Period Closing Voucher' and voucher_no = '%s'" % (self.doc.name))
+
+    # Swap Debit & Credit Column and make gl entry
+    for gl in gl_entries:
+      fdict = {'account': gl[0], 'cost_center': '', 'against': '', 'debit': flt(gl[2]), 'credit' : flt(gl[1]), 'remarks': self.doc.cancel_reason, 'voucher_type': self.doc.doctype, 'voucher_no': self.doc.name, 'transaction_date': self.doc.transaction_date, 'posting_date': self.doc.posting_date, 'fiscal_year': self.doc.fiscal_year, 'against_voucher': '', 'against_voucher_type': '', 'company': self.doc.company, 'is_opening': 'No', 'aging_date': 'self.doc.posting_date'}
+      self.save_entry(fdict, is_cancel = 'Yes')
+
+    # Update is_cancelled = 'Yes' to all gl entries for current voucher
+    sql("update `tabGL Entry` set is_cancelled = 'Yes' where voucher_type = '%s' and voucher_no = '%s'" % (self.doc.doctype, self.doc.name))
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
new file mode 100644
index 0000000..9704d08
--- /dev/null
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-13 14:25:35', 'search_fields': 'posting_date, fiscal_year', 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 121, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'PCE/.###', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Period Closing Voucher', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-25 17:19:32', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01120', 'parent': 'Period Closing Voucher', 'read': 1, 'create': 1, 'creation': '2010-08-13 14:25:35', 'modified': '2010-10-25 17:19:32', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01226', 'parent': 'Period Closing Voucher', 'read': 1, 'create': 1, 'creation': '2010-10-22 17:27:59', 'modified': '2010-10-25 17:19:32', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-08-18 11:07:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05939', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-13 14:25:35', 'doctype': 'DocField', 'oldfieldname': 'transaction_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Transaction Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05895', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'transaction_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-13 14:25:35', 'doctype': 'DocField', 'oldfieldname': 'posting_date', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Posting Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05894', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'posting_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-08-13 14:29:39', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Closing Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05899', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-17 17:08:20', 'doctype': 'DocField', 'oldfieldname': 'amended_from', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amended From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05923', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'amended_from', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-17 17:08:20', 'doctype': 'DocField', 'oldfieldname': 'amendment_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amendment Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05924', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'amendment_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-08-13 14:29:39', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05901', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Select', 'options': 'link:Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-08-18 11:03:44', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05936', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-13 14:25:35', 'doctype': 'DocField', 'oldfieldname': 'closing_account_head', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Closing Account Head', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05897', 'idx': 9, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'closing_account_head', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-10-14 08:21:03', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'CoA Help', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06305', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<a href="javascript:cur_frm.cscript.acc_help();">To create Account Head, click here</a>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-13 14:25:35', 'doctype': 'DocField', 'oldfieldname': 'remarks', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Remarks', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05896', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'remarks', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-10-13 10:39:21', 'doctype': 'DocField', 'oldfieldname': 'cancel_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Cancel Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL06291', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'cancel_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-08-18 11:03:44', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Repost Account Balances', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05937', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-08-13 14:29:39', 'doctype': 'DocField', 'oldfieldname': 'next_fiscal_year', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year (For Reposting)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL05900', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': 'next_fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-08-13 14:29:39', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Repost', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period Closing Voucher', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL05902', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-25 17:19:32', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'repost_account_balances', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/pos_setting/__init__.py b/accounts/doctype/pos_setting/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/pos_setting/__init__.py
diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js
new file mode 100755
index 0000000..2bbc08c
--- /dev/null
+++ b/accounts/doctype/pos_setting/pos_setting.js
@@ -0,0 +1,38 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  $c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
+    if(r.message) set_field_options('naming_series', r.message);
+  });
+ 
+  
+}
+
+//cash bank account
+//------------------------------------
+cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" 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"'
+}
+
+// Income Account 
+// --------------------------------
+cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"'
+}
+
+
+// Cost Center 
+// -----------------------------
+cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
+  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';
+}
+
+//get query select Territory
+//=================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+
+// ------------------ Get Print Heading ------------------------------------
+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';
+}
diff --git a/accounts/doctype/pos_setting/pos_setting.py b/accounts/doctype/pos_setting/pos_setting.py
new file mode 100755
index 0000000..7fff248
--- /dev/null
+++ b/accounts/doctype/pos_setting/pos_setting.py
@@ -0,0 +1,35 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc, self.doclist = doc,doclist
+
+  #--------------------get naming series from sales invoice-----------------
+  def get_series(self):
+    res = sql("select options from `tabDocField` where parent='Receivable Voucher' and fieldname = 'naming_series'")
+    return res and cstr(res[0][0]) or ''
+  
+  def validate(self):
+    res = sql("select name, user from `tabPOS Setting` where ifnull(user, '') = '%s' and name != '%s' and company = '%s'" % (self.doc.user, self.doc.name, self.doc.company))
+    if res:
+      if res[0][1]:
+        msgprint("POS Setting '%s' already created for user: '%s' and company: '%s'"%(res[0][0], res[0][1], self.doc.company), raise_exception=1)
+      else:
+        msgprint("Global POS Setting already created - %s for this company: '%s'" % (res[0][0], self.doc.company), raise_exception=1)
diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt
new file mode 100755
index 0000000..ab4b5f4
--- /dev/null
+++ b/accounts/doctype/pos_setting/pos_setting.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-08 15:18:11', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 27, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'POS/.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'POS Setting', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-12-10 11:29:51', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00679', 'parent': 'POS Setting', 'read': 1, 'create': 1, 'creation': '2010-12-08 15:18:12', 'modified': '2010-12-10 11:29:51', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00680', 'parent': 'POS Setting', 'read': 1, 'create': 1, 'creation': '2010-12-08 15:18:12', 'modified': '2010-12-10 11:29:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00681', 'parent': 'POS Setting', 'read': 1, 'create': 1, 'creation': '2010-12-08 15:18:12', 'modified': '2010-12-10 11:29:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00682', 'parent': 'POS Setting', 'read': 1, 'create': None, 'creation': '2010-12-08 15:18:12', 'modified': '2010-12-10 11:29:51', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'user', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'User', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03825', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'user', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'territory', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Territory', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03826', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'territory', 'fieldtype': 'Link', 'options': 'Territory', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'naming_series', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03827', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'naming_series', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'currency', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Currency', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03828', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'currency', 'fieldtype': 'Select', 'options': 'link:Currency', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'conversion_rate', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Conversion Rate', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03829', 'idx': 5, 'default': '1.00', 'colour': 'White:FFF', 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'conversion_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'price_list_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Price List', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03830', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'price_list_name', 'fieldtype': 'Select', 'options': 'link:Price List', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03831', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03832', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'customer_account', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03833', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'customer_account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'cash_bank_account', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cash/Bank Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03834', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'cash_bank_account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'income_account', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Income Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03835', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'income_account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-09 17:46:11', 'doctype': 'DocField', 'oldfieldname': 'warehouse', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Warehouse', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03887', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'cost_center', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cost Center', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03836', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'cost_center', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'charge', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Charge', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03837', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'charge', 'fieldtype': 'Link', 'options': 'Other Charges', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'letter_head', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Letter Head', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03838', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'letter_head', 'fieldtype': 'Select', 'options': 'link:Letter Head', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'tc_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Terms', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03839', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'tc_name', 'fieldtype': 'Link', 'options': 'Term', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-12-08 15:18:12', 'doctype': 'DocField', 'oldfieldname': 'select_print_heading', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select Print Heading', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'POS Setting', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03840', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-12-10 11:29:51', 'parenttype': 'DocType', 'fieldname': 'select_print_heading', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/purchase_tax_detail/__init__.py b/accounts/doctype/purchase_tax_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/purchase_tax_detail/__init__.py
diff --git a/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt b/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
new file mode 100644
index 0000000..d3b61f5
--- /dev/null
+++ b/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-01-28 11:36:28', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'wasim@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': 1, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 10, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'PVTD.######', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Purchase Tax Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-01-28 11:39:20', 'doctype': 'DocField', 'oldfieldname': 'category', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Category', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03870', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'category', 'fieldtype': 'Select', 'options': '\nFor Total\nFor Valuation\nFor Both', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-02-03 11:52:23', 'doctype': 'DocField', 'oldfieldname': 'add_deduct_tax', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Add or Deduct', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03919', 'idx': 2, 'default': 'Add', 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'add_deduct_tax', 'fieldtype': 'Select', 'options': '\nAdd\nDeduct', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'charge_type', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Type', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03859', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'charge_type', 'fieldtype': 'Select', 'options': '\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'row_id', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Enter Row', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03860', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'row_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'item_wise_tax_detail', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Wise Tax Detail ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03861', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'item_wise_tax_detail', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03862', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'account_head', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Account Head', 'width': '', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03863', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'account_head', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-02-04 12:49:54', 'doctype': 'DocField', 'oldfieldname': 'cost_center', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cost Center', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03945', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'cost_center', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'wasim@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rate', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03864', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'tax_amount', 'owner': 'wasim@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amount', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03865', 'idx': 10, 'default': '', 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'tax_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'total', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Aggregate Total', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03866', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'total', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'parenttype', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Parenttype', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Purchase Tax Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL03867', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'parenttype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'total_tax_amount', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Total +Tax', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': 'Cheating Field\nPlease do not delete ', 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03868', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'total_tax_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:36:28', 'doctype': 'DocField', 'oldfieldname': 'total_amount', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Tax Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': 'Cheating Field\nPlease do not delete ', 'parent': 'Purchase Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03869', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-06-28 11:16:28', 'parenttype': 'DocType', 'fieldname': 'total_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/pv_add_tax_detail/__init__.py b/accounts/doctype/pv_add_tax_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/pv_add_tax_detail/__init__.py
diff --git a/accounts/doctype/pv_add_tax_detail/pv_add_tax_detail.txt b/accounts/doctype/pv_add_tax_detail/pv_add_tax_detail.txt
new file mode 100644
index 0000000..9d474be
--- /dev/null
+++ b/accounts/doctype/pv_add_tax_detail/pv_add_tax_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:22', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'EXPTD.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'PV Add Tax Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:22', 'doctype': 'DocField', 'oldfieldname': 'add_tax_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tax Code', 'width': '200px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Add Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00442', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-07-09 14:29:26', 'parenttype': 'DocType', 'fieldname': 'add_tax_code', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-04-23 11:13:34', 'doctype': 'DocField', 'oldfieldname': 'cost_center', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cost Center', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Add Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01926', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-07-09 14:29:26', 'parenttype': 'DocType', 'fieldname': 'cost_center', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:22', 'doctype': 'DocField', 'oldfieldname': 'add_tax_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rate', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Add Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00443', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-07-09 14:29:26', 'parenttype': 'DocType', 'fieldname': 'add_tax_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:22', 'doctype': 'DocField', 'oldfieldname': 'add_amount', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amount', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Add Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00444', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-07-09 14:29:26', 'parenttype': 'DocType', 'fieldname': 'add_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/pv_ded_tax_detail/__init__.py b/accounts/doctype/pv_ded_tax_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/pv_ded_tax_detail/__init__.py
diff --git a/accounts/doctype/pv_ded_tax_detail/pv_ded_tax_detail.txt b/accounts/doctype/pv_ded_tax_detail/pv_ded_tax_detail.txt
new file mode 100644
index 0000000..312256a
--- /dev/null
+++ b/accounts/doctype/pv_ded_tax_detail/pv_ded_tax_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:22', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'TDD.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'PV Ded Tax Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-05-25 16:21:06', 'doctype': 'DocField', 'oldfieldname': 'tds_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'TDS Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Ded Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02152', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-12-15 12:02:13', 'parenttype': 'DocType', 'fieldname': 'tds_type', 'fieldtype': 'Select', 'options': '\nMain\nSurcharge\nEdu Cess\nSH Edu Cess\nNot Applicable', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:22', 'doctype': 'DocField', 'oldfieldname': 'tax_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Tax Code', 'width': '200px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Ded Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00445', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-12-15 12:02:13', 'parenttype': 'DocType', 'fieldname': 'tax_code', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Float', 'creation': '2009-03-12 12:09:22', 'doctype': 'DocField', 'oldfieldname': 'tax_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rate', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Ded Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00446', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-12-15 12:02:13', 'parenttype': 'DocType', 'fieldname': 'tax_rate', 'fieldtype': 'Float', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:22', 'doctype': 'DocField', 'oldfieldname': 'ded_amount', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PV Ded Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00447', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-12-15 12:02:13', 'parenttype': 'DocType', 'fieldname': 'ded_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/pv_detail/__init__.py b/accounts/doctype/pv_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/pv_detail/__init__.py
diff --git a/accounts/doctype/pv_detail/pv_detail.txt b/accounts/doctype/pv_detail/pv_detail.txt
new file mode 100644
index 0000000..32b6076
--- /dev/null
+++ b/accounts/doctype/pv_detail/pv_detail.txt
@@ -0,0 +1,686 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'EVD.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-30 11:23:38',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'PV Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 26
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Item',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02571',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 0,
+		'label': 'Item Name',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02572',
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Brand',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02573',
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02574',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Item Group',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02575',
+		'no_copy': None,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Rate (Default Curr.)',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02576',
+		'no_copy': None,
+		'oldfieldname': 'rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'import_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02578',
+		'no_copy': None,
+		'oldfieldname': 'import_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Qty',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02577',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Amount (Default Curr.)',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02579',
+		'no_copy': None,
+		'oldfieldname': 'amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'import_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02580',
+		'no_copy': None,
+		'oldfieldname': 'import_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'expense_head',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Expense Head',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02581',
+		'no_copy': None,
+		'oldfieldname': 'expense_head',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '120px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_center',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Cost Center',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02582',
+		'no_copy': None,
+		'oldfieldname': 'cost_center',
+		'oldfieldtype': 'Link',
+		'options': 'Cost Center',
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '120px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_order',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Pur Order',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02583',
+		'no_copy': None,
+		'oldfieldname': 'purchase_order',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Order',
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_detail',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'PO Detail',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02584',
+		'no_copy': None,
+		'oldfieldname': 'po_detail',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Pur Receipt',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02585',
+		'no_copy': None,
+		'oldfieldname': 'purchase_receipt',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pr_detail',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'PR Detail',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02586',
+		'no_copy': None,
+		'oldfieldname': 'pr_detail',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': 'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_tax_rate',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Item Tax Rate',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': 'FL02587',
+		'no_copy': None,
+		'oldfieldname': 'item_tax_rate',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2011-05-09 11:04:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'page_break',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Page Break',
+		'modified': '2011-05-09 11:04:22',
+		'modified_by': 'Administrator',
+		'name': '000000371',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'PV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/receivable_voucher/__init__.py b/accounts/doctype/receivable_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/receivable_voucher/__init__.py
diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.js b/accounts/doctype/receivable_voucher/receivable_voucher.js
new file mode 100644
index 0000000..a25d311
--- /dev/null
+++ b/accounts/doctype/receivable_voucher/receivable_voucher.js
@@ -0,0 +1,419 @@
+cur_frm.cscript.tname = "RV Detail";
+cur_frm.cscript.fname = "entries";
+cur_frm.cscript.other_fname = "other_charges";
+cur_frm.cscript.sales_team_fname = "sales_team";
+
+// print heading
+cur_frm.pformat.print_heading = 'Invoice';
+
+$import(Sales Common)
+$import(Other Charges)
+$import(SMS Control)
+
+// On Load
+// -------
+cur_frm.cscript.onload = function(doc,dt,dn) {
+  if(!doc.customer && doc.debit_to) get_field(dt, 'debit_to', dn).print_hide = 0;
+  if (doc.__islocal) {
+		if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
+		if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
+		if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+		
+		//for previously created sales invoice, set required field related to pos
+		if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn);
+	
+ 	    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+  }
+}
+
+cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
+	if(doc.customer && doc.__islocal) {
+		// called from mapper, update the account names for items and customer
+		$c_obj(make_doclist(doc.doctype,doc.name),
+			'load_default_accounts','',
+			function(r,rt) {
+				refresh_field('entries');
+				refresh_field('debit_to');
+			}
+		);
+	}
+	
+	if(!doc.customer && doc.__islocal) {
+		// new -- load default taxes
+		cur_frm.cscript.load_taxes(doc, cdt, cdn);		
+	}
+}
+
+
+// Hide Fields
+// ------------
+cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
+  if(cint(doc.is_pos) == 1)
+    hide_field(['project_name', 'due_date', 'posting_time', 'sales_order_main', 'delivery_note_main', 'Get Items']);
+  else
+    unhide_field(['project_name', 'due_date', 'posting_time', 'sales_order_main', 'delivery_note_main', 'Get Items']);
+}
+
+
+// Refresh
+// -------
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+
+  // Show / Hide button
+  cur_frm.clear_custom_buttons();
+    
+  if(doc.docstatus==1) { 
+    cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+    unhide_field('Repair Outstanding Amt');
+    
+    if(doc.is_pos==1 && doc.update_stock!=1)
+      cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
+  
+    if(doc.outstanding_amount!=0)
+      cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript['Make Bank Voucher']);
+  }
+  else  
+    hide_field('Repair Outstanding Amt');
+  cur_frm.cscript.is_opening(doc, dt, dn);
+  cur_frm.cscript.hide_fields(doc, cdt, cdn);
+}
+
+//fetch retail transaction related fields
+//--------------------------------------------
+cur_frm.cscript.is_pos = function(doc,dt,dn){
+  cur_frm.cscript.hide_fields(doc, cdt, cdn);
+  if(doc.is_pos == 1){
+    if (!doc.company) {
+      msgprint("Please select company to proceed");
+      doc.is_pos = 0;
+      refresh_field('is_pos');
+    }
+    else {
+      var callback = function(r,rt){
+        cur_frm.refresh();
+      }
+      $c_obj(make_doclist(dt,dn),'set_pos_fields','',callback);
+    }
+  }
+}
+
+
+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.warehouse) {
+    arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}";
+    get_server_fields('get_actual_qty',arg,'entries',doc,cdt,cdn,1);
+  }
+}
+
+
+
+//Customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      get_server_fields('get_debit_to','','',doc, dt, dn, 0);
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);  
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+
+// Set Due Date = posting date + credit days
+cur_frm.cscript.debit_to = function(doc,dt,dn) {
+
+  var callback2 = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  }   
+  
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];    
+      if(doc.customer) $c_obj(make_doclist(dt,dn), 'get_default_customer_address', '', callback2);
+      if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+      cur_frm.refresh();
+  }
+  
+  if(doc.debit_to && doc.posting_date){
+    get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,callback);
+  }
+}
+
+
+
+//refresh advance amount
+//-------------------------------------------------
+
+cur_frm.cscript.paid_amount = function(doc,dt,dn){
+  doc.outstanding_amount = flt(doc.grand_total) - flt(doc.paid_amount) - flt(doc.write_off_amount);
+  refresh_field('outstanding_amount');
+}
+
+
+//---- get customer details ----------------------------
+cur_frm.cscript.project_name = function(doc,cdt,cdn){
+	$c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
+	  refresh_many(['customer', 'customer_name','customer_address', 'territory']);
+	});
+}
+
+//Set debit and credit to zero on adding new row
+//----------------------------------------------
+cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
+  
+  cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
+  acc = '';
+  cc = '';
+
+  for(var i = 0; i<cl.length; i++) {
+    
+    if (cl[i].idx == 1){
+      acc = cl[i].income_account;
+      cc = cl[i].cost_center;
+    }
+    else{
+      if (! cl[i].income_account) { cl[i].income_account = acc; refresh_field('income_account', cl[i].name, 'entries');}
+      if (! cl[i].cost_center)  {cl[i].cost_center = cc;refresh_field('cost_center', cl[i].name, 'entries');}
+    }
+  }
+}
+
+cur_frm.cscript.is_opening = function(doc, dt, dn) {
+  hide_field('aging_date');
+  if (doc.is_opening == 'Yes') unhide_field('aging_date');
+}
+
+/* **************************** TRIGGERS ********************************** */
+
+
+
+// Posting Date
+// ------------
+//cur_frm.cscript.posting_date = cur_frm.cscript.debit_to;
+
+
+// Get Items based on SO or DN Selected
+cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+  var callback = function(r,rt) { 
+	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	  cur_frm.refresh();
+  }
+  get_server_fields('pull_details','','',doc, dt, dn,1,callback);
+}
+
+
+
+// Allocated Amount in advances table
+// -----------------------------------
+cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
+  cur_frm.cscript.calc_adjustment_amount(doc,cdt,cdn);
+}
+
+//Make Delivery Note Button
+//-----------------------------
+
+cur_frm.cscript['Make Delivery Note'] = function() {
+
+  var doc = cur_frm.doc
+  n = createLocal('Delivery Note');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Delivery Note'][n]]),
+    'from_doctype':doc.doctype,
+    'to_doctype':'Delivery Note',
+    'from_docname':doc.name,
+    'from_to_list':"[['Receivable Voucher','Delivery Note'],['RV Detail','Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+    }, function(r,rt) {
+       loaddoc('Delivery Note', n);
+    }
+  );
+}
+
+
+
+// Make Bank Voucher Button
+// -------------------------
+cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
+  cur_frm.cscript.make_jv(cur_frm.doc);
+}
+
+
+/* ***************************** Get Query Functions ************************** */
+
+// Debit To
+// ---------
+cur_frm.fields_dict.debit_to.get_query = function(doc) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" 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"'
+}
+
+// Cash/bank account
+//------------------
+cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" 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"'
+}
+
+// Write off account
+//------------------
+cur_frm.fields_dict.write_off_account.get_query = function(doc) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
+}
+
+// Write off cost center
+//-----------------------
+cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
+  return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"'
+}
+
+//project name
+//--------------------------
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  var cond = '';
+  if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
+  return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
+}
+
+//Territory
+//-----------------------------
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+// Income Account in Details Table
+// --------------------------------
+cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
+}
+
+// warehouse in detail table
+//----------------------------
+cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50";
+}
+
+// Cost Center in Details Table
+// -----------------------------
+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';
+}
+
+// Sales Order
+// -----------
+cur_frm.fields_dict.sales_order_main.get_query = function(doc) {
+  if (doc.customer)
+    return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 100 and `tabSales Order`.`customer` =  "' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
+  else
+    return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 100 and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
+}
+
+// Delivery Note
+// --------------
+cur_frm.fields_dict.delivery_note_main.get_query = function(doc) {
+  if (doc.customer)	
+    return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.`customer` =  "' + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';    
+  else
+    return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';        
+}
+
+
+
+cur_frm.cscript.income_account = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  if(d.income_account){
+    var cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
+    for(var i = 0; i < cl.length; i++){
+      if(!cl[i].income_account) cl[i].income_account = d.income_account;
+    }
+  }
+  refresh_field(cur_frm.cscript.fname);
+}
+
+
+cur_frm.cscript.cost_center = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  if(d.cost_center){
+    var cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
+    for(var i = 0; i < cl.length; i++){
+      if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
+    }
+  }
+  refresh_field(cur_frm.cscript.fname);
+}
+
+/* **************************************** Utility Functions *************************************** */
+
+// Details Calculation
+// --------------------
+cur_frm.cscript.calc_adjustment_amount = function(doc,cdt,cdn) {
+  var doc = locals[doc.doctype][doc.name];
+  var el = getchildren('Advance Adjustment Detail',doc.name,'advance_adjustment_details');
+  var total_adjustment_amt = 0
+  for(var i in el) {
+      total_adjustment_amt += flt(el[i].allocated_amount)
+  }
+  doc.total_advance = flt(total_adjustment_amt);
+  doc.outstanding_amount = flt(doc.grand_total) - flt(total_adjustment_amt) - flt(doc.paid_amount) - flt(doc.write_off_amount);
+  refresh_many(['total_advance','outstanding_amount']);
+}
+
+
+// Make Journal Voucher
+// --------------------
+cur_frm.cscript.make_jv = function(doc, dt, dn) {
+  var jv = LocalDB.create('Journal Voucher');
+  jv = locals['Journal Voucher'][jv];
+  jv.voucher_type = 'Bank Voucher';
+
+  jv.company = doc.company;
+  jv.remark = repl('Payment received against invoice %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
+  jv.fiscal_year = doc.fiscal_year;
+  
+  // debit to creditor
+  var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+  d1.account = doc.debit_to;
+  d1.credit = doc.outstanding_amount;
+  d1.against_invoice = doc.name;
+
+  
+  // credit to bank
+  var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+  d1.debit = doc.outstanding_amount;
+  
+  loaddoc('Journal Voucher', jv.name);
+}
+
+
+/****************** Get Accounting Entry *****************/
+cur_frm.cscript['View Ledger Entry'] = function(){
+  var callback = function(report){
+    report.set_filter('GL Entry', 'Voucher No',cur_frm.doc.name);
+    report.dt.run();
+  }
+  loadreport('GL Entry','General Ledger', callback);
+}
diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.py b/accounts/doctype/receivable_voucher/receivable_voucher.py
new file mode 100644
index 0000000..c12c390
--- /dev/null
+++ b/accounts/doctype/receivable_voucher/receivable_voucher.py
@@ -0,0 +1,618 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d, dl
+		self.log = []
+		self.tname = 'RV Detail'
+		self.fname = 'entries'
+
+
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
+
+
+
+# ********************************* Trigger Functions ******************************
+
+	#Set retail related fields from pos settings
+	#-------------------------------------------------------------------------
+	def set_pos_fields(self):
+		pos = sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
+		if not pos:
+			pos = sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+		if pos:
+			val = sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+			val = val and val[0][0] or ''
+			if not val: val = pos and pos[0]['customer_account'] or ''
+			if not self.doc.debit_to:
+				set(self.doc,'debit_to',val)
+			
+			lst = ['territory','naming_series','currency','charge','letter_head','tc_name','price_list_name','company','select_print_heading','cash_bank_account']
+				
+			for i in lst:
+				val = pos and pos[0][i] or ''
+				set(self.doc,i,val)
+			self.set_pos_item_values()
+			
+			val = pos and flt(pos[0]['conversion_rate']) or 0	
+			set(self.doc,'conversion_rate',val)
+
+			#fetch terms	
+			if self.doc.tc_name:	 self.get_tc_details()
+			
+			#fetch charges
+			if self.doc.charge:		self.get_other_charges()
+
+
+	# Set default values related to pos for previously created sales invoice.
+	# -------------------------------------------------------------------------- 
+	def set_pos_item_values(self):
+		if cint(self.doc.is_pos) ==1:
+			dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
+			if not dtl:
+				dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+			for d in getlist(self.doclist,'entries'):
+				if dtl and dtl[0]['income_account']: d.income_account = dtl[0]['income_account']
+				if dtl and dtl[0]['cost_center']: d.cost_center = dtl[0]['cost_center']
+				if dtl and dtl[0]['warehouse']: d.warehouse = dtl[0]['warehouse']
+
+			
+	# Get Account Head to which amount needs to be Debited based on Customer
+	# ----------------------------------------------------------------------
+	def get_customer_account(self):
+		acc_head = sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+		if acc_head and acc_head[0][0]:
+			return acc_head[0][0]
+		else:
+			msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
+
+	def get_debit_to(self):
+		acc_head = self.get_customer_account()
+		if acc_head:
+			return cstr({ 'debit_to' : acc_head })
+
+
+	# Set Due Date = Posting Date + Credit Days
+	# -----------------------------------------
+	def get_cust_and_due_date(self):
+		credit_days = 0
+		if self.doc.debit_to:
+			credit_days = sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to)
+			credit_days = credit_days and cint(credit_days[0][0]) or 0
+		if self.doc.company and not credit_days:
+			credit_days = sql("select credit_days from `tabCompany` where name='%s'" % self.doc.company)
+			credit_days = credit_days and cint(credit_days[0][0]) or 0
+		# Customer has higher priority than company
+		# i.e.if not entered in customer will take credit days from company
+		self.doc.due_date = add_days(cstr(self.doc.posting_date), credit_days)
+		
+		if self.doc.debit_to:
+			self.doc.customer = get_value('Account',self.doc.debit_to,'master_name')
+		#	get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
+
+
+	# Pull Details of Delivery Note or Sales Order Selected
+	# ------------------------------------------------------
+	def pull_details(self):
+		# Delivery Note
+		if self.doc.delivery_note_main:
+			self.validate_prev_docname('delivery note')
+			self.doc.clear_table(self.doclist,'other_charges')			
+			self.doclist = get_obj('DocType Mapper', 'Delivery Note-Receivable Voucher').dt_map('Delivery Note', 'Receivable Voucher', self.doc.delivery_note_main, self.doc, self.doclist, "[['Delivery Note', 'Receivable Voucher'],['Delivery Note Detail', 'RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]")			
+			self.get_income_account('entries')
+		# Sales Order
+		elif self.doc.sales_order_main:
+			self.validate_prev_docname('sales order')
+			self.doc.clear_table(self.doclist,'other_charges')
+			get_obj('DocType Mapper', 'Sales Order-Receivable Voucher').dt_map('Sales Order', 'Receivable Voucher', self.doc.sales_order_main, self.doc, self.doclist, "[['Sales Order', 'Receivable Voucher'],['Sales Order Detail', 'RV Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team']]")
+			self.get_income_account('entries')
+			
+		ret = eval(self.get_debit_to())	
+		if ret.has_key('debit_to'):
+			self.doc.debit_to = ret['debit_to']
+					
+	# onload pull income account
+	# --------------------------
+	def load_default_accounts(self):
+		"""
+			Loads default accounts from items, customer when called from mapper
+		"""
+		self.get_income_account('entries')
+		self.doc.debit_to = self.get_customer_account()
+		
+	def get_income_account(self,doctype):		
+		for d in getlist(self.doclist, doctype):			
+			if d.item_code:
+				item = sql("select default_income_account, default_sales_cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
+				d.income_account = item and item[0]['default_income_account'] or ''
+				d.cost_center = item and item[0]['default_sales_cost_center'] or ''				
+
+	# Item Details
+	# -------------
+	def get_item_details(self, item_code):
+		ret = get_obj('Sales Common').get_item_details(item_code, self)
+		if item_code and cint(self.doc.is_pos) == 1:
+			dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)				 
+			if not dtl:
+				dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+			if dtl and dtl[0]['income_account']: ret['income_account'] = dtl and dtl[0]['income_account']
+			if dtl and dtl[0]['cost_center']: ret['cost_center'] = dtl and dtl[0]['cost_center']
+			if dtl and dtl[0]['warehouse']: ret['warehouse'] = dtl and dtl[0]['warehouse']
+			if ret['warehouse']:
+				actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item_code, ret['warehouse']))		
+				ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
+		return str(ret)
+ 
+
+	# Get tax rate if account type is tax
+	# ------------------------------------
+	def get_rate(self,arg):
+		get_obj('Sales Common').get_rate(arg)
+		
+		
+	# Get Commission rate of Sales Partner
+	# -------------------------------------
+	def get_comm_rate(self, sales_partner):
+		return get_obj('Sales Common').get_comm_rate(sales_partner, self)	
+	
+ 
+	# GET TERMS & CONDITIONS
+	# -------------------------------------
+	def get_tc_details(self):
+		return get_obj('Sales Common').get_tc_details(self)
+
+	# Load Default Charges
+	# ----------------------------------------------------------
+	def load_default_taxes(self):
+		return get_obj('Sales Common').load_default_taxes(self)
+
+	# Get Other Charges Details
+	# --------------------------
+	def get_other_charges(self):
+		return get_obj('Sales Common').get_other_charges(self)
+		
+
+	# Get Advances
+	# -------------
+	def get_advances(self):
+		get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Advance Adjustment Detail', 'advance_adjustment_details', 'credit')
+
+	#pull project customer
+	#-------------------------
+	def pull_project_customer(self):
+		res = sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
+		if res:
+			get_obj('DocType Mapper', 'Project-Receivable Voucher').dt_map('Project', 'Receivable Voucher', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Receivable Voucher']]")
+
+# ********************************** Server Utility Functions ******************************
+	
+	# Get Company Abbr.
+	# ------------------
+	def get_company_abbr(self):
+		return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+		
+	
+	# Check whether sales order / delivery note items already pulled
+	#----------------------------------------------------------------
+	def validate_prev_docname(self,doctype):
+		for d in getlist(self.doclist, 'entries'): 
+			if doctype == 'delivery note' and self.doc.delivery_note_main == d.delivery_note:
+				msgprint(cstr(self.doc.delivery_note_main) + " delivery note details have already been pulled.")
+				raise Exception , "Validation Error. Delivery note details have already been pulled."
+			elif doctype == 'sales order' and self.doc.sales_order_main == d.sales_order and not d.delivery_note:
+				msgprint(cstr(self.doc.sales_order_main) + " sales order details have already been pulled.")
+				raise Exception , "Validation Error. Sales order details have already been pulled."
+
+
+	#-----------------------------------------------------------------
+	# ADVANCE ALLOCATION
+	#-----------------------------------------------------------------
+	def update_against_document_in_jv(self,against_document_no, against_document_doctype):
+		get_obj('GL Control').update_against_document_in_jv( self, 'advance_adjustment_details', against_document_no, against_document_doctype, self.doc.debit_to, 'credit', self.doc.doctype)
+	
+
+
+# ************************************* VALIDATE **********************************************
+	# Get Customer Name and address based on Debit To Account selected
+	# This case arises in case of direct RV where user doesn't enter customer name.
+	# Hence it should be fetched from Account Head.
+	# -----------------------------------------------------------------------------
+	#def get_customer_details(self):
+	#	get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 1)
+	#	self.get_cust_and_due_date()
+
+	
+	# Validate Customer Name with SO or DN if items are fetched from SO or DN
+	# ------------------------------------------------------------------------
+	def validate_customer(self):
+		for d in getlist(self.doclist,'entries'):
+			customer = ''
+			if d.sales_order:
+				customer = sql("select customer from `tabSales Order` where name = '%s'" % d.sales_order)[0][0]
+				doctype = 'sales order'
+				doctype_no = cstr(d.sales_order)
+			if d.delivery_note:
+				customer = sql("select customer from `tabDelivery Note` where name = '%s'" % d.delivery_note)[0][0]
+				doctype = 'delivery note'
+				doctype_no = cstr(d.delivery_note)
+			if customer and not cstr(self.doc.customer) == cstr(customer):
+				msgprint("Customer %s do not match with customer	of %s %s." %(self.doc.customer,doctype,doctype_no))
+				raise Exception , " Validation Error "
+		
+
+	# Validates Debit To Account and Customer Matches
+	# ------------------------------------------------
+	def validate_debit_to_acc(self):
+		if self.doc.customer and not cint(self.doc.is_pos):
+			acc_head = sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+			if acc_head and acc_head[0][0]:
+				if not cstr(acc_head[0][0]) == cstr(self.doc.debit_to):
+					msgprint("Debit To %s do not match with Customer %s for Company %s i.e. %s" %(self.doc.debit_to,self.doc.customer,self.doc.company,cstr(acc_head[0][0])))
+					raise Exception, "Validation Error "
+			if not acc_head:
+				 msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
+				 raise Exception, "Validation Error "
+
+
+	# Validate Debit To Account
+	# 1. Account Exists
+	# 2. Is a Debit Account
+	# 3. Is a PL Account
+	# ---------------------------
+	def validate_debit_acc(self):
+		acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
+		if not acc:
+			msgprint("Account: "+ self.doc.debit_to + " does not exist")
+			raise Exception
+		elif acc[0][0] and acc[0][0] != 'Debit':
+			msgprint("Account: "+ self.doc.debit_to + " is not a debit account")
+			raise Exception
+		elif acc[0][1] and acc[0][1] != 'No':
+			msgprint("Account: "+ self.doc.debit_to + " is a pl account")
+			raise Exception
+
+
+	# Validate Fixed Asset Account and whether Income Account Entered Exists
+	# -----------------------------------------------------------------------
+	def validate_fixed_asset_account(self):
+		for d in getlist(self.doclist,'entries'):
+			item = sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())"% d.item_code)
+			acc =	sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
+			if not acc:
+				msgprint("Account: "+d.income_account+" does not exist in the system")
+				raise Exception
+			elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
+				msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code)
+				raise Exception
+
+
+
+	# Set totals in words
+	#--------------------
+	def set_in_words(self):
+		self.doc.in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
+		self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
+
+	# Clear Advances
+	# --------------
+	def clear_advances(self):
+		get_obj('GL Control').clear_advances(self, 'Advance Adjustment Detail','advance_adjustment_details')
+
+
+	# set aging date
+	#-------------------
+	def set_aging_date(self):
+		if self.doc.is_opening != 'Yes':
+			self.doc.aging_date = self.doc.posting_date
+		elif not self.doc.aging_date:
+			msgprint("Aging Date is mandatory for opening entry")
+			raise Exception
+			
+
+	# Set against account for debit to account
+	#------------------------------------------
+	def set_against_income_account(self):
+		against_acc = []
+		for d in getlist(self.doclist, 'entries'):
+			if d.income_account not in against_acc:
+				against_acc.append(d.income_account)
+		self.doc.against_income_account = ','.join(against_acc)
+
+	def add_remarks(self):
+		if not self.doc.remarks: self.doc.remarks = 'No Remarks'
+
+	#check in manage account if sales order / delivery note required or not.
+	def so_dn_required(self):
+		dict = {'Sales Order':'so_required','Delivery Note':'dn_required'}
+		for i in dict:	
+			res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s'"%dict[i])
+			if res and res[0][0] == 'Yes':
+				for d in getlist(self.doclist,'entries'):
+					if not d.fields[i.lower().replace(' ','_')]:
+						msgprint("%s No. required against item %s"%(i,d.item_code))
+						raise Exception
+
+	#check for does customer belong to same project as entered..
+	#-------------------------------------------------------------------------------------------------
+	def validate_proj_cust(self):
+		if self.doc.project_name and self.doc.customer:
+			res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+			if not res:
+				msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
+				raise Exception
+
+	def validate_pos(self):
+		if not self.doc.cash_bank_account:
+			msgprint("Cash/Bank Account is mandatory for POS entry")
+			raise Exception
+		if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - flt(self.doc.grand_total))>0.001:
+			msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
+			raise Exception
+
+
+	# ********* UPDATE CURRENT STOCK *****************************
+	def update_current_stock(self):
+		for d in getlist(self.doclist, 'entries'):
+			bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
+
+	def validate_item_code(self):
+		for d in getlist(self.doclist, 'entries'):
+			if not d.item_code:
+				msgprint("Please enter Item Code at line no : %s to update stock for POS or remove check from Update Stock in Basic Info Tab." % (d.idx))
+				raise Exception
+
+	# Validate Write Off Account
+	# -------------------------------
+	def validate_write_off_account(self):
+		if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
+			msgprint("Please enter Write Off Account", raise_exception=1)
+
+	 
+	# VALIDATE
+	# ====================================================================================
+	def validate(self):
+		self.so_dn_required()
+		#self.dn_required()
+		self.validate_proj_cust()
+		sales_com_obj = get_obj('Sales Common')
+		sales_com_obj.check_stop_sales_order(self)
+		sales_com_obj.check_active_sales_items(self)
+		sales_com_obj.check_conversion_rate(self)
+		sales_com_obj.validate_max_discount(self, 'entries')	 #verify whether rate is not greater than tolerance
+		sales_com_obj.get_allocated_sum(self)	# this is to verify that the allocated % of sales persons is 100%
+		sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+		if not self.doc.customer:
+			get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
+		self.validate_customer()
+		self.validate_debit_to_acc()
+		self.validate_debit_acc()
+		self.validate_fixed_asset_account()
+		self.add_remarks()
+		if cint(self.doc.is_pos):
+			self.validate_pos()
+			self.validate_write_off_account()
+			if cint(self.doc.update_stock):
+				get_obj('Stock Ledger').validate_serial_no(self, 'entries')
+				self.validate_item_code()
+				self.update_current_stock()
+		self.set_in_words()
+		if not self.doc.is_opening:
+			self.doc.is_opening = 'No'
+		self.set_aging_date()
+		self.clear_advances()
+		# Set against account
+		self.set_against_income_account()
+
+		
+# *************************************************** ON SUBMIT **********************************************
+	# Check Ref Document's docstatus
+	# -------------------------------
+	def check_prev_docstatus(self):
+		for d in getlist(self.doclist,'entries'):
+			if d.sales_order:
+				submitted = sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
+				if not submitted:
+					msgprint("Sales Order : "+ cstr(d.sales_order) +" is not submitted")
+					raise Exception , "Validation Error."
+
+			if d.delivery_note:
+				submitted = sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
+				if not submitted:
+					msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
+					raise Exception , "Validation Error."
+
+	#Set Actual Qty based on item code and warehouse
+	#------------------------------------------------------
+	def set_actual_qty(self):
+		for d in getlist(self.doclist, 'delivery_note_details'):
+			if d.item_code and d.warehouse:
+				actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+				d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0					
+
+	# Check qty in stock depends on item code and warehouse
+	#-------------------------------------------------------
+	def check_qty_in_stock(self):
+		for d in getlist(self.doclist, 'entries'):
+			is_stock_item = sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
+			actual_qty = 0
+			if d.item_code and d.warehouse:
+				actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+				actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
+
+			if is_stock_item == 'Yes' and flt(d.qty) > flt(actual_qty):
+				msgprint("For Item: " + cstr(d.item_code) + " at Warehouse: " + cstr(d.warehouse) + " Quantity: " + cstr(d.qty) +" is not Available. (Must be less than or equal to " + cstr(actual_qty) + " )")
+				raise Exception, "Validation Error"
+
+	
+
+	# ********************** Make Stock Entry ************************************
+	def make_sl_entry(self, d, wh, qty, in_value, update_stock):
+		st_uom = sql("select stock_uom from `tabItem` where name = '%s'"%d.item_code)
+		self.values.append({
+			'item_code'					 : d.item_code,
+			'warehouse'					 : wh,
+			'transaction_date'		: self.doc.voucher_date,
+			'posting_date'				: self.doc.posting_date,
+			'posting_time'				: self.doc.posting_time,
+			'voucher_type'				: 'Receivable Voucher',
+			'voucher_no'					: cstr(self.doc.name),
+			'voucher_detail_no'	 : cstr(d.name), 
+			'actual_qty'					: qty, 
+			'stock_uom'					 : st_uom and st_uom[0][0] or '',
+			'incoming_rate'			 : in_value,
+			'company'						 : self.doc.company,
+			'fiscal_year'				 : self.doc.fiscal_year,
+			'is_cancelled'				: (update_stock==1) and 'No' or 'Yes',
+			'batch_no'						: cstr(d.batch_no),
+			'serial_no'					 : d.serial_no
+		})		
+			
+
+	# UPDATE STOCK LEDGER
+	# ---------------------------------------------------------------------------
+	def update_stock_ledger(self, update_stock, clear = 0):
+		self.values = []
+		for d in getlist(self.doclist, 'entries'):
+			stock_item = sql("SELECT is_stock_item, is_sample_item FROM tabItem where name = '%s'"%(d.item_code), as_dict = 1) # stock ledger will be updated only if it is a stock item
+			if stock_item[0]['is_stock_item'] == "Yes":
+				# Reduce actual qty from warehouse
+				self.make_sl_entry( d, d.warehouse, - flt(d.qty) , 0, update_stock)
+		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
+
+
+	#-------------------POS Stock Updatation Part----------------------------------------------
+	def pos_update_stock(self):
+		self.check_qty_in_stock()	
+		self.update_stock_ledger(update_stock = 1)
+	
+	# ********** Get Actual Qty of item in warehouse selected *************
+	def get_actual_qty(self,args):
+		args = eval(args)
+		actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
+		ret = {
+			 'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
+		}
+		return cstr(ret)
+
+	# Make GL Entries
+	# -------------------------
+	def make_gl_entries(self, is_cancel=0):
+		mapper = self.doc.is_pos and self.doc.write_off_account and 'POS with write off' or self.doc.is_pos and not self.doc.write_off_account and 'POS' or ''
+		update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes'
+
+		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist,cancel = is_cancel, use_mapper = mapper, update_outstanding = update_outstanding, merge_entries = cint(self.doc.is_pos) != 1 and 1 or 0)
+		
+
+	# On Submit
+	# ---------
+	def on_submit(self):
+		if cint(self.doc.is_pos) == 1:
+			if cint(self.doc.update_stock) == 1:
+				sl_obj = get_obj("Stock Ledger")
+				sl_obj.validate_serial_no_warehouse(self, 'entries')
+				sl_obj.update_serial_record(self, 'entries', is_submit = 1, is_incoming = 0)
+				self.pos_update_stock()
+		else:
+			self.check_prev_docstatus()
+			get_obj("Sales Common").update_prevdoc_detail(1,self)
+
+			# Check for Approving Authority
+			get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
+
+		# this sequence because outstanding may get -ve		
+		self.make_gl_entries()
+
+		if not cint(self.doc.is_pos) == 1:
+			self.update_against_document_in_jv(self.doc.name, self.doc.doctype)
+		
+		# on submit notification
+		# get_obj('Notification Control').notify_contact('Sales Invoice', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
+		
+			
+# *************************************************** ON 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_invoice = '%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):
+		if cint(self.doc.is_pos) == 1:
+			if cint(self.doc.update_stock) == 1:
+				get_obj('Stock Ledger').update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0)
+				self.update_stock_ledger(update_stock = -1)
+		else:
+			sales_com_obj = get_obj(dt = 'Sales Common')
+			sales_com_obj.check_stop_sales_order(self)
+			self.check_next_docstatus()
+			sales_com_obj.update_prevdoc_detail(0,self)
+
+		self.make_gl_entries(is_cancel=1)
+
+	# Get Warehouse
+	def get_warehouse(self):
+		w = sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
+		if not w:
+			ps = sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
+			if not ps:
+				msgprint("To make POS entry, please create POS Setting from Setup --> Accounts --> POS Setting and refresh the system.")
+				raise Exception
+			elif not ps[0][1]:
+				msgprint("Please enter warehouse in POS Setting")
+			else:
+				w = ps[0][1]
+		return w
+
+	# on update
+	def on_update(self):
+		# Set default warehouse from pos setting
+		#----------------------------------------
+		if cint(self.doc.is_pos) == 1:
+			self.set_actual_qty()
+			w = self.get_warehouse()
+			if w:
+				for d in getlist(self.doclist, 'entries'):
+					if not d.warehouse:
+						d.warehouse = cstr(w)
+
+			if flt(self.doc.paid_amount) == 0: 
+				set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
+
+		else:
+			set(self.doc,'paid_amount',0)
+
+		set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
+
+
+########################################################################
+# Repair Outstanding
+#######################################################################
+	def repair_rv_outstanding(self):
+		get_obj(dt = 'GL Control').repair_voucher_outstanding(self)
diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.txt b/accounts/doctype/receivable_voucher/receivable_voucher.txt
new file mode 100644
index 0000000..e389573
--- /dev/null
+++ b/accounts/doctype/receivable_voucher/receivable_voucher.txt
@@ -0,0 +1,3640 @@
+[
+	{
+		'_last_update': '1305629437',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': '1. Change in pull_details method dt.-26-06-2009',
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 16:20:36',
+		'modified_by': 'Guest',
+		'module': 'Accounts',
+		'name': 'Receivable Voucher',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 356
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-03-07 17:20:31',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00864',
+		'owner': 'umair@iwebnotes.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'testrole',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-03-07 17:20:53',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00865',
+		'owner': 'umair@iwebnotes.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'testrole',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:18',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00446',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:18',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00447',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:18',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00448',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:18',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00449',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:18',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-03-10 14:39:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00450',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Customer',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05333',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05334',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': 'INV',
+		'depends_on': 'eval:doc.retail_transaction!="Yes"',
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02753',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': '\nINV\nINV/10-11/',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-15 08:39:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_pos',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Is POS',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL04339',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_pos',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-15 08:39:22',
+		'default': '1',
+		'depends_on': 'eval:doc.is_pos==1',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'update_stock',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Update Stock',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL04340',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'update_stock',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'The account to which you will pay (have paid) the money to.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'debit_to',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Debit To',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02748',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'debit_to',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02749',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02750',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL05316',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Contact',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL03780',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL05317',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL05318',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL05319',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL05320',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05335',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': 'Today',
+		'depends_on': None,
+		'description': "This is the date on which this voucher is made in the system. Today's date comes by default.",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Voucher Date',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02754',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'voucher_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'Enter the date by which payments from customer is expected against this invoice.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'due_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Due Date',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02755',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'due_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02756',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-15 08:39:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Posting Time',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL04342',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02757',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02760',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Link',
+		'options': 'Receivable Voucher',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mode_of_payment',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Mode of Payment',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02795',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'mode_of_payment',
+		'oldfieldtype': 'Select',
+		'options': 'link:Mode of Payment',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02751',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Customer Group',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL05322',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05336',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'price_list_name',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Price List',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02784',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'price_list_name',
+		'oldfieldtype': 'Select',
+		'options': 'link:Price List',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select Items from Sales Order',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_main',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Sales Order',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02762',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_order_main',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select Items from Delivery Note',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_main',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Delivery Note',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02763',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'delivery_note_main',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02764',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05337',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Currency',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02758',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': '1.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Conversion Rate',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02759',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05338',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'entries',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Entries',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02765',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'entries',
+		'oldfieldtype': 'Table',
+		'options': 'RV Detail',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Re-Calculate Values',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02766',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'Will be calculated automatically when you enter the details',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Net Total*',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02767',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Rates HTML',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05339',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '* Rates in standard currency',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05340',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-15 08:39:22',
+		'default': None,
+		'depends_on': 'eval:doc.is_pos==1',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cash_bank_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Cash/Bank Account',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL04341',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cash_bank_account',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-15 08:39:22',
+		'default': None,
+		'depends_on': 'eval:doc.is_pos==1',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'paid_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Paid Amount',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL04343',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'paid_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05341',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-10 12:58:07',
+		'default': None,
+		'depends_on': 'eval:doc.is_pos==1',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'write_off_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Write Off Account',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': '000002962',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-10 12:58:07',
+		'default': None,
+		'depends_on': 'eval:doc.is_pos==1',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'write_off_cost_center',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Write Off Cost Center',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': '000002963',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Cost Center',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-10 12:58:07',
+		'default': None,
+		'depends_on': 'eval:doc.is_pos==1',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'write_off_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Write Off Amount',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': '000002964',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05342',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'charge',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Charge',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02771',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'charge',
+		'oldfieldtype': 'Link',
+		'options': 'Other Charges',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Get Charges',
+		'modified': '2011-05-25 12:45:14',
+		'modified_by': 'Guest',
+		'name': 'FL02772',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Taxes1',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02773',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges',
+		'oldfieldtype': 'Table',
+		'options': 'RV Tax Detail',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Total Charges',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02774',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Calculate Charges',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02775',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'Other Charges Calculation',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05343',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05344',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02778',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02779',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Server',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05345',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Term Details',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02781',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05346',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05347',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_opening',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': 1,
+		'label': 'Is Opening',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02785',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_opening',
+		'oldfieldtype': 'Select',
+		'options': 'No\nYes',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'aging_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'Aging Date',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02786',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'aging_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 10:23:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': None,
+		'label': 'Letter Head',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL04247',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'letter_head',
+		'oldfieldtype': 'Select',
+		'options': 'link:Letter Head',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'source',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': None,
+		'label': 'Source',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02790',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'source',
+		'oldfieldtype': 'Select',
+		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': "eval:doc.source == 'Campaign'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'campaign',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'Campaign',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02792',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'campaign',
+		'oldfieldtype': 'Link',
+		'options': 'Campaign',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02789',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:48:01',
+		'default': None,
+		'depends_on': None,
+		'description': 'Track this Sales Invoice against any Project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL03779',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05348',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02787',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 68,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02788',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02793',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02794',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05349',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05350',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': 1,
+		'label': 'Grand Total',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02798',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'Rounded Total',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02768',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rounded_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Sales Invoice.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 75,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02799',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_advance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 76,
+		'in_filter': None,
+		'label': 'Total Advance',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02800',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_advance',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'outstanding_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 77,
+		'in_filter': None,
+		'label': 'Outstanding Amount',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02801',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'outstanding_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 78,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05351',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 79,
+		'in_filter': None,
+		'label': 'Grand Total (Export)',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02803',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 80,
+		'in_filter': None,
+		'label': 'Rounded Total (Export)',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02804',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rounded_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words (Export) will be visible once you save the Sales Invoice.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_export',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 81,
+		'in_filter': None,
+		'label': 'In Words (Export)',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02805',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words_export',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'gross_profit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 82,
+		'in_filter': None,
+		'label': 'Gross Profit',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02806',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'gross_profit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'gross_profit_percent',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 83,
+		'in_filter': None,
+		'label': 'Gross Profit (%)',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02807',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'gross_profit_percent',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 84,
+		'in_filter': None,
+		'label': 'Advances',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05352',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 85,
+		'in_filter': None,
+		'label': 'Get Advances Received',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02809',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_advances',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'advance_adjustment_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 86,
+		'in_filter': None,
+		'label': 'Advance Adjustment Detail',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02810',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'advance_adjustment_details',
+		'oldfieldtype': 'Table',
+		'options': 'Advance Adjustment Detail',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 87,
+		'in_filter': None,
+		'label': 'Sales Team',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05353',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 88,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05354',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '45%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_partner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 89,
+		'in_filter': 1,
+		'label': 'Sales Partner',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02813',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_partner',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Partner',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'commission_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 90,
+		'in_filter': None,
+		'label': 'Commission Rate (%)',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02814',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'commission_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_commission',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 91,
+		'in_filter': None,
+		'label': 'Total Commission',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02815',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_commission',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 92,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL05355',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '55%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_team',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 93,
+		'in_filter': None,
+		'label': 'Sales Team1',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02817',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_team',
+		'oldfieldtype': 'Table',
+		'options': 'Sales Team',
+		'owner': 'Administrator',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 94,
+		'in_filter': None,
+		'label': 'Repair Outstanding Amt',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02821',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_rv_outstanding',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'against_income_account',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 95,
+		'in_filter': None,
+		'label': 'Against Income Account',
+		'modified': '2011-05-25 12:45:15',
+		'modified_by': 'Guest',
+		'name': 'FL02822',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'against_income_account',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Receivable Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/rv_detail/__init__.py b/accounts/doctype/rv_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/rv_detail/__init__.py
diff --git a/accounts/doctype/rv_detail/rv_detail.txt b/accounts/doctype/rv_detail/rv_detail.txt
new file mode 100644
index 0000000..3ce5546
--- /dev/null
+++ b/accounts/doctype/rv_detail/rv_detail.txt
@@ -0,0 +1,1035 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'INVD.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-30 11:19:58',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'RV Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 19
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Item',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02850',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 0,
+		'label': 'Item Name',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02851',
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02853',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-04 17:22:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_uom',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'UOM',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL04494',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Qty',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02855',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ref_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Ref Rate',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02856',
+		'no_copy': None,
+		'oldfieldname': 'ref_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'adj_rate',
+		'fieldtype': 'Float',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Discount (%)',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02857',
+		'no_copy': None,
+		'oldfieldname': 'adj_rate',
+		'oldfieldtype': 'Float',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'export_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Basic Rate',
+		'modified': '2011-04-18 13:55:31',
+		'modified_by': 'Administrator',
+		'name': 'FL02858',
+		'no_copy': None,
+		'oldfieldname': 'export_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'export_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02859',
+		'no_copy': None,
+		'oldfieldname': 'export_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'base_ref_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Ref Rate*',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02860',
+		'no_copy': None,
+		'oldfieldname': 'base_ref_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'basic_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 0,
+		'label': 'Basic Rate*',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02861',
+		'no_copy': None,
+		'oldfieldname': 'basic_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Amount*',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02862',
+		'no_copy': None,
+		'oldfieldname': 'amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 17:56:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Warehouse',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL04399',
+		'no_copy': None,
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'income_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Income Account',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02863',
+		'no_copy': None,
+		'oldfieldname': 'income_account',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '120px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_center',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Cost Center',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02864',
+		'no_copy': None,
+		'oldfieldname': 'cost_center',
+		'oldfieldtype': 'Link',
+		'options': 'Cost Center',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '120px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-15 16:42:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Serial No',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL04426',
+		'no_copy': None,
+		'oldfieldname': 'serial_no',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'batch_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Batch No',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': '000000137',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Batch',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Item Group',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02854',
+		'no_copy': None,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Brand Name',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02852',
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-23 11:49:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Available Qty at Warehouse',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL04429',
+		'no_copy': None,
+		'oldfieldname': 'actual_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 17:56:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivered_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Delivered Qty',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL04400',
+		'no_copy': None,
+		'oldfieldname': 'delivered_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': 1,
+		'label': 'Sales Order',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02865',
+		'no_copy': None,
+		'oldfieldname': 'sales_order',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'so_detail',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'SO Detail ',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02866',
+		'no_copy': None,
+		'oldfieldname': 'so_detail',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Delivery Note',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02867',
+		'no_copy': None,
+		'oldfieldname': 'delivery_note',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'dn_detail',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'DN Detail',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02868',
+		'no_copy': None,
+		'oldfieldname': 'dn_detail',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_tax_rate',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Item Tax Rate',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02869',
+		'no_copy': None,
+		'oldfieldname': 'item_tax_rate',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'clear_pending',
+		'fieldtype': 'Check',
+		'hidden': 1,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Clear Pending',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': 'FL02870',
+		'no_copy': 1,
+		'oldfieldname': 'clear_pending',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2011-04-18 13:55:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'page_break',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Page Break',
+		'modified': '2011-04-18 13:55:32',
+		'modified_by': 'Administrator',
+		'name': '000000138',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'RV Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/rv_tax_detail/__init__.py b/accounts/doctype/rv_tax_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/rv_tax_detail/__init__.py
diff --git a/accounts/doctype/rv_tax_detail/rv_tax_detail.txt b/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
new file mode 100644
index 0000000..0923a44
--- /dev/null
+++ b/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:23', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': 1, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'INVTD.######', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'RV Tax Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-12 12:09:24', 'doctype': 'DocField', 'oldfieldname': 'charge_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Type', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00502', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'charge_type', 'fieldtype': 'Select', 'options': '\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:24', 'doctype': 'DocField', 'oldfieldname': 'account_head', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Account Head', 'width': '', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00504', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'account_head', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-05-17 08:57:15', 'doctype': 'DocField', 'oldfieldname': 'cost_center_other_charges', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Cost Center', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05026', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'cost_center_other_charges', 'fieldtype': 'Link', 'options': 'Cost Center', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-03-12 12:09:24', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00503', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:24', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rate', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00505', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:24', 'doctype': 'DocField', 'oldfieldname': 'tax_amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amount*', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00506', 'idx': 6, 'default': '', 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'tax_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:09:24', 'doctype': 'DocField', 'oldfieldname': 'total', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Total*', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00507', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'total', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-27 18:49:14', 'doctype': 'DocField', 'oldfieldname': 'row_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Enter Row', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01484', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'row_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-04-23 12:35:40', 'doctype': 'DocField', 'oldfieldname': 'item_wise_tax_detail', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Wise Tax Detail ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01928', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'item_wise_tax_detail', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-26 17:28:47', 'doctype': 'DocField', 'oldfieldname': 'parenttype', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Parenttype', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'RV Tax Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02190', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'parenttype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:10:35', 'doctype': 'DocField', 'oldfieldname': 'total_tax_amount', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Total Tax Amount', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': 'Cheating Field\nPlease do not delete ', 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03857', 'idx': 11, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'total_tax_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-01-28 11:10:35', 'doctype': 'DocField', 'oldfieldname': 'total_amount', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Total Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': 'Cheating Field\nPlease do not delete ', 'parent': 'RV Tax Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03858', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-06-08 15:42:49', 'parenttype': 'DocType', 'fieldname': 'total_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/supplier_tds_category_detail/__init__.py b/accounts/doctype/supplier_tds_category_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/supplier_tds_category_detail/__init__.py
diff --git a/accounts/doctype/supplier_tds_category_detail/supplier_tds_category_detail.txt b/accounts/doctype/supplier_tds_category_detail/supplier_tds_category_detail.txt
new file mode 100644
index 0000000..928ddd7
--- /dev/null
+++ b/accounts/doctype/supplier_tds_category_detail/supplier_tds_category_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-06-15 16:18:15', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Supplier TDS Category Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-06-15 16:18:15', 'doctype': 'DocField', 'oldfieldname': 'tds_category', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'TDS Category', 'width': '300px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier TDS Category Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02337', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-06-15 17:01:44', 'parenttype': 'DocType', 'fieldname': 'tds_category', 'fieldtype': 'Select', 'options': 'link:TDS Category', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/tds_category/__init__.py b/accounts/doctype/tds_category/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_category/__init__.py
diff --git a/accounts/doctype/tds_category/tds_category.js b/accounts/doctype/tds_category/tds_category.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/accounts/doctype/tds_category/tds_category.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(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
new file mode 100644
index 0000000..2b0eb74
--- /dev/null
+++ b/accounts/doctype/tds_category/tds_category.py
@@ -0,0 +1,26 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+    
+  def 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
new file mode 100644
index 0000000..177e3c4
--- /dev/null
+++ b/accounts/doctype/tds_category/tds_category.txt
@@ -0,0 +1,266 @@
+[
+	{
+		'_last_update': '1300960461',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'field:category_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:43',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'last_update': '1294160993',
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-09-20 14:06:57',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'TDS Category',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 9
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:43',
+		'default': 'Accounts',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'module',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 0,
+		'label': 'Module',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00996',
+		'no_copy': None,
+		'oldfieldname': 'module',
+		'oldfieldtype': 'Link',
+		'options': 'Module Def',
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Note HTML',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': '000006316',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>Note:</b> You must first create the Accounts from the Chart of Accounts and then link it to this Category.',
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:43',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'category_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Category Name',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00998',
+		'no_copy': None,
+		'oldfieldname': 'category_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:43',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_sh_edu_cess_account',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'TDS Account Detail',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00999',
+		'no_copy': None,
+		'oldfieldname': 'tds_sh_edu_cess_account',
+		'oldfieldtype': 'Table',
+		'options': 'TDS Category Account',
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 17:30:43',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-11-30 17:30:43',
+		'modified_by': 'Administrator',
+		'name': 'PERM00112',
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-11-30 17:30:43',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-11-30 17:30:43',
+		'modified_by': 'Administrator',
+		'name': 'PERM00113',
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-11-30 17:30:43',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-11-30 17:30:43',
+		'modified_by': 'Administrator',
+		'name': 'PERM00114',
+		'owner': 'Administrator',
+		'parent': 'TDS Category',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/tds_category_account/__init__.py b/accounts/doctype/tds_category_account/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_category_account/__init__.py
diff --git a/accounts/doctype/tds_category_account/tds_category_account.txt b/accounts/doctype/tds_category_account/tds_category_account.txt
new file mode 100644
index 0000000..02a0f38
--- /dev/null
+++ b/accounts/doctype/tds_category_account/tds_category_account.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-06 14:05:43', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'wasim@webnotestech.com', 'document_type': None, 'name': 'TDS Category Account', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-05-06 14:05:43', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Category Account', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01996', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-10 11:17:57', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-06 14:05:43', 'doctype': 'DocField', 'oldfieldname': 'account_head', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Account Head', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Category Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01997', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-10 11:17:57', 'parenttype': 'DocType', 'fieldname': 'account_head', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/tds_control/__init__.py b/accounts/doctype/tds_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_control/__init__.py
diff --git a/accounts/doctype/tds_control/tds_control.js b/accounts/doctype/tds_control/tds_control.js
new file mode 100644
index 0000000..36e2660
--- /dev/null
+++ b/accounts/doctype/tds_control/tds_control.js
@@ -0,0 +1,94 @@
+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 == 'Payable Voucher':
+      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 `tabPayable Voucher` 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 == 'Payable Voucher':
+      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 `tabPayable Voucher` 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 '%s' >= t1.slab_from AND t1.category = '%s' AND t1.parent=t2.name and t2.applicable_from <= '%s' ORDER BY t2.applicable_from DESC LIMIT 1" % (total_billed, obj.doc.tds_category, obj.doc.posting_date), as_dict = 1)
+      
+      if slab:
+        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
\ No newline at end of file
diff --git a/accounts/doctype/tds_control/tds_control.py b/accounts/doctype/tds_control/tds_control.py
new file mode 100644
index 0000000..69588d8
--- /dev/null
+++ b/accounts/doctype/tds_control/tds_control.py
@@ -0,0 +1,114 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+
+  # ============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 == 'Payable Voucher':
+      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 `tabPayable Voucher` 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 == 'Payable Voucher':
+      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 `tabPayable Voucher` 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
new file mode 100644
index 0000000..ff2e9e4
--- /dev/null
+++ b/accounts/doctype/tds_control/tds_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-03-05 12:23:01', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'wasim@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 38, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'TDS Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-12-07 12:30:02', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/accounts/doctype/tds_detail/__init__.py b/accounts/doctype/tds_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_detail/__init__.py
diff --git a/accounts/doctype/tds_detail/tds_detail.txt b/accounts/doctype/tds_detail/tds_detail.txt
new file mode 100644
index 0000000..bae5014
--- /dev/null
+++ b/accounts/doctype/tds_detail/tds_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-02-22 15:27:11', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'wasim@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'wasim@webnotestech.com', 'document_type': None, 'name': 'TDS Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'wasim@webnotestech.com', 'name': 'PERM00682', 'parent': 'TDS Detail', 'read': 1, 'create': 0, 'creation': '2010-02-22 15:27:11', 'modified': '2010-02-22 15:30:13', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'wasim@webnotestech.com', 'name': 'PERM00683', 'parent': 'TDS Detail', 'read': 1, 'create': None, 'creation': '2010-02-22 15:27:11', 'modified': '2010-02-22 15:30:13', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'wasim@webnotestech.com', 'name': 'PERM00684', 'parent': 'TDS Detail', 'read': 1, 'create': None, 'creation': '2010-02-22 15:27:11', 'modified': '2010-02-22 15:30:13', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'wasim@webnotestech.com', 'name': 'PERM00685', 'parent': 'TDS Detail', 'read': 1, 'create': None, 'creation': '2010-02-22 15:27:11', 'modified': '2010-02-22 15:30:13', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-02-22 15:27:11', 'doctype': 'DocField', 'oldfieldname': 'tds_category', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'TDS Category', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04030', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-02-22 15:30:13', 'parenttype': 'DocType', 'fieldname': 'tds_category', 'fieldtype': 'Select', 'options': 'link:TDS Category', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-02-22 15:27:11', 'doctype': 'DocField', 'oldfieldname': 'special_tds_rate_applicable', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Special TDS Rate Applicable', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04031', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-02-22 15:30:13', 'parenttype': 'DocType', 'fieldname': 'special_tds_rate_applicable', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-02-22 15:27:11', 'doctype': 'DocField', 'oldfieldname': 'special_tds_rate', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Special TDS Rate(Section-197)\t', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04032', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-02-22 15:30:13', 'parenttype': 'DocType', 'fieldname': 'special_tds_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-02-22 15:27:11', 'doctype': 'DocField', 'oldfieldname': 'special_tds_limit', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Special TDS Limit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04033', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-02-22 15:30:13', 'parenttype': 'DocType', 'fieldname': 'special_tds_limit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/tds_payment/__init__.py b/accounts/doctype/tds_payment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_payment/__init__.py
diff --git a/accounts/doctype/tds_payment/tds_payment.js b/accounts/doctype/tds_payment/tds_payment.js
new file mode 100644
index 0000000..20a4f95
--- /dev/null
+++ b/accounts/doctype/tds_payment/tds_payment.js
@@ -0,0 +1,77 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  if(doc.company)get_server_fields('get_pan_tan','','',doc,cdt,cdn,1);
+  
+  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');
+  } 
+}
\ No newline at end of file
diff --git a/accounts/doctype/tds_payment/tds_payment.py b/accounts/doctype/tds_payment/tds_payment.py
new file mode 100644
index 0000000..c91a269
--- /dev/null
+++ b/accounts/doctype/tds_payment/tds_payment.py
@@ -0,0 +1,109 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,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 cstr(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.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 `tabPayable 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.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
new file mode 100644
index 0000000..0d1e782
--- /dev/null
+++ b/accounts/doctype/tds_payment/tds_payment.txt
@@ -0,0 +1,1362 @@
+[
+	{
+		'_last_update': '1300960463',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:43',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'last_update': '1294160989',
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-11-03 11:48:59',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'TDS Payment',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 225
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006325',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'From Date',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01007',
+		'no_copy': None,
+		'oldfieldname': 'from_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'To Date',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01008',
+		'no_copy': None,
+		'oldfieldname': 'to_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_category',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'TDS Category',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00706',
+		'no_copy': None,
+		'oldfieldname': 'tds_category',
+		'oldfieldtype': 'Link',
+		'options': 'TDS Category',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_category',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'TDS Category',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01009',
+		'no_copy': None,
+		'oldfieldname': 'tds_category',
+		'oldfieldtype': 'Link',
+		'options': 'TDS Category',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006326',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': 'TDSP/10-11/',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Series Setup',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Naming Series',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01011',
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'TDSP/10-11/\nTDSP/\nTDSP/11-12/\nTDSP',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-23 11:02:17',
+		'default': 'TDSP/10-11/',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Series Setup',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Naming Series',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': '000002588',
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'TDSP/10-11/\nTDSP/\nTDSP/11-12/\nTDSP',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01012',
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-23 10:53:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': '000000305',
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01013',
+		'no_copy': None,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01014',
+		'no_copy': None,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006327',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006328',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01017',
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'registration_details',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Registration Details',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00714',
+		'no_copy': None,
+		'oldfieldname': 'registration_details',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'registration_details',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Registration Details',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01018',
+		'no_copy': None,
+		'oldfieldname': 'registration_details',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:25:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Remark',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00474',
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Remark',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01019',
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006329',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006330',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>Please Update Cheque No., BSR Code, Challan ID no. after actual payment. Unless you do not get it in Form 16A.</b>',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cheque_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Cheque / DD No.',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00737',
+		'no_copy': None,
+		'oldfieldname': 'cheque_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cheque_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Cheque / DD No.',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01022',
+		'no_copy': None,
+		'oldfieldname': 'cheque_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bsr_code',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'BSR Code',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL00738',
+		'no_copy': None,
+		'oldfieldname': 'bsr_code',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bsr_code',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'BSR Code',
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'FL01023',
+		'no_copy': None,
+		'oldfieldname': 'bsr_code',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date_of_receipt',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Date of Receipt',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01024',
+		'no_copy': None,
+		'oldfieldname': 'date_of_receipt',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'challan_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Challan ID',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01025',
+		'no_copy': None,
+		'oldfieldname': 'challan_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Update',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01026',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'update_ack_details',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006331',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Get TDS List',
+		'modified': '2011-03-24 15:58:08',
+		'modified_by': 'Administrator',
+		'name': 'FL01028',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tds_list',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tds_payment_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'TDS Payment Details',
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01029',
+		'no_copy': None,
+		'oldfieldname': 'tds_payment_details',
+		'oldfieldtype': 'Table',
+		'options': 'TDS Payment Detail',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': '000006332',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_tds',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Total TDS',
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01031',
+		'no_copy': None,
+		'oldfieldname': 'total_tds',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-11-30 17:30:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Make Bank Voucher',
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01032',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 17:30:44',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00119',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-11-30 17:30:44',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00120',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-11-30 17:30:44',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00121',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-11-30 17:30:44',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00122',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-11-30 17:30:44',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-11-30 17:30:44',
+		'modified_by': 'Administrator',
+		'name': 'PERM00123',
+		'owner': 'Administrator',
+		'parent': 'TDS Payment',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/tds_payment_detail/__init__.py b/accounts/doctype/tds_payment_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_payment_detail/__init__.py
diff --git a/accounts/doctype/tds_payment_detail/tds_payment_detail.txt b/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
new file mode 100644
index 0000000..f973a8a
--- /dev/null
+++ b/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-25 16:52:54', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'TDS Payment Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-25 16:52:54', 'doctype': 'DocField', 'oldfieldname': 'voucher_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Voucher No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02155', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'voucher_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-25 16:52:54', 'doctype': 'DocField', 'oldfieldname': 'party_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Party Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02154', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'party_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-25 16:52:54', 'doctype': 'DocField', 'oldfieldname': 'amount_paid', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount paid / credited', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02156', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'amount_paid', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-05-25 16:52:54', 'doctype': 'DocField', 'oldfieldname': 'date_of_payment', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Date of payment / credit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02157', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'date_of_payment', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-25 16:52:54', 'doctype': 'DocField', 'oldfieldname': 'tds_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'TDS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02158', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'tds_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-11 15:45:56', 'doctype': 'DocField', 'oldfieldname': 'cess_on_tds', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Cess on TDS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05338', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'cess_on_tds', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-25 16:52:54', 'doctype': 'DocField', 'oldfieldname': 'total_tax_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Total Tax Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Payment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02162', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:34', 'parenttype': 'DocType', 'fieldname': 'total_tax_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/tds_rate_chart/__init__.py b/accounts/doctype/tds_rate_chart/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_rate_chart/__init__.py
diff --git a/accounts/doctype/tds_rate_chart/tds_rate_chart.txt b/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
new file mode 100644
index 0000000..9124207
--- /dev/null
+++ b/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
@@ -0,0 +1,266 @@
+[
+	{
+		'_last_update': '1300960463',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'Prompt',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:44',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'last_update': '1294160988',
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-09-20 14:06:57',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'TDS Rate Chart',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 0,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 12
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2009-05-12 11:19:12',
+		'default': 'Accounts',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'module',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Module',
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': 'FL00067',
+		'no_copy': None,
+		'oldfieldname': 'module',
+		'oldfieldtype': 'Link',
+		'options': 'Module Def',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:45',
+		'default': 'Accounts',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'module',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Module',
+		'modified': '2010-11-30 17:30:45',
+		'modified_by': 'Administrator',
+		'name': 'FL01040',
+		'no_copy': None,
+		'oldfieldname': 'module',
+		'oldfieldtype': 'Link',
+		'options': 'Module Def',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'applicable_from',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Applicable From',
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01041',
+		'no_copy': None,
+		'oldfieldname': 'applicable_from',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rate_chart_detail',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Rate Chart Detail',
+		'modified': '2011-03-24 15:58:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01042',
+		'no_copy': None,
+		'oldfieldname': 'rate_chart_detail',
+		'oldfieldtype': 'Table',
+		'options': 'TDS Rate Detail',
+		'owner': 'Administrator',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 17:30:45',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-11-30 17:30:45',
+		'modified_by': 'Administrator',
+		'name': 'PERM00124',
+		'owner': 'Administrator',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 17:30:45',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-11-30 17:30:45',
+		'modified_by': 'Administrator',
+		'name': 'PERM00125',
+		'owner': 'Administrator',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-11-30 17:30:45',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-11-30 17:30:45',
+		'modified_by': 'Administrator',
+		'name': 'PERM00126',
+		'owner': 'Administrator',
+		'parent': 'TDS Rate Chart',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/tds_rate_detail/__init__.py b/accounts/doctype/tds_rate_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_rate_detail/__init__.py
diff --git a/accounts/doctype/tds_rate_detail/tds_rate_detail.txt b/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
new file mode 100644
index 0000000..0a1cb24
--- /dev/null
+++ b/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-06 12:24:07', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 7, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'TDS Rate Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-06 12:24:07', 'doctype': 'DocField', 'oldfieldname': 'category', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Category', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Rate Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01976', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-30 15:37:49', 'parenttype': 'DocType', 'fieldname': 'category', 'fieldtype': 'Link', 'options': 'TDS Category', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-06 12:24:07', 'doctype': 'DocField', 'oldfieldname': 'slab_from', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Slab From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Rate Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01977', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-30 15:37:49', 'parenttype': 'DocType', 'fieldname': 'slab_from', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-05-06 12:24:07', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rate', 'width': '50px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Rate Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01978', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-30 15:37:49', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-30 15:37:49', 'doctype': 'DocField', 'oldfieldname': 'rate_without_pan', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rate without PAN', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Rate Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05508', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-30 15:37:49', 'parenttype': 'DocType', 'fieldname': 'rate_without_pan', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/doctype/tds_return_acknowledgement/__init__.py b/accounts/doctype/tds_return_acknowledgement/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/tds_return_acknowledgement/__init__.py
diff --git a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.js b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.js
new file mode 100644
index 0000000..82d84ea
--- /dev/null
+++ b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.js
@@ -0,0 +1,4 @@
+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.txt b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
new file mode 100644
index 0000000..afbdfcd
--- /dev/null
+++ b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-16 10:55:42', 'search_fields': None, 'module': 'Accounts', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 14, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'TDSR/.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'TDS Return Acknowledgement', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM01044', 'parent': 'TDS Return Acknowledgement', 'read': 1, 'create': 1, 'creation': '2010-06-16 11:01:13', 'modified': '2010-09-01 14:18:18', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM01045', 'parent': 'TDS Return Acknowledgement', 'read': 1, 'create': 1, 'creation': '2010-06-16 11:01:13', 'modified': '2010-09-01 14:18:18', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-16 10:59:31', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Return Acknowledgement', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05380', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:18', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-16 10:59:31', 'doctype': 'DocField', 'oldfieldname': 'quarter', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Quarter', 'width': None, 'trigger': 'Client', 'depends_on': '', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Return Acknowledgement', 'search_index': None, 'allow_on_submit': 0, 'icon': None, 'name': 'FL05379', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:18', 'parenttype': 'DocType', 'fieldname': 'quarter', 'fieldtype': 'Select', 'options': '\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-16 11:01:54', 'doctype': 'DocField', 'oldfieldname': 'tds_category', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'TDS Category', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Return Acknowledgement', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05382', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:18', 'parenttype': 'DocType', 'fieldname': 'tds_category', 'fieldtype': 'Select', 'options': 'link:TDS Category', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-16 10:59:31', 'doctype': 'DocField', 'oldfieldname': 'acknowledgement_no', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Acknowledgement No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Return Acknowledgement', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05381', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:18', 'parenttype': 'DocType', 'fieldname': 'acknowledgement_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-06-16 11:09:54', 'doctype': 'DocField', 'oldfieldname': 'date_of_receipt', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Date of Receipt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'TDS Return Acknowledgement', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05383', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-01 14:18:18', 'parenttype': 'DocType', 'fieldname': 'date_of_receipt', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/accounts/page/__init__.py b/accounts/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/page/__init__.py
diff --git a/accounts/page/accounts_browser/__init__.py b/accounts/page/accounts_browser/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/page/accounts_browser/__init__.py
diff --git a/accounts/page/accounts_browser/accounts_browser.comp.js b/accounts/page/accounts_browser/accounts_browser.comp.js
new file mode 100644
index 0000000..77948cf
--- /dev/null
+++ b/accounts/page/accounts_browser/accounts_browser.comp.js
@@ -0,0 +1,44 @@
+
+pscript['onload_Accounts Browser']=function(){var parent=$i('ab_body');parent.innerHTML='Please select your chart: '
+var sel=$a(parent,'select');add_sel_options(sel,['Account','Cost Center'],'Account');var btn=$btn(parent,'Go',function(){pscript.make_chart(sel_val(sel));},{marginTop:'8px'});}
+pscript.make_chart=function(b){pscript.chart_type=b;$i('ab_header').innerHTML='';$i('ab_body').innerHTML='';var comment=$a($i('ab_body'),'div','comment',{marginBottom:"8px"});comment.innerHTML="Note: Explore and click on the tree node to add a new child";var select_area=$a('ab_body','div','',{margin:'8px 0px'});var ac_main_grid=make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px",padding:"4px",tableLayout:"fixed",borderCollapse:"collapse"});$y($td(ac_main_grid,0,0),{border:"1px solid #dddddd",padding:"8px"});pscript.account_tree=$a($td(ac_main_grid,0,0),'div');$y($td(ac_main_grid,0,1),{border:"1px solid #DDD"});pscript.la=$a($td(ac_main_grid,0,1),'div');pscript.acc_period_bal=$a($td(ac_main_grid,0,1),'div');if(pscript.chart_type=='Account'){var footer=$a($i('ab_body'),'div','',{backgroundColor:"#FFD",padding:"8px",color:"#444",fontSize:"12px",marginTop:"14px"});var help1=$a(footer,'span');help1.innerHTML="<strong>Note:</strong> To create accounts for Customers and Suppliers, please create <a href='#Page/Selling'>Customer</a> and <a href='#Page/Buying'>Supplier</a>"
++" Masters. This will ensure that the accounts are linked to your Selling and Buying Processes. The Account Heads for Customer and Supplier will automatically be created."}
+var h1='Chart of '+pscript.chart_type+'s';if(pscript.chart_type=='Account')var d='accounting';else var d='cost center';var desc='Manage multiple companies and the '+d+' structures of each company.';$i('ab_body').page_head=new PageHeader('ab_header',h1,desc);var tab=make_table(select_area,1,2,null,[],{verticalAlign:'middle',padding:'2px'});$td(tab,0,0).innerHTML='Select Company'.bold();var sel=$a($td(tab,0,1),'select','',{width:'160px'});var set_tree=function(){if(pscript.ac_tree){pscript.ac_tree.body.innerHTML='';}
+pscript.make_ac_tree();var cn=sel_val(sel);var n=pscript.ac_tree.addNode(null,cn,null,pscript.ac_tree.std_onclick,pscript.ac_tree.std_onexp);n.rec={};n.rec.name='Root Node';n.rec.account_name=cn;n.rec.cost_center_name=cn;pscript.set_ac_head('',n.rec);$ds(pscript.ac_head_area);}
+add_sel_options(sel,['Loading...']);var callback=function(r,rt){empty_select(sel);add_sel_options(sel,r.message.cl,sys_defaults.company);set_tree();sel.onchange=function(){set_tree();}}
+$c_obj('GL Control','get_companies','',callback);pscript.ab_company_sel=sel;pscript.make_ac_head();pscript.make_group_area();pscript.make_ledger_area();pscript.make_new_acc_dialog();pscript.make_new_comp();pscript.make_new_cost_center_dialog();}
+pscript.make_new_comp=function(){$i('ab_body').page_head.add_button('New Company',function(){new_doc('Company');},0,'ui-icon-plus');}
+pscript.make_ac_tree=function(){var type=pscript.chart_type;var tree=new Tree(pscript.account_tree,'90%');pscript.ac_tree=tree;tree.std_onclick=function(node){pscript.cur_node=node;pscript.set_ac_head(node.parent_account,node.rec,type);}
+tree.std_onexp=function(node){if(node.expanded_once)return;$ds(node.loading_div);var callback=function(r,rt){$dh(node.loading_div);var n=tree.allnodes[r.message.parent_acc_name];var cl=r.message.cl;if(type=='Account'){for(var i=0;i<cl.length;i++){var imgsrc=null;var has_children=true;if(cl[i].group_or_ledger=='Ledger'){var imgsrc='images/icons/page.gif';has_children=false;}
+var t=tree.addNode(n,cl[i].account_name,imgsrc,tree.std_onclick,has_children?tree.std_onexp:null);t.rec=cl[i];t.parent_account=r.message.parent;}}
+else{for(var i=0;i<cl.length;i++){var imgsrc=null;var has_children=true;if(cl[i].group_or_ledger=='Ledger'){var imgsrc='images/icons/page.gif';has_children=false;}
+var t=tree.addNode(n,cl[i].cost_center_name,imgsrc,tree.std_onclick,has_children?tree.std_onexp:null);t.rec=cl[i];t.parent_account=r.message.parent;}}}
+if(type=='Account'){var arg=[node.rec.name,node.rec.account_name,sel_val(pscript.ab_company_sel),pscript.chart_type];}else{var arg=[node.rec.name,node.rec.cost_center_name,sel_val(pscript.ab_company_sel),pscript.chart_type];}
+$c_obj('GL Control','get_cl',arg.join(','),callback);}}
+pscript.make_ac_head=function(){var div=$a(pscript.la,'div','ac_head');div.main_head=$a(div,'h3','',{padding:'4px',margin:'0px',backgroundColor:'#EEEEEE',borderBottom:'1px solid #AAAAAA'});div.sub_head1=$a(div,'div');div.sub_head2=$a(div,'div');div.balance_area=$a(div,'div');$a(div.balance_area,'span','sectionHeading').innerHTML="Balance:";div.balance=$a(div.balance_area,'span','ac_balance');div.sub_head=$btn(div,'Edit',function(){loaddoc(this.dt,this.dn);});pscript.ac_head_area=div;}
+pscript.set_ac_head=function(parent_account,r,type){var d=pscript.ac_head_area;d.main_head.innerHTML=r.account_name;$ds(d.sub_head);$ds(d.balance_area);if(r.name!='Root Node'){if(type=='Account'){d.sub_head.dt='Account';d.sub_head.dn=r.name
+d.sub_head1.innerHTML=r.debit_or_credit+' - '+r.group_or_ledger;d.sub_head2.innerHTML='Group: '+parent_account;if(r.group_or_ledger=='Ledger'){$ds(pscript.ledger_area);$ds(pscript.gl_rep);$dh(pscript.cc_rep);$dh(pscript.group_area);}else{$dh(pscript.ledger_area);$ds(pscript.group_area);$ds(pscript.acc_add_btn);$dh(pscript.cc_add_btn);}
+d.balance.innerHTML=(sys_defaults.currency?sys_defaults.currency:'Rs')+' '+(r.balance?fmt_money(r.balance):'0.00');}
+else{$dh(d.balance_area);d.main_head.innerHTML=r.cost_center_name;d.sub_head.dt='Cost Center';d.sub_head.dn=r.name
+d.sub_head1.innerHTML='';d.sub_head2.innerHTML='Group: '+parent_account;if(r.group_or_ledger=='Ledger'){$ds(pscript.ledger_area);$dh(pscript.gl_rep);$ds(pscript.cc_rep);$dh(pscript.group_area);}else{$dh(pscript.ledger_area);$ds(pscript.group_area);$ds(pscript.cc_add_btn);$dh(pscript.acc_add_btn);}
+d.balance.innerHTML='';}}else{$dh(d.sub_head);$dh(pscript.ledger_area);$dh(pscript.group_area);$dh(d.balance_area);d.sub_head1.innerHTML='';d.sub_head2.innerHTML='Explore tree on your left to see details';}
+pscript.acc_period_bal.innerHTML='';}
+pscript.make_group_area=function(type){pscript.group_area=$a(pscript.la,'div','ac_ledger');ref_btn=$a(pscript.group_area,'div','',{fontSize:'14px',marginBottom:'8px',marginTop:'24px',fontWeight:'bold'});ref_btn.innerHTML='<img src="images/icons/page_refresh.gif" style="margin-right: 8px"><span class="link_type">Refresh Tree</span>';ref_btn.onclick=function(){pscript.cur_node.clear_child_nodes();pscript.cur_node.expand();}
+pscript.group_area.ref_btn=ref_btn;pscript.acc_add_btn=$btn(pscript.group_area,'+ Add a child Account',function(){pscript.new_acc_dialog.show();});pscript.cc_add_btn=$btn(pscript.group_area,'+ Add a child Cost Center',null);pscript.cc_add_btn.onclick=function(){pscript.cc_dialog.widgets['Create'].onclick=function(){if(!pscript.cc_dialog.widgets['New Cost Center Name'].value){msgprint('Please enter New Cost Center Name');return;}
+if(!sel_val(pscript.cc_dialog.widgets['Group or Ledger'])){msgprint('Please specify cost center is group or ledger');return;}
+args={'cost_center_name':pscript.cc_dialog.widgets['New Cost Center Name'].value,'parent_cost_center':pscript.cur_node.rec.name,'group_or_ledger':sel_val(pscript.cc_dialog.widgets['Group or Ledger']),'company_name':sel_val(pscript.ab_company_sel),'company_abbr':'','old_parent':''}
+$c_obj('GL Control','add_cc',docstring(args),function(r,rt){pscript.cc_dialog.widgets['New Cost Center Name'].value='';pscript.cc_dialog.hide();pscript.group_area.ref_btn.onclick();});}
+pscript.new_cost_center_dialog.show();}}
+pscript.make_ledger_area=function(){pscript.ledger_area=$a(pscript.la,'div','ac_ledger');pscript.gl_rep=$a(pscript.ledger_area,'div','',{fontSize:'14px',marginBottom:'8px',fontWeight:'bold'});pscript.gl_rep.innerHTML='<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Open Ledger</span>';pscript.gl_rep.onclick=function(){pscript.make_report('gl');}}
+pscript.make_report=function(flag){if(flag=='gl'){var callback=function(report){report.set_filter('GL Entry','Account',pscript.cur_node.rec.name)
+report.dt.run();}
+loadreport('GL Entry','General Ledger',callback);}}
+pscript.make_new_acc_dialog=function(){var d=new Dialog(300,400,'Create A New Account');d.make_body([['HTML','Heading'],['Data','New Account Name'],['Select','Group or Ledger','Specify whether the new account is a Ledger or Group'],['Select','Account Type','[Optional] Specify the type of this account'],['Data','Tax Rate','Specify the default tax rate'],['Select','Master Type','Specify the master type of this account'],['Button','Create']]);add_sel_options(d.widgets['Group or Ledger'],['Group','Ledger'],'Group');add_sel_options(d.widgets['Account Type'],['','Fixed Asset Account','Bank or Cash','Expense Account','Tax','Income Account','Chargeable'],'');add_sel_options(d.widgets['Master Type'],['NA','Supplier','Customer','Employee'],'NA');d.widgets['Group or Ledger'].onchange=function(){if(sel_val(this)=='Ledger')$ds(d.rows['Account Type']);else $dh(d.rows['Account Type']);}
+d.widgets['Account Type'].onchange=function(){if(sel_val(this)=='Tax'||sel_val(this)=='Chargeable')$ds(d.rows['Tax Rate']);else $dh(d.rows['Tax Rate']);}
+d.onshow=function(){$dh(this.rows['Account Type']);$dh(this.rows['Tax Rate']);this.widgets['Group or Ledger'].selectedIndex=0;this.widgets['Account Type'].selectedIndex=0;this.widgets['Master Type'].selectedIndex=0;d.widgets['New Account Name'].value='';d.widgets['Tax Rate'].value='';}
+d.widgets['Create'].onclick=function(){if(!d.widgets['New Account Name'].value){msgprint('Please enter New Account Name');return;}
+if(!sel_val(d.widgets['Master Type'])){msgprint('Please enter master type of this new account');return;}
+args={'account_name':d.widgets['New Account Name'].value,'parent_account':pscript.cur_node.rec.name,'group_or_ledger':sel_val(d.widgets['Group or Ledger']),'company':sel_val(pscript.ab_company_sel),'account_type':sel_val(d.widgets['Account Type']),'tax_rate':d.widgets['Tax Rate'].value,'master_type':sel_val(d.widgets['Master Type'])}
+$c_obj('GL Control','add_ac',docstring(args),function(r,rt){d.hide();pscript.group_area.ref_btn.onclick();});}
+pscript.new_acc_dialog=d;}
+pscript.make_new_cost_center_dialog=function(){pscript.cc_dialog=new Dialog(300,400,'Create A New Cost Center');pscript.cc_dialog.make_body([['HTML','Heading'],['Data','New Cost Center Name'],['Select','Group or Ledger','Specify whether the new cost center is a Ledger or Group'],['Button','Create']]);add_sel_options(pscript.cc_dialog.widgets['Group or Ledger'],['Group','Ledger'],'Group');pscript.new_cost_center_dialog=pscript.cc_dialog;}
\ No newline at end of file
diff --git a/accounts/page/accounts_browser/accounts_browser.css b/accounts/page/accounts_browser/accounts_browser.css
new file mode 100644
index 0000000..4a55dd3
--- /dev/null
+++ b/accounts/page/accounts_browser/accounts_browser.css
@@ -0,0 +1,9 @@
+h1 { padding: 8px 0px; margin: 0px; }
+#ledger_area { padding: 16px;}
+.ac_head { display: none; }
+.ac_head div { padding: 2px; }
+.ac_ledger { display: none; padding: 8px; margin-top: 8px; border-top: 1px solid #DDD; }
+.ac_balance { margin-left: 4px; font-size: 16px; font-weight: bold; background-color: #FFFAB0; }
+
+.ac_page_sel_tab { width:90%; background-color: #EEE; margin-bottom: 8px }
+.ac_page_sel_tab td { vertical-align: middle; padding: 3px; }
\ No newline at end of file
diff --git a/accounts/page/accounts_browser/accounts_browser.html b/accounts/page/accounts_browser/accounts_browser.html
new file mode 100644
index 0000000..8614f2c
--- /dev/null
+++ b/accounts/page/accounts_browser/accounts_browser.html
@@ -0,0 +1,4 @@
+<div class="layout_wrapper">
+<div id="ab_header"></div>
+<div id="ab_body" style="margin: 16px"></div>
+</div>
\ No newline at end of file
diff --git a/accounts/page/accounts_browser/accounts_browser.js b/accounts/page/accounts_browser/accounts_browser.js
new file mode 100644
index 0000000..369e319
--- /dev/null
+++ b/accounts/page/accounts_browser/accounts_browser.js
@@ -0,0 +1,403 @@
+pscript['onload_Accounts Browser'] = function(){
+  // if the user directly loads the page, ask to select the chart
+  var parent = $i('ab_body');
+  parent.innerHTML = 'Please select your chart: '
+  var sel = $a(parent,'select');
+  add_sel_options(sel, ['Account', 'Cost Center'], 'Account');
+  var btn = $btn(parent, 'Go', function() { pscript.make_chart(sel_val(sel)); }, {marginTop:'8px'});
+}
+
+pscript.make_chart = function(b) {
+  pscript.chart_type = b;
+  $i('ab_header').innerHTML ='';
+  $i('ab_body').innerHTML ='';
+
+  //===============comment area========================================
+  var comment = $a($i('ab_body'),'div','comment',{marginBottom:"8px"});
+  comment.innerHTML = "Note: Explore and click on the tree node to add a new child";
+  
+  var select_area = $a('ab_body', 'div', '', {margin:'8px 0px'});
+  
+  //================== table body======================================  
+  var ac_main_grid = make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px", padding:"4px",tableLayout: "fixed", borderCollapse: "collapse"});
+  $y($td(ac_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px"});
+  pscript.account_tree = $a($td(ac_main_grid,0,0),'div');
+  $y($td(ac_main_grid,0,1),{border: "1px solid #DDD"});
+  pscript.la = $a($td(ac_main_grid,0,1),'div');
+  pscript.acc_period_bal = $a($td(ac_main_grid,0,1),'div');
+  
+  //=====================footer area ==================================
+  if (pscript.chart_type == 'Account') {
+    var footer = $a($i('ab_body'),'div','',{backgroundColor: "#FFD", padding: "8px", color: "#444", fontSize: "12px", marginTop: "14px"});
+    
+    var help1 = $a(footer,'span');
+    help1.innerHTML = "<strong>Note:</strong> To create accounts for Customers and Suppliers, please create <a href='#Page/Selling'>Customer</a> and <a href='#Page/Buying'>Supplier</a>"
+      + " Masters. This will ensure that the accounts are linked to your Selling and Buying Processes. The Account Heads for Customer and Supplier will automatically be created."
+  }
+
+  // header and toolbar
+  // ------------------
+  
+  var h1 = 'Chart of '+pscript.chart_type+'s';
+  if(pscript.chart_type == 'Account') var d = 'accounting';
+  else var d = 'cost center';
+  var desc = 'Manage multiple companies and the '+d+' structures of each company.';
+  $i('ab_body').page_head = new PageHeader('ab_header',h1,desc);
+
+  // select company
+  // --------------
+  var tab = make_table(select_area, 1, 2, null, [], {verticalAlign:'middle', padding: '2px'});
+  $td(tab,0,0).innerHTML = 'Select Company'.bold();
+  var sel = $a($td(tab,0,1),'select','',{width:'160px'});
+
+  // set tree
+  var set_tree = function() {
+    if(pscript.ac_tree) {
+      pscript.ac_tree.body.innerHTML = '';
+    }
+    pscript.make_ac_tree();
+    var cn = sel_val(sel);
+    var n = pscript.ac_tree.addNode(null, cn, null,pscript.ac_tree.std_onclick, pscript.ac_tree.std_onexp);
+    n.rec = {}; 
+    n.rec.name = 'Root Node'; 
+    n.rec.account_name = cn;
+    n.rec.cost_center_name = cn;
+    pscript.set_ac_head('',n.rec);
+    $ds(pscript.ac_head_area);
+  }
+
+  // select company
+  add_sel_options(sel, ['Loading...']);
+  var callback = function(r,rt) {
+    empty_select(sel); 
+    add_sel_options(sel,r.message.cl,sys_defaults.company);
+    set_tree();
+    sel.onchange = function() { set_tree(); }
+  }
+  $c_obj('GL Control', 'get_companies', '', callback);
+
+  pscript.ab_company_sel = sel;
+
+  pscript.make_ac_head();
+  pscript.make_group_area();
+  pscript.make_ledger_area();
+  pscript.make_new_acc_dialog();
+  pscript.make_new_comp();
+  pscript.make_new_cost_center_dialog();
+
+}
+//New company link
+pscript.make_new_comp = function(){
+  $i('ab_body').page_head.add_button('New Company', function() { new_doc('Company'); }, 0, 'ui-icon-plus');
+}
+
+pscript.make_ac_tree = function() {
+  //var type= sel_val($i('chart_type'))
+  var type= pscript.chart_type;
+  var tree = new Tree(pscript.account_tree, '90%');
+  pscript.ac_tree = tree;
+
+  // on click
+  tree.std_onclick = function(node) {
+
+    
+    pscript.cur_node = node;
+
+    // show ledger
+    pscript.set_ac_head(node.parent_account, node.rec,type);
+  }
+
+  // on expand
+  tree.std_onexp = function(node) {
+    if(node.expanded_once)return;
+    $ds(node.loading_div);
+    //set_ac_head
+    var callback = function(r,rt) {
+
+      $dh(node.loading_div);
+      var n = tree.allnodes[r.message.parent_acc_name];
+
+      var cl = r.message.cl;
+
+      if(type=='Account'){
+        for(var i=0;i<cl.length;i++) {
+          var imgsrc=null;
+          var has_children = true;
+          if(cl[i].group_or_ledger=='Ledger') {
+            var imgsrc = 'images/icons/page.gif';
+            has_children = false;
+          }
+          var t = tree.addNode(n, cl[i].account_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
+          t.rec = cl[i];
+          t.parent_account = r.message.parent;
+        }
+      }
+      else{
+        for (var i=0;i<cl.length;i++){
+          var imgsrc=null;
+          var has_children = true;
+          if(cl[i].group_or_ledger=='Ledger') {
+            var imgsrc = 'images/icons/page.gif';
+            has_children = false;
+          }
+          var t = tree.addNode(n, cl[i].cost_center_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
+          t.rec = cl[i];
+          t.parent_account = r.message.parent;
+        }
+      }
+    }
+
+    if (type=='Account'){
+      var arg = [node.rec.name, node.rec.account_name, sel_val(pscript.ab_company_sel), pscript.chart_type];
+    } else{
+        var arg = [node.rec.name, node.rec.cost_center_name,sel_val(pscript.ab_company_sel), pscript.chart_type];
+    }
+
+    $c_obj('GL Control','get_cl',arg.join(','),callback);
+  }
+}
+
+pscript.make_ac_head = function() {
+  var div = $a(pscript.la,'div','ac_head');
+  div.main_head = $a(div,'h3','',{padding:'4px', margin:'0px',backgroundColor:'#EEEEEE',borderBottom:'1px solid #AAAAAA'});
+  
+  div.sub_head1 = $a(div,'div');
+  div.sub_head2 = $a(div,'div');
+  
+  div.balance_area = $a(div,'div');
+  $a(div.balance_area,'span','sectionHeading').innerHTML = "Balance:";
+  div.balance = $a(div.balance_area,'span','ac_balance');
+
+  div.sub_head = $btn(div,'Edit',function() { loaddoc(this.dt, this.dn); });
+  pscript.ac_head_area = div;
+}
+
+// Group / Ledger Area - set properties in the right column
+//---------------------------------------------------------
+
+pscript.set_ac_head = function(parent_account, r,type) {
+  var d = pscript.ac_head_area;
+  d.main_head.innerHTML = r.account_name;
+  $ds(d.sub_head);
+  $ds(d.balance_area);
+
+  if(r.name!='Root Node') {
+    // Account group/ledger area
+    if(type=='Account'){
+      d.sub_head.dt = 'Account'; d.sub_head.dn = r.name
+
+      d.sub_head1.innerHTML = r.debit_or_credit + ' - ' + r.group_or_ledger;
+      d.sub_head2.innerHTML = 'Group: ' + parent_account;
+      if(r.group_or_ledger=='Ledger') {
+        $ds(pscript.ledger_area);
+        $ds(pscript.gl_rep);
+        $dh(pscript.cc_rep);
+        $dh(pscript.group_area);
+      } else {
+        $dh(pscript.ledger_area);
+        $ds(pscript.group_area);
+        $ds(pscript.acc_add_btn);
+        $dh(pscript.cc_add_btn);
+      }
+      d.balance.innerHTML = (sys_defaults.currency ? sys_defaults.currency :'Rs')+ ' ' + (r.balance ? fmt_money(r.balance) :'0.00');
+    }
+    //cost center group/ledger area
+    else{
+      $dh(d.balance_area);
+      d.main_head.innerHTML = r.cost_center_name;
+      d.sub_head.dt = 'Cost Center'; d.sub_head.dn = r.name
+
+      d.sub_head1.innerHTML = '' ;
+      d.sub_head2.innerHTML = 'Group: ' + parent_account;
+      if(r.group_or_ledger=='Ledger') {
+        $ds(pscript.ledger_area);
+        $dh(pscript.gl_rep);
+        $ds(pscript.cc_rep);
+        $dh(pscript.group_area);
+      } else {
+        $dh(pscript.ledger_area);
+        $ds(pscript.group_area);
+        $ds(pscript.cc_add_btn);
+        $dh(pscript.acc_add_btn);
+      }
+
+      d.balance.innerHTML ='';
+    }
+  } else {
+    $dh(d.sub_head);
+    $dh(pscript.ledger_area);
+    $dh(pscript.group_area);
+    $dh(d.balance_area);
+    d.sub_head1.innerHTML = '';
+    d.sub_head2.innerHTML = 'Explore tree on your left to see details';
+  }
+  
+  pscript.acc_period_bal.innerHTML = '';
+}
+
+// Group Area
+// ----------
+
+pscript.make_group_area = function(type) {
+  pscript.group_area = $a(pscript.la,'div','ac_ledger');
+
+  // refresh
+   ref_btn = $a(pscript.group_area, 'div', '', {fontSize: '14px',marginBottom: '8px', marginTop: '24px', fontWeight: 'bold'});
+  ref_btn.innerHTML = '<img src="images/icons/page_refresh.gif" style="margin-right: 8px"><span class="link_type">Refresh Tree</span>';
+  ref_btn.onclick= function() {
+    pscript.cur_node.clear_child_nodes();
+    pscript.cur_node.expand();
+  }
+  pscript.group_area.ref_btn = ref_btn;
+
+  // button for acc adding
+  pscript.acc_add_btn = $btn(pscript.group_area, '+ Add a child Account', function(){ pscript.new_acc_dialog.show(); });
+
+  // button for cost center adding
+  pscript.cc_add_btn = $btn(pscript.group_area, '+ Add a child Cost Center', null);
+
+  //showing new cost center dialog
+  pscript.cc_add_btn.onclick = function(){
+
+    // check for cost center name & group or ledger
+    pscript.cc_dialog.widgets['Create'].onclick = function() {
+      if(!pscript.cc_dialog.widgets['New Cost Center Name'].value) {
+        msgprint('Please enter New Cost Center Name'); return;
+      }
+      if(!sel_val(pscript.cc_dialog.widgets['Group or Ledger'])) {
+        msgprint('Please specify cost center is group or ledger'); return;
+      }
+      //args making
+      args = {
+        'cost_center_name' : pscript.cc_dialog.widgets['New Cost Center Name'].value,
+        'parent_cost_center' : pscript.cur_node.rec.name,
+        'group_or_ledger' : sel_val(pscript.cc_dialog.widgets['Group or Ledger']),
+        'company_name' : sel_val(pscript.ab_company_sel),
+        'company_abbr': '',
+        'old_parent':''
+      }
+      
+      //create cost center -- server to gl control
+      $c_obj('GL Control', 'add_cc', docstring(args), function(r,rt) { 
+        pscript.cc_dialog.widgets['New Cost Center Name'].value='';
+        pscript.cc_dialog.hide();
+        pscript.group_area.ref_btn.onclick(); 
+      });
+    }
+    
+    pscript.new_cost_center_dialog.show();
+  }
+
+
+
+
+}
+
+// Ledger Area
+// ----------
+
+pscript.make_ledger_area = function() {
+  pscript.ledger_area = $a(pscript.la,'div','ac_ledger');
+
+  //General ledger report link
+  pscript.gl_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
+  pscript.gl_rep.innerHTML = '<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Open Ledger</span>';
+  pscript.gl_rep.onclick = function(){ pscript.make_report('gl'); }
+
+  //Budget report link
+  /*pscript.cc_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
+  pscript.cc_rep.innerHTML = '<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Budget vs Actual Analysis Report</span>';
+  pscript.cc_rep.onclick = function(){ pscript.make_report('budget'); }*/
+}
+
+pscript.make_report = function(flag){
+  if(flag=='gl'){
+    var callback = function(report){
+      report.set_filter('GL Entry', 'Account',pscript.cur_node.rec.name)
+      report.dt.run();
+    }
+    loadreport('GL Entry','General Ledger',callback);
+  }
+  /*else {
+    loadreport('Budget Detail','Periodical Budget Report',function(f){
+      f.set_filter('Cost Center','ID',pscript.cur_node.rec.name);
+      f.dt.run();
+    });
+  }*/
+}
+
+// New Account
+pscript.make_new_acc_dialog = function() {
+  var d = new Dialog(300,400,'Create A New Account');
+  d.make_body([
+    ['HTML','Heading'],
+    ['Data','New Account Name'],
+    ['Select','Group or Ledger','Specify whether the new account is a Ledger or Group'],
+    ['Select','Account Type','[Optional] Specify the type of this account'],
+    ['Data','Tax Rate','Specify the default tax rate'],
+		['Select','Master Type','Specify the master type of this account'],
+    ['Button','Create']
+  ]);
+
+  add_sel_options(d.widgets['Group or Ledger'], ['Group', 'Ledger'],'Group');
+  add_sel_options(d.widgets['Account Type'], ['', 'Fixed Asset Account','Bank or Cash','Expense Account','Tax','Income Account','Chargeable'], '');
+	add_sel_options(d.widgets['Master Type'], ['NA', 'Supplier','Customer','Employee'],'NA');
+	
+  // hide / show account type
+  d.widgets['Group or Ledger'].onchange = function() {
+    if(sel_val(this)=='Ledger')$ds(d.rows['Account Type']);
+    else $dh(d.rows['Account Type']);
+  }
+
+  // hide / show tax rate
+  d.widgets['Account Type'].onchange = function() {
+    if(sel_val(this)=='Tax' || sel_val(this)=='Chargeable')$ds(d.rows['Tax Rate']);
+    else $dh(d.rows['Tax Rate']);
+  }
+
+  d.onshow = function() {
+    $dh(this.rows['Account Type']);
+    $dh(this.rows['Tax Rate']);
+    this.widgets['Group or Ledger'].selectedIndex = 0;
+    this.widgets['Account Type'].selectedIndex = 0;
+		this.widgets['Master Type'].selectedIndex = 0;
+    d.widgets['New Account Name'].value = '';
+    d.widgets['Tax Rate'].value = '';
+  }
+
+  d.widgets['Create'].onclick = function() {
+    if(!d.widgets['New Account Name'].value) {
+      msgprint('Please enter New Account Name'); return;
+    }
+		if(!sel_val(d.widgets['Master Type'])) {
+      msgprint('Please enter master type of this new account'); return;
+    }
+    args = {
+      'account_name' : d.widgets['New Account Name'].value,
+      'parent_account' : pscript.cur_node.rec.name,
+      'group_or_ledger' : sel_val(d.widgets['Group or Ledger']),
+      'company' : sel_val(pscript.ab_company_sel),
+      'account_type' : sel_val(d.widgets['Account Type']),
+      'tax_rate' : d.widgets['Tax Rate'].value,
+      'master_type': sel_val(d.widgets['Master Type'])
+    }
+    $c_obj('GL Control', 'add_ac', docstring(args), function(r,rt) { d.hide(); pscript.group_area.ref_btn.onclick(); });
+  }
+  pscript.new_acc_dialog = d;
+
+}
+
+// New Cost Center
+pscript.make_new_cost_center_dialog = function(){
+  pscript.cc_dialog = new Dialog(300,400,'Create A New Cost Center');
+  pscript.cc_dialog.make_body([
+    ['HTML','Heading'],
+    ['Data','New Cost Center Name'],
+    ['Select','Group or Ledger','Specify whether the new cost center is a Ledger or Group'],
+    ['Button','Create']
+    ]);
+
+  add_sel_options(pscript.cc_dialog.widgets['Group or Ledger'], ['Group','Ledger'], 'Group');
+
+  pscript.new_cost_center_dialog = pscript.cc_dialog;
+}
diff --git a/accounts/page/accounts_browser/accounts_browser.txt b/accounts/page/accounts_browser/accounts_browser.txt
new file mode 100644
index 0000000..82da806
--- /dev/null
+++ b/accounts/page/accounts_browser/accounts_browser.txt
@@ -0,0 +1 @@
+[{'creation': '2009-03-12 12:09:24', 'module': 'Accounts', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'nabin@webnotestech.com', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Accounts Browser', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': '', 'name': 'Accounts Browser', 'idx': None, 'static_content': None, 'modified': '2010-11-18 17:00:21', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'nabin@webnotestech.com', 'name': 'PR000004', 'parent': 'Accounts Browser', 'creation': '2009-03-12 12:09:24', 'modified': '2010-11-18 17:00:21', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/accounts/page/financial_statements/__init__.py b/accounts/page/financial_statements/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/page/financial_statements/__init__.py
diff --git a/accounts/page/financial_statements/financial_statements.html b/accounts/page/financial_statements/financial_statements.html
new file mode 100644
index 0000000..6e69bc2
--- /dev/null
+++ b/accounts/page/financial_statements/financial_statements.html
@@ -0,0 +1,31 @@
+<div class="layout_wrapper">
+<div id="fs_header"></div>
+</div>
+<!--  table.statement td {    vertical-align: middle;  }  table.statement td select {    width: 100px;  }  table.stmt_table {    table-layout: fixed;    border-collapse: collapse;  }  table.stmt_table td {    vertical-align: middle;    padding: 2px;  }  td.stmt_level0 {    font-weight: bold;    font-size: 14px;    border-bottom: 1px solid #AAA;  }  td.stmt_level1 {    font-weight: bold;    font-size: 12px;  }  td.stmt_level2 {    font-size: 11px;  }  td.stmt_level3 {    font-size: 11px;  }  td.stmt_level4 {    font-size: 12px;    font-weight: bold;    border-bottom: 1px solid #000;  }  td.stmt_level5 {    color: BLUE;    font-size: 11px;  }  --> <!--
+<div style="border: 1px solid #cccccc; padding: 4px; margin-top: 8px; background-color: #eeeeee; width: 98%;">
+<table class="statement" border="0" cellspacing="2px">
+<tbody>
+<tr>
+<td>Statement:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_type"></select></td>
+<td>Company:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_company"></select></td>
+<td>Period Type:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_period"></select></td>
+<td>Fiscal Year:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_fiscal_year"></select></td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;">
+<div id="stmt_new"></div>
+</td>
+</tr>
+</tbody>
+</table>
+</div>
+--> <!--
+<div style="margin:10px 0px 10px 0px" mce_style="margin:10px 0px 10px 0px"><button class="button" onclick="pscript.print_statement();">Print</button></div>
+-->
+<div id="print_html">
+<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
+<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
+<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
+</div>
diff --git a/accounts/page/financial_statements/financial_statements.js b/accounts/page/financial_statements/financial_statements.js
new file mode 100644
index 0000000..da269cb
--- /dev/null
+++ b/accounts/page/financial_statements/financial_statements.js
@@ -0,0 +1,147 @@
+pscript['onload_Financial Statements'] = function() {
+	
+	// header and toolbar
+	var h = new PageHeader('fs_header','Financial Statements','Profit & Loss and Balance Sheet Builder across multiple years');
+	//$y(h.toolbar_area,{padding:'8px'});
+	
+	var dv = $a(h.toolbar_area,'div','',{margin:'4px 0px'});
+	
+	var t = make_table(dv,1,4,'640px', [], {padding:'4px', width:'160px'});
+	
+	var sel = $a($td(t,0,0),'select','',{width:'160px'});
+	sel.id = 'stmt_type';
+	
+	var sel = $a($td(t,0,1),'select','',{width:'160px'});
+	sel.id = 'stmt_company';
+	
+	var sel = $a($td(t,0,2),'select','',{width:'160px'});
+	sel.id = 'stmt_period';
+
+	var sel = $a($td(t,0,3),'select','',{width:'160px'});
+	sel.id = 'stmt_fiscal_year';
+
+	h.add_button('Create',function(){ pscript.stmt_new(); },0,'ui-icon-document');
+	h.add_button('Print', function(){ _p.go($i('print_html').innerHTML); }, 0, 'ui-icon-print');
+/*	
+	var btn = $a($td(t,1,0),'button');
+	btn.onclick = function(){ pscript.stmt_new(); }
+	btn.innerHTML = 'Create';
+	
+	var btn = $a($td(t,1,1),'button');
+	btn.onclick = function(){ alert('print'); }
+	btn.innerHTML = 'Print';
+
+  //Button to create new
+  var btn = $a('stmt_new', 'button');
+  btn.onclick = function() { pscript.stmt_new(); }
+  btn.innerHTML = 'Create';*/
+
+  // select for statement
+  add_sel_options($i('stmt_type'), ['Select Statement...','Balance Sheet','Profit & Loss']);
+
+  // select for companies
+  add_sel_options($i('stmt_company'), ['Loading Companies...']);
+
+
+  // load companies
+  $c_obj('MIS Control','get_comp','', function(r,rt) {    
+    // company
+    empty_select($i('stmt_company'));
+    add_sel_options($i('stmt_company'), add_lists(['Select Company...'], r.message.company), 'Select Company...');
+
+
+    // period
+    empty_select($i('stmt_period'));
+    //add_sel_options($i('stmt_period'), add_lists(['Select Period...'], r.message.period), 'Select period...');
+    add_sel_options($i('stmt_period'), add_lists(['Select Period...'], ['Annual', 'Quarterly', 'Monthly']), 'Select period...');
+    
+    // fiscal-year
+    empty_select($i('stmt_fiscal_year'));
+    add_sel_options($i('stmt_fiscal_year'), add_lists(['Select Year...'], r.message.fiscal_year), 'Select fiscal year...');
+  });
+
+}
+
+pscript.stmt_new = function(stmt,company_name,level,period,year) {
+    
+  $i('stmt_tree').innerHTML = 'Refreshing....';
+  $i('stmt_tree').style.display = 'block';
+  
+  var arg = {
+  	statement:sel_val($i('stmt_type'))
+  	,company:sel_val($i('stmt_company'))
+  	,period:sel_val($i('stmt_period'))
+  	,year:sel_val($i('stmt_fiscal_year'))
+  }
+
+  $c_obj('MIS Control', 'get_statement', docstring(arg), function(r,rt) {
+      var nl = r.message;
+      var t = $i('stmt_tree');
+      var stmt_type = sel_val($i('stmt_type'));
+      t.innerHTML = '';
+      var tab = $a($a(t, 'div'),'table','stmt_table');
+      tab.style.tableLayout = 'fixed';
+      tab.style.width = '100%';
+      
+      $i('stmt_title1').innerHTML = sel_val($i('stmt_company'));
+      $i('stmt_title2').innerHTML = sel_val($i('stmt_type')) + ' - ' +  sel_val($i('stmt_fiscal_year'));
+      for(i=0;i<nl.length;i++) {
+        tab.insertRow(i);
+        
+        tab.rows[i].style.height = '20px';
+        
+        // heads
+        var per = tab.rows[i].insertCell(0);
+ //       var acc_width = (sel_val($i('stmt_period'))=='Monthly')? 12 : 20;
+ //       per.style.width = acc_width+'%';
+        per.style.width = '150px';
+        per.innerHTML = pscript.space_reqd(nl[i][0])+cstr(nl[i][1]);
+        per.className = 'stmt_level' + nl[i][0];
+        
+        // Make Title Bold
+        if(nl[i][0] == 0 || nl[i][0] == 1 || nl[i][0] == 4){
+          per.innerHTML = (pscript.space_reqd(nl[i][0])+cstr(nl[i][1])+'').bold();
+          per.style.fontSize = '12px';
+        }
+
+        for(j=2;j<nl[i].length;j++){
+          var per = tab.rows[i].insertCell(j-1);
+//          per.style.width = (100-acc_width)/(nl[i].length-2) +'%';
+          per.style.width = '150px';
+          per.style.textAlign = "right";
+          per.className = 'stmt_level' + nl[i][0];
+          if (i==0) {
+            per.style.fontSize = '14px';
+            per.style.textAlign = "right";
+          }
+          if (nl[i][0]==5) {
+            if(flt(nl[i][j])<0.0) per.style.color = "RED";
+            else per.style.color = "GREEN";
+          }
+          if(nl[i][0] != 0){
+            if(nl[i][j]) {
+              if (i==0) per.innerHTML = (nl[i][j]+'').bold();
+              else if(nl[i][0] == 1 || nl[i][0] == 4) per.innerHTML = (cstr(fmt_money(nl[i][j]))+'').bold();
+              else per.innerHTML = fmt_money(nl[i][j])
+            } else
+              per.innerHTML = '-';
+          }
+        }
+      }
+    
+  });	
+  $i('stmt_tree').style.display = 'block';  
+}
+
+//printing statement
+pscript.print_statement = function(){
+  print_go($i('print_html').innerHTML);
+}
+
+//determine space to be given
+pscript.space_reqd = function(val){
+  if(val == 1) return '  ';
+  else if(val == 2) return '     ';
+  else if(val == 3) return '        ';
+  else return '';  
+}
\ No newline at end of file
diff --git a/accounts/page/financial_statements/financial_statements.txt b/accounts/page/financial_statements/financial_statements.txt
new file mode 100644
index 0000000..b8d972f
--- /dev/null
+++ b/accounts/page/financial_statements/financial_statements.txt
@@ -0,0 +1 @@
+[{'creation': '2009-03-12 12:09:24', 'module': 'Accounts', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Financial Statements', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': '', 'name': 'Financial Statements', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000005', 'parent': 'Financial Statements', 'creation': '2009-03-12 12:09:24', 'modified': '2010-04-08 12:28:01', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000016', 'parent': 'Financial Statements', 'creation': '2009-06-04 15:16:31', 'modified': '2010-03-29 13:40:15', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000051', 'parent': 'Financial Statements', 'creation': '2009-09-23 16:34:18', 'modified': '2010-03-29 13:40:15', 'doctype': 'Page Role', 'idx': 3, 'parenttype': 'Page', 'role': 'Accounts Manager', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/accounts/search_criteria/__init__.py b/accounts/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/__init__.py
diff --git a/accounts/search_criteria/account___inputs_rg_23_a___part_ii_wrong_one/__init__.py b/accounts/search_criteria/account___inputs_rg_23_a___part_ii_wrong_one/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/account___inputs_rg_23_a___part_ii_wrong_one/__init__.py
diff --git a/accounts/search_criteria/account___inputs_rg_23_a___part_ii_wrong_one/account___inputs_rg_23_a___part_ii_wrong_one.txt b/accounts/search_criteria/account___inputs_rg_23_a___part_ii_wrong_one/account___inputs_rg_23_a___part_ii_wrong_one.txt
new file mode 100644
index 0000000..f4101d4
--- /dev/null
+++ b/accounts/search_criteria/account___inputs_rg_23_a___part_ii_wrong_one/account___inputs_rg_23_a___part_ii_wrong_one.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company,GL Entry\x01Lft,GL Entry\x01Rgt',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Account - Inputs (R.G. 23 A - PART II) Wrong One',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-03-20 17:02:13',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'account_-_inputs_rg_23_a_-_part_ii_wrong_one',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_payable/__init__.py b/accounts/search_criteria/accounts_payable/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/accounts_payable/__init__.py
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.js b/accounts/search_criteria/accounts_payable/accounts_payable.js
new file mode 100644
index 0000000..0c3f88e
--- /dev/null
+++ b/accounts/search_criteria/accounts_payable/accounts_payable.js
@@ -0,0 +1,22 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
+  
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Payable Voucher', report_default:'Aging Date'});  
+  this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:30});
+  this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:45});
+  this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:60});
+  this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:90});
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default']=sys_defaults.year_start_date;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default']=dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
+
+  this.dt.set_no_limit(1);
+}
+
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.py b/accounts/search_criteria/accounts_payable/accounts_payable.py
new file mode 100644
index 0000000..53fff08
--- /dev/null
+++ b/accounts/search_criteria/accounts_payable/accounts_payable.py
@@ -0,0 +1,141 @@
+# Check mandatory filters
+# ------------------------------------------------------------------
+
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please select From Posting Date and To Posting Date ")
+  raise Exception
+else:
+  from_date = filter_values.get('posting_date')
+  to_date = filter_values.get('posting_date1')
+
+if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
+  msgprint("Please select aging ranges in no of days in 'More Filters' ")
+  raise Exception
+
+# validate Range
+range_list = ['range_1','range_2','range_3','range_4']
+for r in range(len(range_list)-1):
+  if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
+    msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
+    raise Exception
+
+  
+# Add columns
+# ------------------------------------------------------------------
+data = [['Aging Date','Date','80px',''],
+        ['Transaction Date','Date','80px',''],
+        ['Account','Data','120px',''],
+        ['Against Voucher Type','Data','120px',''],
+        ['Against Voucher','Data','120px',''],
+        ['Voucher Type','Data','120px',''],
+        ['Voucher No','Data','120px',''],
+        ['Remarks','Data','160px',''],
+        ['Supplier Type', 'Data', '80px', ''],
+        ['Due Date', 'Data', '80px', ''],
+        ['Bill No','Data','80px',''],
+        ['Bill Date','Data','80px',''],
+        ['Opening Amt','Currency','120px',''],
+        ['Outstanding Amt','Currency','120px',''],
+        ['Age (Days)', 'Currency', '150px', ''],
+        ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
+        [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
+        [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
+        [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
+        [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
+        
+
+for d in data:
+  colnames.append(d[0])
+  coltypes.append(d[1])
+  colwidths.append(d[2])
+  coloptions.append(d[3])
+  col_idx[d[0]] = len(colnames)-1
+  
+# ageing based on
+# ------------------------------------------------------------------
+aging_based_on = 'Aging Date'
+if filter_values.has_key('aging_based_on') and filter_values['aging_based_on']:
+  aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
+
+if  len(res) > 600 and from_export == 0:
+  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+  raise Exception
+
+
+# ------------------------------------------------------------------
+# main loop starts here
+# ------------------------------------------------------------------
+
+out = []
+total_booking_amt, total_outstanding_amt = 0,0
+
+for r in res:
+  # get supplier type
+  supplier_type = sql("select t1.supplier_type from tabSupplier t1, tabAccount t2 where t1.name = t2.account_name and t2.name = '%s'" % r[col_idx['Account']])
+  r.append(supplier_type and cstr(supplier_type[0][0]) or '')
+
+  outstanding_amt, booking_amt, due_date, bill_no, bill_date, cond = 0,0, '','','', ''
+
+  # if entry against Payable Voucher
+  if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Payable Voucher':
+    due_date, bill_no, bill_date = [cstr(t) for t in sql("select due_date,bill_no,bill_date from `tabPayable Voucher` where name = %s", r[col_idx['Voucher No']])[0]]
+
+    # get opening
+    booking_amt = sql("select credit from `tabGL Entry` where account = %s and voucher_no = %s and is_cancelled = 'No'", (r[col_idx['Account']], r[col_idx['Voucher No']]))
+    booking_amt = booking_amt and flt(booking_amt[0][0]) or 0
+
+    cond = " and against_voucher = '%s' and against_voucher is not null" % r[col_idx['Against Voucher']]
+
+  # if entry against JV & and not adjusted within period
+  elif r[col_idx['Against Voucher Type']] == 'Payable Voucher' and sql("select name from `tabPayable Voucher` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (r[col_idx['Against Voucher']], from_date, to_date)):
+    cond = " and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'" % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
+  
+  # if un-adjusted
+  elif not r[col_idx['Against Voucher']]:
+    cond = " and ((voucher_no = '%s' and ifnull(against_voucher, '') = '') or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))" % (r[col_idx['Voucher No']], r[col_idx['Voucher No']])
+
+  if cond:
+    outstanding_amt = flt(sql("select sum(ifnull(credit, 0))-sum(ifnull(debit, 0)) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No' and posting_date <= '%s' %s" % (r[col_idx['Account']], to_date, cond))[0][0] or 0)
+
+    # add to total outstanding
+    total_outstanding_amt += flt(outstanding_amt)
+
+    # add to total booking amount
+    if outstanding_amt and r[col_idx['Voucher Type']] == 'Payable Voucher' and r[col_idx['Against Voucher']]:
+      total_booking_amt += flt(booking_amt)
+
+  r += [due_date, bill_no, bill_date, booking_amt, outstanding_amt]
+  
+  # split into date ranges
+  val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0
+  if r[col_idx[aging_based_on]]:
+    diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
+    if diff < cint(filter_values['range_1']):
+      val_l1 = outstanding_amt
+    if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
+      val_l2 = outstanding_amt
+    if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
+      val_l3 = outstanding_amt
+    if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
+      val_l4 = outstanding_amt
+    if diff >= cint(filter_values['range_4']):
+      val_l5_above = outstanding_amt
+
+  r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
+
+  # Only show that entry which has outstanding
+  if abs(flt(outstanding_amt)) > 0.001:
+    out.append(r)
+    
+if  len(out) > 300 and from_export == 0:
+  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+  raise Exception
+
+
+# Append Extra rows to RES
+# ------------------------------------------------------------------
+t_row = ['' for i in range(len(colnames))]
+t_row[col_idx['Voucher No']] = 'Total'
+t_row[col_idx['Opening Amt']] = total_booking_amt
+t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
+out.append(t_row)
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.sql b/accounts/search_criteria/accounts_payable/accounts_payable.sql
new file mode 100644
index 0000000..d2dba06
--- /dev/null
+++ b/accounts/search_criteria/accounts_payable/accounts_payable.sql
@@ -0,0 +1,11 @@
+SELECT DISTINCT `tabGL Entry`.`Aging_date`,`tabGL Entry`.`transaction_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.remarks
+FROM `tabGL Entry`,`tabAccount` 
+WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s'
+ AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s'
+ AND `tabGL Entry`.`account` LIKE '%(account)s%%'
+ AND `tabGL Entry`.`company` LIKE '%(company)s%%'
+ AND ((ifnull(`tabGL Entry`.voucher_type,'') = 'Payable Voucher' and `tabGL Entry`.credit>0) OR `tabGL Entry`.voucher_type = 'Journal Voucher')
+ AND `tabGL Entry`.`is_cancelled` = 'No'
+ AND `tabAccount`.master_type = 'Supplier'
+ AND `tabAccount`.name = `tabGL Entry`.account
+ ORDER BY `tabGL Entry`.`posting_date`
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.txt b/accounts/search_criteria/accounts_payable/accounts_payable.txt
new file mode 100644
index 0000000..26f8199
--- /dev/null
+++ b/accounts/search_criteria/accounts_payable/accounts_payable.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': '',
+		'columns': 'GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
+		'creation': '2010-10-22 16:29:40',
+		'criteria_name': 'Accounts Payable',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','Payable Voucher\x01Aging Based On':'Posting Date','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-22 15:16:03',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'accounts_payable',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabGL Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_receivable/__init__.py b/accounts/search_criteria/accounts_receivable/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/accounts_receivable/__init__.py
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.js b/accounts/search_criteria/accounts_receivable/accounts_receivable.js
new file mode 100644
index 0000000..a51b8fb
--- /dev/null
+++ b/accounts/search_criteria/accounts_receivable/accounts_receivable.js
@@ -0,0 +1,22 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
+  
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Receivable Voucher', report_default:'Aging Date'});  
+  this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default']=sys_defaults.year_start_date;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default']=dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
+
+  this.dt.set_no_limit(1);
+}
+
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.py b/accounts/search_criteria/accounts_receivable/accounts_receivable.py
new file mode 100644
index 0000000..e6005a6
--- /dev/null
+++ b/accounts/search_criteria/accounts_receivable/accounts_receivable.py
@@ -0,0 +1,132 @@
+
+# Check mandatory filters
+#------------------------------
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
+  raise Exception
+else:
+  from_date = filter_values.get('posting_date')
+  to_date = filter_values.get('posting_date1')
+
+if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
+  msgprint("Please select aging ranges in no of days in 'Set Filters' section")
+  raise Exception
+
+# validate Range
+range_list = ['range_1','range_2','range_3','range_4']
+for r in range(len(range_list)-1):
+  if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
+    msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
+    raise Exception
+
+
+# Add columns
+# -----------
+data = [['Transaction Date','Date','80px',''],
+        ['Aging Date','Date','80px',''],
+        ['Account','Data','120px',''],
+        ['Against Voucher Type','Data','120px',''],
+        ['Against Voucher','Data','120px',''],
+        ['Voucher Type','Data','120px',''],
+        ['Voucher No','Data','120px',''],
+        ['Remarks','Data','160px',''],
+        ['Territory','Data','120px',''],
+        ['Due Date', 'Date', '80px', ''],
+        ['Opening Amt','Currency','120px',''],
+        ['Outstanding Amt','Currency','120px',''],
+        ['Age (Days)', 'Data', '60px', ''],
+        ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
+        [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
+        [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
+        [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
+        [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
+        
+
+for d in data:
+  colnames.append(d[0])
+  coltypes.append(d[1])
+  colwidths.append(d[2])
+  coloptions.append(d[3])
+  col_idx[d[0]] = len(colnames)-1
+  
+# ageing based on
+aging_based_on = filter_values.get('aging_based_on') and filter_values['aging_based_on'].split(NEWLINE)[-1] or 'Aging Date'
+
+if  len(res) > 600 and from_export == 0:
+  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+  raise Exception
+
+# ------------------------------------------------------------------
+# main loop starts here
+# ------------------------------------------------------------------
+
+out = []
+total_opening_amt,total_outstanding_amt = 0,0
+for r in res:
+  # get customer territory
+  terr = sql("select t1.territory from `tabCustomer` t1, `tabAccount` t2 where t1.name = t2.master_name and t2.name = '%s'" % r[col_idx['Account']])
+  r.append(terr and terr[0][0] or '')
+  
+  outstanding_amt, opening_amt, cond, due_date = 0,0, '', ''
+  # if entry against Receivable Voucher
+  if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Receivable Voucher':
+    # get due date
+    due_date = sql("select due_date from `tabReceivable Voucher` where name = '%s'" % r[col_idx['Against Voucher']])
+    due_date = due_date and cstr(due_date[0][0]) or ''
+
+    # get booking amt
+    opening_amt = sql("select debit from `tabGL Entry` where account = '%s' and voucher_no = '%s' and is_cancelled = 'No'" % (r[col_idx['Account']], r[col_idx['Voucher No']]))
+    opening_amt = opening_amt and flt(opening_amt[0][0]) or 0
+
+    cond =  "and against_voucher = '%s' and against_voucher is not null" % r[col_idx['Against Voucher']]
+
+  # if entry against JV & and not adjusted within period
+  elif r[col_idx['Against Voucher Type']] == 'Receivable Voucher' and sql("select name from `tabReceivable Voucher` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (r[col_idx['Against Voucher']], from_date, to_date)):
+    cond = " and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'" % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
+  # if entry against JV and unadjusted
+  elif not r[col_idx['Against Voucher']]:
+    cond = " and ((voucher_no = '%s' and ifnull(against_voucher, '') = '') or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))" % (r[col_idx['Voucher No']], r[col_idx['Voucher No']])
+  
+  if cond:
+    outstanding_amt = flt(sql("select ifnull(sum(debit),0) - ifnull(sum(credit),0) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No' and posting_date <= '%s' %s" % (r[col_idx['Account']], to_date, cond))[0][0] or 0)
+    # add to total outstanding
+    total_outstanding_amt += flt(outstanding_amt)
+    # add to total booking amount
+    if outstanding_amt and r[col_idx['Voucher Type']] == 'Receivable Voucher' and r[col_idx['Against Voucher']]:
+      total_opening_amt += flt(opening_amt)
+
+  r += [due_date, opening_amt, outstanding_amt]
+
+  #Ageing Outstanding
+  val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = 0
+  diff = 0
+  if r[col_idx[aging_based_on]]:
+    diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
+    if diff < cint(filter_values['range_1']):
+      val_l1 = outstanding_amt
+    if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
+      val_l2 = outstanding_amt
+    if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
+      val_l3 = outstanding_amt
+    if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
+      val_l4 = outstanding_amt
+    if diff >= cint(filter_values['range_4']):
+      val_l5_above = outstanding_amt
+  
+  r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
+
+  # Only show that entry which has outstanding
+  if abs(flt(outstanding_amt)) > 0.001:
+    out.append(r)
+
+if  len(out) > 300 and from_export == 0:
+  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+  raise Exception
+
+# Append Extra rows to RES
+if len(out) > 0:
+  t_row = ['' for i in range(len(colnames))]
+  t_row[col_idx['Voucher No']] = 'Total'
+  t_row[col_idx['Opening Amt']] = total_opening_amt
+  t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
+  out.append(t_row)
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.sql b/accounts/search_criteria/accounts_receivable/accounts_receivable.sql
new file mode 100644
index 0000000..e6a6801
--- /dev/null
+++ b/accounts/search_criteria/accounts_receivable/accounts_receivable.sql
@@ -0,0 +1,11 @@
+SELECT `tabGL Entry`.`transaction_date`,`tabGL Entry`.`aging_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.remarks
+FROM `tabGL Entry`,`tabAccount`
+WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s'
+ AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s'
+ AND `tabGL Entry`.`account` LIKE '%(account)s%%'
+ AND `tabGL Entry`.`company` LIKE '%(company)s%%'
+ AND ((`tabGL Entry`.voucher_type = 'Receivable Voucher' and `tabGL Entry`.debit>0) OR `tabGL Entry`.voucher_type = 'Journal Voucher')
+ AND `tabGL Entry`.`is_cancelled` = 'No'
+ AND `tabAccount`.master_type = 'Customer'
+ AND `tabAccount`.name = `tabGL Entry`.account
+ ORDER BY `tabGL Entry`.`posting_date`
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.txt b/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
new file mode 100644
index 0000000..ae1d51b
--- /dev/null
+++ b/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': '',
+		'columns': 'GL Entry\x01Posting Date,GL Entry\x01Transaction Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
+		'creation': '2010-10-19 10:32:38',
+		'criteria_name': 'Accounts Receivable',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Is Cancelled':'No','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-19 10:29:38',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'accounts_receivable',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabGL Entry`.`name`',
+		'sort_order': 'ASC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_clearance_report/__init__.py b/accounts/search_criteria/bank_clearance_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/bank_clearance_report/__init__.py
diff --git a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.js b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.js
new file mode 100644
index 0000000..00254bc
--- /dev/null
+++ b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.js
@@ -0,0 +1,34 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Voucher Type'].df.in_first_page = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Clearance Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;  		
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.in_first_page = 1;  		
+	
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Against Receivable'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'TDS Category'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Cost Center'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Against Payable'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'TDS Applicable'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Debit >='].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Debit <='].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Credit >='].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Credit <='].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'User Remark'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Voucher Date'].df.filter_hide = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Voucher Date'].df.filter_hide = 1;
+}
+
+this.mytabs.items['More Filters'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
new file mode 100644
index 0000000..b0506d9
--- /dev/null
+++ b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Journal Voucher\x01ID,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Credit,Journal Voucher\x01Clearance Date,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Bank Clearance report',
+		'custom_query': '',
+		'description': 'Bank Clearance report',
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-09 16:14:13',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'bank_clearance_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_reconciliation_statement/__init__.py b/accounts/search_criteria/bank_reconciliation_statement/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/bank_reconciliation_statement/__init__.py
diff --git a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.js b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.js
new file mode 100644
index 0000000..00b905e
--- /dev/null
+++ b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -0,0 +1,18 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+
+  this.dt.set_no_limit(1);
+}
+
+this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py
new file mode 100644
index 0000000..ed74d49
--- /dev/null
+++ b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -0,0 +1,46 @@
+#get company
+company = filter_values.get('company') or get_defaults()['company']
+
+# To date
+if not filter_values.get('clearance_date1'):
+  msgprint('Please enter To Clearance Date')
+  raise Exception
+else:
+  to_date = filter_values['clearance_date1']
+
+
+#Fiscal year and year start date
+#----------------------------------
+ysd, fiscal_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",to_date)[0]
+# Account
+if not filter_values.get('account'):
+  msgprint('Please select Account in filter section')
+  raise Exception
+else:
+  acc_name = filter_values.get('account')
+
+
+if len(res) > 300 and from_export == 0:
+  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+  raise Exception
+
+acc = sql("select debit_or_credit, is_pl_account, lft, rgt from tabAccount where name = '%s'" % acc_name)
+
+opening = get_obj('GL Control').get_as_on_balance(acc_name, fiscal_year, to_date, acc[0][0], acc[0][2], acc[0][3])[2]
+
+total_debit, total_credit = 0,0
+out = []
+
+for r in res:
+  total_debit = flt(total_debit) + flt(r[col_idx['Debit']])
+  total_credit = flt(total_credit) + flt(r[col_idx['Credit']])
+  out.append(r)
+
+if acc and acc[0][0] == 'Debit':
+  bank_bal = flt(opening)-flt(total_debit)+flt(total_credit)
+else:
+  bank_bal = flt(opening)+flt(total_debit)-flt(total_credit)
+
+out.append(['','','','','','<font color = "#000"><b>Balance as per Company Books: </b></font>', opening,'',''])
+out.append(['','','','','','<font color = "#000"><b>Amounts not reflected in Bank: </b></font>', total_debit,total_credit,''])
+out.append(['','','','','','<font color = "#000"><b>Balance as per Bank: </b></font>', bank_bal,'',''])
diff --git a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
new file mode 100644
index 0000000..91dc0cc
--- /dev/null
+++ b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "(`tabJournal Voucher Detail`.credit >= 0 or `tabJournal Voucher Detail`.credit is null)\n(`tabJournal Voucher`.cheque_no is not null or `tabJournal Voucher`.cheque_no != '')\n(ifnull(`tabJournal Voucher`.clearance_date, '0000-00-00') >'%(clearance_date1)s' or `tabJournal Voucher`.clearance_date is null or `tabJournal Voucher`.clearance_date = '0000-00-00')\n(`tabJournal Voucher`.posting_date <= '%(clearance_date1)s')",
+		'add_tab': None,
+		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher\x01Clearance Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Credit,Journal Voucher Detail\x01Against Account',
+		'creation': '2010-11-01 10:56:13',
+		'criteria_name': 'Bank Reconciliation Statement',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'clearance_date\nfiscal_year',
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-29 16:36:00',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'bank_reconciliation_statement',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabJournal Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report/__init__.py b/accounts/search_criteria/budget_variance_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report/__init__.py
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.js b/accounts/search_criteria/budget_variance_report/budget_variance_report.js
new file mode 100644
index 0000000..ed5adb1
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.js
@@ -0,0 +1,17 @@
+report.customize_filters = function() {
+
+  //this.hide_all_filters();
+  this.mytabs.items['Select Columns'].hide();
+  this.mytabs.items['More Filters'].hide();
+
+ 
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'});
+  this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
+  this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Period'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
+this.mytabs.items['Select Columns'].hide();
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.py b/accounts/search_criteria/budget_variance_report/budget_variance_report.py
new file mode 100644
index 0000000..2efca28
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.py
@@ -0,0 +1,173 @@
+# validate Filters
+flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period'}
+for f in flt_dict:
+  if not filter_values.get(f):
+    msgprint("Please Select " + cstr(flt_dict[f]))
+    raise Exception
+
+# Get Values from fliters
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+under = "GL Entry"
+based_on = "Cost Center"
+
+#add distributed id field
+col = []
+col.append([based_on,'Date','150px',''])
+col.append(['Budget Allocated','Currency','150px',''])
+col.append(['Distribution Id','Date','150px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  
+  col_idx[c[0]] = len(colnames)-1
+
+def make_child_lst(based_on,name):
+  rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
+  ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
+  chl ='('
+  flag = 1
+  for c in ch_name:
+    if flag == 1:
+     chl += "'%s'"%c[0]
+     flag = 2
+    else:
+      chl +=",'%s'"%c[0]
+
+  chl +=")"
+  return chl
+
+
+
+for r in res:
+    
+  cond1 =" t1.fiscal_year ='%s' and t1.parent=t2.name and t1.parenttype = '%s' and t1.docstatus !=2"
+  
+  q = "select t1.name from `tabBudget Detail` t1, `tab%s` t2 where "+cond1+" and t2.name = '%s'"
+  ch = sql(q%(based_on,fiscal_year,based_on,r[0].strip()))
+  q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
+  cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
+  if ch:
+                                                                                                                                                                                                     
+    qur = q1+cond2+cond1+" and t2.name = '%s'"
+    ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
+    
+
+  #----------------------------------------------------------------      
+  else:
+    node_lst = make_child_lst(based_on,r[0].strip())
+    qur = q1+cond1+' and '+cond2+" t2.name in %s"
+
+    ret_amt = sql(qur%(based_on,fiscal_year,based_on,node_lst))    
+
+  #----------------------------------------------------------------  
+  ret_dis_id = sql("select distribution_id from `tab%s` where name = '%s'"%(based_on,r[0].strip()))
+
+  target_amt = ret_amt and flt(ret_amt[0][0]) or 0
+  dis_id = ret_dis_id and ret_dis_id[0][0] or ''
+
+  r.append(target_amt)
+  r.append(dis_id)
+  
+
+
+# Set required field names 
+based_on_fn = 'cost_center'
+
+date_fn  = 'posting_date' 
+
+mon_list = []
+
+data = {'start_date':0, 'end_date':1}
+
+def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
+  count = 1
+  if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
+  for m in range(12):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+    
+    # make mon_list for Monthly Period
+    if period == 'Monthly' :
+      mon_list.append([start_date, last_date])
+      # add months as Column names
+      month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+      append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
+      
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+    
+    # make mon_list for Quaterly Period
+    if period == 'Quarterly' and count % 3 == 0: 
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column names
+      append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    
+    # make mon_list for Half Yearly Period
+    if period == 'Half Yearly' and count % 6 == 0 :
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+
+    # make mon_list for Annual Period
+    if period == 'Annual' and count % 12 == 0:
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
+    count = count +1
+
+def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
+  col = ['Target', 'Actual', 'Variance']
+  for c in col:
+    n = str(name) and ' (' + str(name) +')' or ''
+    colnames.append(str(c) + n)
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(c) + n ] = len(colnames) - 1
+
+
+
+# make default columns
+#coltypes[col_idx[based_on]] = 'Link'
+#coloptions[col_idx[based_on]]= based_on
+
+# get start date
+start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
+if not start_date:
+  msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
+  raise Exception
+start_date = start_date.strftime('%Y-%m-%d')
+
+# make month list and columns
+make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
+
+
+bc_obj = get_obj('Budget Control')
+for r in res:
+  count = 0
+
+  for idx in range(3, len(colnames), 3):
+    cidx = 2
+
+    # ================= Calculate Target ==========================================
+    r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
+    
+    #================== Actual Amount =============================================
+    actual = 0
+
+    ch = make_child_lst(based_on,r[0].strip())
+   
+    actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t2.is_pl_account = 'Yes' and t1.is_cancelled = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+   
+    #----------------------------------------------------------
+    actual = flt(actual[0][0])
+    r.append(actual)
+    # ================ Variance ===================================================
+    r.append(r[idx] - r[idx + 1])
+    count = count +1
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
new file mode 100644
index 0000000..d53f7e1
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
@@ -0,0 +1 @@
+SELECT CONCAT(REPEAT('     ', COUNT(parent.name) - 1), node.name) AS name FROM `tabCost Center` AS node,`tabCost Center` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.txt b/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
new file mode 100644
index 0000000..688b64a
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Budget Variance Report',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Budget Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Budget Detail\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-01 15:05:50',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'budget_variance_report',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Cost Center',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabCost Center`.`lft`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report1/__init__.py b/accounts/search_criteria/budget_variance_report1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report1/__init__.py
diff --git a/accounts/search_criteria/budget_variance_report1/budget_variance_report1.js b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.js
new file mode 100644
index 0000000..b7cd6e4
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.js
@@ -0,0 +1,9 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, parent:'Budget Detail'});
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Budget Detail'});
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'});
+  this.add_filter({fieldname:'cost_center', label:'Cost Center', fieldtype:'Link', options:'Cost Center', parent:'Budget Detail'});
+  this.add_filter({fieldname:'account_head', label:'Account', fieldtype:'Link', options:'Account', parent:'Budget Detail'});
+}
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report1/budget_variance_report1.py b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.py
new file mode 100644
index 0000000..97a0c22
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.py
@@ -0,0 +1,88 @@
+# use This in Query 
+# AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`is_pl_account` = "Yes"
+
+
+
+# validate Filters
+if not filter_values.get('fiscal_year'):
+  msgprint("Please Select Fiscal Year")
+  raise Exception
+if not filter_values.get('period'):
+  msgprint("Please Select Period")
+  raise Exception
+  
+# Get Values from fliters 
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+
+mon_list = []
+data = {'start_date':0, 'end_date':1}
+def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
+  count = 1
+  if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
+  for m in range(12):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+    
+    # make mon_list
+    if period == 'Monthly' :
+      mon_list.append([start_date, last_date])
+      # add months as Column names
+      month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+      append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
+      
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+    if period == 'Quarterly' and count % 3 == 0: 
+     
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column names
+      append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    
+    if period == 'Half Yearly' and count % 6 == 0 :
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    if period == 'Annual' and count % 12 == 0:
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
+    count = count +1
+
+def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
+  col = ['Budget', 'Actual', 'Variance']
+  for c in col:
+    colnames.append(str(c) + ' (' + str(name) +')' )
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(c) + ' (' + str(name) +')' ] = len(colnames) - 1
+
+col = ['Cost Center', 'Account', 'Budget Allocated', 'Distribution Id']
+for c in col:
+  colnames.append(str(c))
+  coltypes.append((c=='Budget Allocated') and'Currency' or 'Link')
+  colwidths.append('150px')
+  coloptions.append((c=='Budget Allocated') and '' or (c == 'Distribution Id') and 'Budget Distribution' or c) 
+  col_idx[str(c)] = len(colnames) - 1
+
+start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
+if not start_date:
+  msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
+  raise Exception
+start_date = start_date.strftime('%Y-%m-%d')
+make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
+
+# Get Object Of GL Control
+
+glc_obj = get_obj('GL Control')
+bc_obj = get_obj('Budget Control')
+
+for r in res:
+  count = 0
+  for idx in range(4, len(colnames), 3):
+    r.append(bc_obj.get_monthly_budget( r[3], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[2]))
+    r.append(glc_obj.get_period_difference(r[1] + '~~~' + mon_list[count][data['start_date']] + '~~~' + mon_list[count][data['end_date']], r[0]))
+    r.append(r[idx] - r[idx + 1])
+    count = count +1
diff --git a/accounts/search_criteria/budget_variance_report1/budget_variance_report1.sql b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.sql
new file mode 100644
index 0000000..98b71dc
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.sql
@@ -0,0 +1 @@
+select t2.name, t1.account, t1.budget_allocated, t1.distribution_id from `tabBudget Detail` t1, `tabCost Center` t2 where t1.fiscal_year = '%(fiscal_year)s' and t1.parent = t2.name and t2.name like '%(cost_center)s%%' and t1.account like '%(account_head)s%%' and t2.docstatus != 2
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report1/budget_variance_report1.txt b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.txt
new file mode 100644
index 0000000..5f13673
--- /dev/null
+++ b/accounts/search_criteria/budget_variance_report1/budget_variance_report1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Cost Center\x01ID,Budget Detail\x01Account,Budget Detail\x01Fiscal Year,Budget Detail\x01Budget Allocated,Budget Detail\x01Actual,Budget Detail\x01Distribution ID',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Budget Variance Report1',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Budget Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Budget Detail\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-07-28 14:52:44',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'budget_variance_report1',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Cost Center',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabCost Center`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/business_associate_commission_report/__init__.py b/accounts/search_criteria/business_associate_commission_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/business_associate_commission_report/__init__.py
diff --git a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
new file mode 100644
index 0000000..99e3b05
--- /dev/null
+++ b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
@@ -0,0 +1,10 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].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/business_associate_commission_report/business_associate_commission_report.py b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py
new file mode 100644
index 0000000..0ab2c62
--- /dev/null
+++ b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py
@@ -0,0 +1,10 @@
+colwidths[col_idx['Business Associate']] = '200px'
+
+coltypes[col_idx['Average Commission Rate']] = 'Currency'
+colwidths[col_idx['Average Commission Rate']] = '200px'
+
+coltypes[col_idx['Net Total']] = 'Currency'
+colwidths[col_idx['Net Total']] = '150px'
+
+coltypes[col_idx['Total Commission']] = 'Currency'
+colwidths[col_idx['Total Commission']] = '150px'
\ No newline at end of file
diff --git a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
new file mode 100644
index 0000000..f68295a
--- /dev/null
+++ b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabReceivable Voucher`.`total_commission`) AS 'Total Commission'\nSUM(`tabReceivable Voucher`.`net_total`) AS 'Net Total'\n((SUM(`tabReceivable Voucher`.`total_commission`) / SUM(`tabReceivable Voucher`.`net_total`)) * 100) AS 'Average Commission Rate'",
+		'add_cond': '`tabReceivable Voucher`.`net_total` > 0\n`tabReceivable Voucher`.`total_commission` > 0',
+		'add_tab': None,
+		'columns': 'Receivable Voucher\x01Business Associate',
+		'creation': '2010-08-26 11:52:27',
+		'criteria_name': 'Business Associate Commission Report',
+		'custom_query': '',
+		'description': 'Track total commission given to your Business Associate',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabReceivable Voucher`.sales_partner',
+		'idx': None,
+		'modified': '2010-08-26 11:49:50',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'business_associate_commission_report',
+		'owner': 'saumil@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/cash_flow_statement/__init__.py b/accounts/search_criteria/cash_flow_statement/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/cash_flow_statement/__init__.py
diff --git a/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js
new file mode 100644
index 0000000..558dc78
--- /dev/null
+++ b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js
@@ -0,0 +1,18 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'show_group_balance', label:'Show Group Balance', fieldtype:'Select', options:NEWLINE+'Yes'+NEWLINE+'No',ignore : 1, parent:'Account'});
+  this.add_filter({fieldname:'level', label:'Level', fieldtype:'Data', default:3,ignore : 1, parent:'Account'});
+  
+  this.add_filter({fieldname:'from_date', label:'Date', fieldtype:'Date', parent:'Account'});
+
+  
+  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  //this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
+  //this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
+
+  //this.large_report = 1;
+}
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py
new file mode 100644
index 0000000..dea1120
--- /dev/null
+++ b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py
@@ -0,0 +1,110 @@
+cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Opening','Data', '100px'],['Closing', 'Data', '100px'],['Inc in Cash','Data','100px']]
+
+for c in cl:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append('')
+  col_idx[c[0]] = len(colnames)-1
+  
+
+company = filter_values['company']
+
+# transaction date
+if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'):
+  msgprint("Please enter From Date and To Date")
+  raise Exception
+else:
+  from_date = add_days(filter_values['transaction_date'], -1)
+  to_date = filter_values['transaction_date1']
+
+ysd, fiscal_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
+
+
+if from_export == 0 and len(res) >250:
+  msgprint("This is very large report and cannot be shown in the browser as it is likely to make your browser very slow. Please click on 'Export' to open in excel")
+  raise Exception
+
+total_debit, total_credit, total = 0,0,0
+glc = get_obj('GL Control')
+
+for r in res:
+  acc = r[col_idx['Account']].strip()
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
+  r.append(acc_det[0][0])
+  r.append(acc_det[0][4])
+
+  opening = glc.get_as_on_balance(acc, fiscal_year, from_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+  
+  amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3]))
+  if acc_det[0][0] == 'Debit':
+    closing = opening + flt(amount[0][0]) - flt(amount[0][1])
+  else:
+    closing = opening + flt(amount[0][1]) - flt(amount[0][0])
+  
+  r.append(fmt_money(flt(opening)))
+  r.append(fmt_money(flt(closing)))
+
+  diff = flt(closing) - flt(opening)
+  if acc_det[0][0]=='Debit':
+    r.append(fmt_money(-diff))
+    total -= diff
+  else:
+    r.append(fmt_money(diff))
+    total += diff
+  
+
+# net profit
+# ------------------
+
+acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where account_name = %s AND company=%s", ('Income',company))
+amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3]))
+net_income = flt(amount[0][1]) - flt(amount[0][0])
+
+acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where account_name = %s AND company=%s", ('Expenses',company))
+amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3]))
+net_expenses = flt(amount[0][0]) - flt(amount[0][1])
+
+t_row = ['' for i in range(len(colnames))]
+t_row[col_idx['Account']] = 'Net Profit'
+t_row[col_idx['Inc in Cash']] = fmt_money(net_income - net_expenses)
+
+total += net_income - net_expenses
+
+res.append(t_row)
+
+# total row
+# ------------------
+t_row = ['' for i in range(len(colnames))]
+t_row[col_idx['Account']] = 'Total Cash Generated'
+t_row[col_idx['Inc in Cash']] = fmt_money(total)
+
+res.append(t_row)
+
+# Show Inc / Dec in Bank and Cash Accounts
+# ----------------------------------------
+
+t_row = ['' for i in range(len(colnames))]
+res.append(t_row)
+
+acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger, name from tabAccount where account_type = 'Bank or Cash' AND company=%s AND level=%s", (company, cint(filter_values['level'])))
+for acc in acc_det:
+  r = [acc[5],]
+
+  opening = glc.get_as_on_balance(acc[5], fiscal_year, from_date, acc[0], acc[2], acc[3])[2]
+
+  amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc[2], acc[3]))
+  closing = opening + flt(amount[0][0]) - flt(amount[0][1])
+  diff = closing - opening
+
+
+  r.append(acc_det[0][0])
+  r.append(acc_det[0][4])
+
+  r.append(fmt_money(flt(opening)))
+  r.append(fmt_money(flt(closing)))
+
+  r.append(fmt_money(diff))
+
+  res.append(r)
+
diff --git a/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql
new file mode 100644
index 0000000..381e8de
--- /dev/null
+++ b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql
@@ -0,0 +1,9 @@
+SELECT 
+  DISTINCT node.name AS name 
+  FROM tabAccount AS node, tabAccount AS parent 
+  WHERE node.lft BETWEEN parent.lft AND parent.rgt 
+    AND node.company = '%(company)s' 
+    AND node.is_pl_account = 'No' 
+    AND node.level=%(level)s
+    AND ifnull(node.account_type,'') != 'Bank or Cash'
+  ORDER BY node.lft
diff --git a/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt
new file mode 100644
index 0000000..b39efd8
--- /dev/null
+++ b/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': None,
+		'columns': 'Account\x01ID',
+		'creation': '2010-11-01 10:56:13',
+		'criteria_name': 'Cash Flow Statement',
+		'custom_query': None,
+		'description': '',
+		'dis_filters': 'fiscal_year\ntransaction_date',
+		'disabled': None,
+		'doc_type': 'Account',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Is Active':'','Account\x01Account Type':'','Account\x01Company':'','Account\x01Fiscal Year':'','Account\x01Show Group Balance':'','Account\x01Level':'2'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-29 16:39:19',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'cash_flow_statement',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabAccount`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/cenvat_credit___input_or_capital_goods/__init__.py b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/__init__.py
diff --git a/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.js b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.js
new file mode 100644
index 0000000..f2d5be3
--- /dev/null
+++ b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.js
@@ -0,0 +1,20 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'report', label:'Report Type', fieldtype:'Select', options:NEWLINE + 'CENVAT CREDIT ACCOUNT - INPUTS (R.G.23 A - PART II)' + NEWLINE + 'CAPITAL GOODS - INPUTS (R.G. 23 C - PART II)', ignore : 1, parent:'Journal Voucher Detail'})
+  this.add_filter({fieldname:'main_acc_head', label:'Main Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'add_acc_head', label:'Additional Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'cvd_acc_head', label:'CVD Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'edu_cess_acc_head', label:'Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'sh_edu_cess_acc_head', label:'S.H.Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+    
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
+
+  //this.large_report = 1;
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.py b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.py
new file mode 100644
index 0000000..1013616
--- /dev/null
+++ b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.py
@@ -0,0 +1,138 @@
+# Add columns
+# -----------
+row_list = [['Date', 'Date', '150px', '']
+           ,['ARI/INVOICE/Other Approved document/Bill of entry No.', 'Date', '150px', '']
+           ,['Date', 'Date', '150px', '']
+           ,['Baisc Excise Duty', 'Currency', '150px', '']
+           ,['Additional Duty', 'Currency', '150px', '']
+           ,['Education Cess', 'Currency', '150px', '']
+           ,['S.H.Education Cess', 'Currency', '150px', '']
+           ,[' Basic Excise Duty', 'Currency', '150px', '']
+           ,[' Education Cess', 'Currency', '150px', '']
+           ,[' S.H.Education Cess', 'Currency', '150px', '']
+           ,['Basic Excise Duty ', 'Currency', '150px', '']
+           ,['Education Cess ', 'Currency', '150px', '']
+           ,['S.H.Education Cess ', 'Currency', '150px', '']
+           ,['Remarks', 'Data', '150px', '']
+]
+
+if not filter_values['report']:
+  msgprint("Please Select Report Type. ")
+  raise Exception
+
+if 'CAPITAL' not in filter_values['report']:
+  row_list.insert(3,['Range/ Divsion/ Custom House from where received', 'Data', '150px', ''])
+  row_list.insert(4,['Folio No. & Entry No. in Part I', 'Data', '150px', ''])
+  row_list.insert(7,['CVD', 'Currency', '150px', ''])
+  row_list.insert(10,['ARI/INVOICE/ Other Approved document/Bill of entry No.', 'Data', '100px', ''])
+  row_list.insert(11,['Date', 'Date', '150px', ''])
+elif 'CAPITAL' in filter_values['report']:
+  row_list.insert(7,[' Basic Excise Duty ', 'Currency', '150px', ''])
+  row_list.insert(8,[' Education Cess ', 'Currency', '150px', ''])
+  row_list.insert(9,[' S.H.Education Cess ', 'Currency', '150px', ''])
+  row_list.insert(10,['ARI/INVOICE/ Other Approved document/Bill of entry No.', 'Data', '100px', ''])
+  row_list.insert(11,['Date', 'Date', '150px', ''])
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+
+# get as_on_date for opening
+as_on_date = ''
+if filter_values.get('posting_date'):
+  as_on_date = add_days(filter_values['posting_date'], -1)
+
+ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",as_on_date)[0]
+
+
+# Get Opening Balance
+def get_opening_balance(acc, fy, as_on_date, ysd, get_opening_balance, get_obj):
+  glc = get_obj('GL Control')
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
+  return glc.get_as_on_balance(acc, fy, as_on_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+
+cum_sum_main_acc_head = cum_sum_add_acc_head = cum_sum_cvd_acc_head = cum_sum_edu_cess_acc_head = cum_sum_sh_edu_cess_acc_head = 0
+openg_main_acc_head = openg_add_acc_head = openg_cvd_acc_head = openg_edu_cess_acc_head = openg_sh_edu_cess_acc_head = 0
+
+# Get Opening of Basic Excise Duty
+if not filter_values['main_acc_head']: 
+  msgprint("Please Enter Main Account Head")
+  raise Exception
+cum_sum_main_acc_head = openg_main_acc_head = get_opening_balance(filter_values['main_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
+
+# Get Opening of add_acc_head
+if filter_values['add_acc_head'] : cum_sum_add_acc_head = openg_add_acc_head = get_opening_balance(filter_values['add_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
+
+# Get Opening of cvd_acc_head
+if filter_values['cvd_acc_head'] : cum_sum_cvd_acc_head = openg_cvd_acc_head = get_opening_balance(get_opening_balance, filter_values['cvd_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
+
+# Get Opening of edu_cess_acc_head
+if not filter_values['edu_cess_acc_head'] :
+  msgprint("Please Enter Edu Cess Account Head")
+  raise Exception
+cum_sum_edu_cess_acc_head = openg_edu_cess_acc_head = get_opening_balance(filter_values['edu_cess_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
+
+# Get Opening of sh_edu_cess_acc_head
+if not filter_values['sh_edu_cess_acc_head'] :
+  msgprint("Please Enter S.H.Edu Cess Account Head")
+  raise Exception
+cum_sum_sh_edu_cess_acc_head = openg_sh_edu_cess_acc_head = get_opening_balance(filter_values['sh_edu_cess_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
+
+
+for r in res:
+  remarks = r[col_idx['ARI/INVOICE/ Other Approved document/Bill of entry No.']]
+  r[col_idx['ARI/INVOICE/ Other Approved document/Bill of entry No.']] = ''
+  r.append('')
+  if 'CAPITAL' not in filter_values['report']:
+    r.append(0.00)
+    r.append(0.00)
+    r.append(0.00)
+    cum_sum_main_acc_head = flt(cum_sum_main_acc_head) + flt(r[col_idx['Baisc Excise Duty']])
+    cum_sum_add_acc_head = flt(cum_sum_add_acc_head) + flt(r[col_idx['Additional Duty']])
+    cum_sum_cvd_acc_head = flt(cum_sum_cvd_acc_head) + flt(r[col_idx['CVD']])
+    
+    r.append( cum_sum_main_acc_head + cum_sum_add_acc_head + cum_sum_cvd_acc_head)
+    cum_sum_edu_cess_acc_head = flt(cum_sum_edu_cess_acc_head) + flt(r[col_idx['Education Cess']])
+    r.append(cum_sum_edu_cess_acc_head)
+    cum_sum_sh_edu_cess_acc_head = flt(cum_sum_sh_edu_cess_acc_head) + flt(r[col_idx['S.H.Education Cess']])
+    r.append(cum_sum_sh_edu_cess_acc_head)
+  elif 'CAPITAL' in filter_values['report']:
+    # As there is no range and Folio No
+    r[col_idx['Baisc Excise Duty']] = r[col_idx['Education Cess']]
+    r[col_idx['Additional Duty']] = r[col_idx['S.H.Education Cess']]
+    r[col_idx['Education Cess']] = r[col_idx[' Education Cess ']]
+    r[col_idx['S.H.Education Cess']] = r[col_idx[' S.H.Education Cess ']]
+
+    cum_sum_main_acc_head = flt(cum_sum_main_acc_head) + flt(r[col_idx['Baisc Excise Duty']]) 
+    cum_sum_add_acc_head = flt(cum_sum_add_acc_head) + flt(r[col_idx['Additional Duty']]) 
+        
+    r[col_idx[' Basic Excise Duty ']]= flt(cum_sum_main_acc_head) + flt(cum_sum_add_acc_head)
+    cum_sum_edu_cess_acc_head = flt(cum_sum_edu_cess_acc_head) + flt(r[col_idx['Education Cess']])
+    r[col_idx[' Education Cess ']]= flt(cum_sum_edu_cess_acc_head)
+    cum_sum_sh_edu_cess_acc_head = flt(cum_sum_sh_edu_cess_acc_head) + flt(r[col_idx['S.H.Education Cess']])
+    r[col_idx[' S.H.Education Cess ']]= flt(cum_sum_sh_edu_cess_acc_head)
+    
+    r.append(0.00)
+    r.append(0.00)
+    r.append(0.00)
+    
+    r.append( cum_sum_main_acc_head + cum_sum_add_acc_head)
+    r.append(cum_sum_edu_cess_acc_head)
+    r.append(cum_sum_sh_edu_cess_acc_head)
+  r.append(remarks)
+
+
+out = []
+
+if 'CAPITAL' not in cstr(filter_values['report']):
+  out.append(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '','','','', flt(openg_main_acc_head) + flt(openg_add_acc_head) + flt(openg_cvd_acc_head), flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head),''])
+elif 'CAPITAL' in filter_values['report']:
+  out.append(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '', '', '', '', flt(openg_main_acc_head) + flt(openg_add_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head)])
+out += res
+#if from_export == 0:
+#  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
+#  raise Exception
\ No newline at end of file
diff --git a/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.sql b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.sql
new file mode 100644
index 0000000..6064fe4
--- /dev/null
+++ b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.sql
@@ -0,0 +1,31 @@
+SELECT t1.posting_date, t1.bill_no, t1.bill_date, t1.range, t1.name, SUM(CASE WHEN t2.account_head like '%(main_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(add_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(cvd_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(sh_edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END), t1.`remarks`
+ FROM `tabPurchase Receipt` t1, `tabPurchase Tax Detail` t2
+ WHERE t2.parent = t1.name
+ AND t2.parent = 'Purchase Reciept'
+ AND (t2.account_head LIKE '%(main_acc_head)s' and '%(main_acc_head)s%%' or '~~~~'
+ OR t2.account_head LIKE '%(add_acc_head)s' and '%(add_acc_head)s%%' or '~~~~'
+ OR t2.account_head LIKE '%(cvd_acc_head)s' and '%(cvd_acc_head)s%%' or '~~~~'
+ OR t2.account_head LIKE '%(edu_cess_acc_head)s' and '%(edu_cess_acc_head)s%%' or '~~~~'
+ OR t2.account_head LIKE '%(sh_edu_cess_acc_head)s%' and '%(sh_edu_cess_acc_head)s%%' or '~~~~')
+ AND t1.`posting_date` >= '%(posting_date)s'
+ AND t1.`posting_date` <= '%(posting_date1)s'
+ AND t1.docstatus =1
+ GROUP BY t1.`name`
+
+UNION
+
+SELECT t1.posting_date, t1.bill_no, t1.bill_date, '' AS 'Range', t1.name, SUM(CASE WHEN t2.account like '%(main_acc_head)s%' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(add_acc_head)s%' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(cvd_acc_head)s%' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(sh_edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END), t1.`remark`
+ FROM `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
+ WHERE (t2.debit is not NULL OR t2.debit != '')
+ AND t2.debit > 0
+ AND t2.parent = t1.name
+ AND (t2.account LIKE '%(main_acc_head)s' and '%(main_acc_head)s%%' or '~~~~'
+ OR t2.account LIKE '%(add_acc_head)s' and '%(add_acc_head)s%%' or '~~~~'
+ OR t2.account LIKE '%(cvd_acc_head)s' and '%(cvd_acc_head)s%%' or '~~~~'
+ OR t2.account LIKE '%(edu_cess_acc_head)s' and '%(edu_cess_acc_head)s%%' or '~~~~'
+ OR t2.account LIKE '%(sh_edu_cess_acc_head)s%' and '%(sh_edu_cess_acc_head)s%%' or '~~~~') AND t1.`posting_date` >= '%(posting_date)s'
+ AND t1.`posting_date` <= '%(posting_date1)s'
+ AND t1.docstatus =1
+ GROUP BY t1.`name`
+
+ORDER BY `posting_date`,`name`
\ No newline at end of file
diff --git a/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.txt b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.txt
new file mode 100644
index 0000000..6be62ed
--- /dev/null
+++ b/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-11-01 10:56:13',
+		'criteria_name': 'Cenvat Credit - Input or Capital Goods',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','Receivable Voucher\x01Aging Based On':'','Payable Voucher\x01Aging Based On':'Transaction Date','Journal Voucher Detail\x01Report Type':'CENVAT CREDIT ACCOUNT - INPUTS (R.G.23 A - PART II)'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-29 16:42:14',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'cenvat_credit_-_input_or_capital_goods',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/__init__.py b/accounts/search_criteria/collection_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/collection_report/__init__.py
diff --git a/accounts/search_criteria/collection_report/collection_report.js b/accounts/search_criteria/collection_report/collection_report.js
new file mode 100644
index 0000000..8559103
--- /dev/null
+++ b/accounts/search_criteria/collection_report/collection_report.js
@@ -0,0 +1,24 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
+
+  this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Receivable Voucher', 'report_default': 'Aging Date'});  
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
+}
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/collection_report.py b/accounts/search_criteria/collection_report/collection_report.py
new file mode 100644
index 0000000..5d814fc
--- /dev/null
+++ b/accounts/search_criteria/collection_report/collection_report.py
@@ -0,0 +1,90 @@
+#check mandatory
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please select From Posting Date and To Posting Date ")
+  raise Exception
+else:
+  from_date = filter_values.get('posting_date')
+  to_date = filter_values.get('posting_date1')
+
+if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
+  msgprint("Please select aging ranges in no of days in 'Set Filters' section")
+  raise Exception
+  
+# ageing based on
+aging_based_on = 'Aging Date'
+if filter_values.get('aging_based_on'):
+  aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
+
+
+# Add columns
+# -----------
+row_list = [['ID','Data','150px',''],
+            ['Account','Data','150px',''],
+            ['Credit','Data','150px',''],
+            ['Debit','Data','150px',''],
+            ['Against Receivable','Data','150px',''],
+            ['Is Advance','Data','150px',''],
+            ['Transaction Date','Date','150px',''],
+            ['Aging Date','Date','150px',''],
+            ['Company','Data','150px',''],
+            ['Cheque No','Data','100px',''],
+            ['Cheque Date','Date','150px',''],        
+            ['Territory','Data','150px',''],
+            ['Remark','Data','250px',''],
+            ['Advance','Data','250px',''],
+            ['RV Transaction Date','Date','150px',''],
+            ['RV Aging Date','Date','150px',''],
+            ['Age (Days)','Data','50px',''],
+            ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
+            [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
+            [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
+            [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
+            [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]  
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+for r in res:
+  if r[col_idx['Against Receivable']]:
+    dt=sql("select voucher_date, Aging_date from `tabReceivable Voucher` where name='%s'"%r[col_idx['Against Receivable']])
+    r.append('')
+    r.append(dt and cstr(dt[0][0]) or '')
+    r.append(dt and cstr(dt[0][1]) or '')
+  else:
+    r.append(r[col_idx['Credit']])
+    r.append('')
+    r.append('')
+    
+
+  # Aging Credit Amount
+  val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = diff = 0
+
+  if r[col_idx['Against Receivable']]:
+    amt = flt(r[col_idx['Credit']]) or (-1)*flt(r[col_idx['Debit']])
+
+    if aging_based_on == 'Transaction Date' and r[col_idx['RV Transaction Date']]:
+      diff = (getdate(r[col_idx['Transaction Date']]) - getdate(r[col_idx['RV Transaction Date']])).days
+    elif aging_based_on == 'Aging Date' and r[col_idx['RV Aging Date']]:
+      diff = (getdate(r[col_idx['Aging Date']]) - getdate(r[col_idx['RV Aging Date']])).days
+
+    if diff < cint(filter_values['range_1']):
+      val_l1 = amt
+    if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
+      val_l2 = amt
+    if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
+      val_l3 = amt
+    if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
+      val_l4 = amt
+    if diff >= cint(filter_values['range_4']):
+      val_l5_above = amt
+
+  r.append(diff)
+  r.append(val_l1)
+  r.append(val_l2)
+  r.append(val_l3)
+  r.append(val_l4)
+  r.append(val_l5_above)
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/collection_report.sql b/accounts/search_criteria/collection_report/collection_report.sql
new file mode 100644
index 0000000..8743b88
--- /dev/null
+++ b/accounts/search_criteria/collection_report/collection_report.sql
@@ -0,0 +1,13 @@
+SELECT `tabJournal Voucher`.`name`,`tabJournal Voucher Detail`.`account`,`tabJournal Voucher Detail`.`credit`,`tabJournal Voucher Detail`.`debit`,`tabJournal Voucher Detail`.`against_invoice`,`tabJournal Voucher Detail`.`is_advance`,`tabJournal Voucher`.`voucher_date`,`tabJournal Voucher`.`aging_date`,`tabJournal Voucher`.`company`,`tabJournal Voucher`.`cheque_no`,`tabJournal Voucher`.`cheque_date`,`tabCustomer`.`territory`, `tabJournal Voucher`.`remark`
+ FROM `tabJournal Voucher Detail`,`tabJournal Voucher`,`tabAccount`,`tabCustomer`
+ WHERE `tabJournal Voucher`.docstatus=1
+ AND `tabJournal Voucher`.`posting_date`>='%(posting_date)s'
+ AND `tabJournal Voucher`.`posting_date`<='%(posting_date1)s'
+ AND `tabJournal Voucher`.`company` LIKE '%(company)s%%'
+ AND `tabJournal Voucher`.`is_opening` LIKE '%(is_opening)s%%'
+ AND `tabJournal Voucher Detail`.`account` LIKE '%(account)s%%'
+ AND `tabAccount`.master_type = 'Customer'
+ AND `tabAccount`.`account_name` = `tabCustomer`.`name`
+ AND `tabJournal Voucher Detail`.`account` = `tabAccount`.`name`
+ AND `tabJournal Voucher Detail`.`parent` = `tabJournal Voucher`.`name`
+ ORDER BY `tabJournal Voucher`.`name`
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/collection_report.txt b/accounts/search_criteria/collection_report/collection_report.txt
new file mode 100644
index 0000000..2a3f76b
--- /dev/null
+++ b/accounts/search_criteria/collection_report/collection_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Credit,Journal Voucher Detail\x01Against Receivable,Journal Voucher Detail\x01Is Advance',
+		'creation': '2010-10-05 12:51:18',
+		'criteria_name': 'Collection Report',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-01 11:29:51',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'collection_report',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabJournal Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/__init__.py b/accounts/search_criteria/cost_center_wise_expense/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/cost_center_wise_expense/__init__.py
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.js b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.js
new file mode 100644
index 0000000..29c6ab2
--- /dev/null
+++ b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.js
@@ -0,0 +1,23 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Cost Center'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Cost Center'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.in_first_page = 1;
+
+  
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+
+}
+this.mytabs.items['Select Columns'].hide();
+this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py
new file mode 100644
index 0000000..01cff8e
--- /dev/null
+++ b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py
@@ -0,0 +1,13 @@
+# Add columns
+# -----------
+row_list = [['Cost Center','Data','160px'],
+            ['Account','Data','160px'],
+            ['Debit','Data','120px'],
+            ['Credit','Data','120px'], 
+            ['Expense','Currency','120px']]  
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  col_idx[r[0]] = len(colnames)-1
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql
new file mode 100644
index 0000000..5b22add
--- /dev/null
+++ b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql
@@ -0,0 +1,12 @@
+SELECT `tabGL Entry`.`cost_center`,`tabAccount`.`parent_account`,sum(`tabGL Entry`.`debit`),sum(`tabGL Entry`.`credit`),sum(`tabGL Entry`.`debit`)-sum(`tabGL Entry`.`credit`) 
+ FROM `tabGL Entry`,`tabAccount`
+ WHERE `tabGL Entry`.`account`=`tabAccount`.`name`
+ AND ifnull(`tabGL Entry`.`is_cancelled`,'No')='No'
+ AND `tabAccount`.is_pl_account='Yes'
+ AND `tabAccount`.debit_or_credit='Debit' 
+ AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
+ AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
+ AND `tabGL Entry`.`company` LIKE '%(company)s%%' 
+ AND `tabAccount`.`parent_account` LIKE '%(account)s%%'
+ AND `tabGL Entry`.`cost_center` LIKE '%(cost_center)s%%' 
+ GROUP BY `tabGL Entry`.`cost_center` , `tabAccount`.`parent_account`
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
new file mode 100644
index 0000000..411bb30
--- /dev/null
+++ b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Cost Center wise Expense',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-10 13:19:39',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'cost_center_wise_expense',
+		'owner': 'swarnalata@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabGL Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/__init__.py b/accounts/search_criteria/creditors_ledger/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/creditors_ledger/__init__.py
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.js b/accounts/search_criteria/creditors_ledger/creditors_ledger.js
new file mode 100644
index 0000000..fffb263
--- /dev/null
+++ b/accounts/search_criteria/creditors_ledger/creditors_ledger.js
@@ -0,0 +1,24 @@
+report.customize_filters = function() {
+
+  //to hide all filters
+  this.hide_all_filters();
+  field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
+  for(var i=0;i<field_list.length;i++){
+    this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
+  }
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+}
+
+this.mytabs.tabs['Select Columns'].hide()
+
+report.aftertableprint = function(t) {
+  $yt(t,'*',2,{whiteSpace:'pre'});
+   $yt(t,'*',3,{whiteSpace:'pre'});
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.py b/accounts/search_criteria/creditors_ledger/creditors_ledger.py
new file mode 100644
index 0000000..ca318c7
--- /dev/null
+++ b/accounts/search_criteria/creditors_ledger/creditors_ledger.py
@@ -0,0 +1,113 @@
+#get company
+company = filter_values.get('company') or get_defaults()['company']
+
+#get company letter head
+l_head = sql("select letter_head from `tabCompany` where name='%s'" % company)
+l_head = l_head and l_head[0][0] or ''
+
+# Posting date, fiscal year and year start date
+#-----------------------------------------------
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please enter From Date and To Date")
+  raise Exception
+else:
+  from_date = filter_values['posting_date']
+  to_date = filter_values['posting_date1']
+
+ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
+
+
+# define columns
+#---------------
+col = []
+col.append(['Date','Date','80px',''])
+col.append(['Detail','Text','475px',''])
+col.append(['Debit','Currency','75px',''])
+col.append(['Credit','Currency','75px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)
+
+
+total_debit, total_credit, total_opening, total_diff = 0,0,0,0
+
+#total query
+q = query.split('WHERE')[1].split('LIMIT')
+if len(q) > 2:
+  query_where_clause = 'LIMIT'.join(q[:-1])
+else:
+  query_where_clause = q[0]
+
+tot = sql('select sum(`tabGL Entry`.debit),sum(`tabGL Entry`.credit) from `tabGL Entry`, tabAccount where %s' % query_where_clause)
+
+for t in tot:
+  total_debit += t and flt(t[0]) or 0
+  total_credit += t and flt(t[1]) or 0
+
+total_diff = total_debit - total_credit
+
+# opening
+account = filter_values.get('account')
+if account:
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
+  opening_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, add_days(from_date, -1), acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+  if acc_det[0][0] == 'Credit':
+    opening_bal =  -1*opening_bal
+  
+
+out = []
+count = 0
+for r in res:
+  count +=1
+  det = r[1].split('~~~')
+  if from_export == 1:
+    a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
+  else:
+    a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
+  r[1] = a
+  out.append(r)
+
+if total_debit != 0 or total_credit != 0:
+  # Total debit/credit
+  t_row = ['' for i in range(len(colnames))]
+  t_row[1] = 'Total'
+  t_row[col_idx['Debit']-1] = total_debit 
+  t_row[col_idx['Credit']-1] = total_credit 
+  out.append(t_row)
+  
+  # opening
+  if account:
+    t_row = ['' for i in range(len(colnames))]
+    t_row[1] = 'Opening Balance on '+ from_date
+    t_row[col_idx['Debit']-1] = opening_bal
+    out.append(t_row)
+  
+  # diffrence (dr-cr)
+  t_row = ['' for i in range(len(colnames))]
+  t_row[1] = 'Total(Dr-Cr)'
+  t_row[col_idx['Debit']-1] = total_diff 
+  out.append(t_row)
+
+  # closing
+  if account:
+    t_row = ['' for i in range(len(colnames))]
+    t_row[1] = 'Closing Balance on ' + to_date
+    t_row[col_idx['Debit']-1] = flt(opening_bal) + flt(total_diff )
+    out.append(t_row)
+  
+# Print Format
+myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
+</tr>
+<tr> <td>
+<div><h3> %(acc)s </h3></div>
+<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
+
+  """ % {'acc':account,
+         'fdt':from_date,
+         'tdt':to_date}
+ 
+page_template = myheader+"<div>%(table)s</div>"
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.sql b/accounts/search_criteria/creditors_ledger/creditors_ledger.sql
new file mode 100644
index 0000000..03784b9
--- /dev/null
+++ b/accounts/search_criteria/creditors_ledger/creditors_ledger.sql
@@ -0,0 +1,15 @@
+SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
+ FROM `tabGL Entry`, `tabAccount`
+ WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
+ AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
+ AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
+ AND `tabGL Entry`.`company` LIKE '%(company)s%%'
+ AND `tabGL Entry`.`account` LIKE '%(account)s%%'
+ AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
+ AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
+ AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
+ AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
+ AND `tabGL Entry`.`account` = `tabAccount`.`name`
+ AND `tabAccount`.`master_type` = 'Supplier'
+ GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
+ ORDER BY `tabGL Entry`.`posting_date` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.txt b/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
new file mode 100644
index 0000000..a1aef33
--- /dev/null
+++ b/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': "Creditor's Ledger",
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-22 17:05:46',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'creditors_ledger',
+		'owner': 'nabin@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/__init__.py b/accounts/search_criteria/debtors_ledger/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/debtors_ledger/__init__.py
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.js b/accounts/search_criteria/debtors_ledger/debtors_ledger.js
new file mode 100644
index 0000000..fffb263
--- /dev/null
+++ b/accounts/search_criteria/debtors_ledger/debtors_ledger.js
@@ -0,0 +1,24 @@
+report.customize_filters = function() {
+
+  //to hide all filters
+  this.hide_all_filters();
+  field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
+  for(var i=0;i<field_list.length;i++){
+    this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
+  }
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+}
+
+this.mytabs.tabs['Select Columns'].hide()
+
+report.aftertableprint = function(t) {
+  $yt(t,'*',2,{whiteSpace:'pre'});
+   $yt(t,'*',3,{whiteSpace:'pre'});
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.py b/accounts/search_criteria/debtors_ledger/debtors_ledger.py
new file mode 100644
index 0000000..ca318c7
--- /dev/null
+++ b/accounts/search_criteria/debtors_ledger/debtors_ledger.py
@@ -0,0 +1,113 @@
+#get company
+company = filter_values.get('company') or get_defaults()['company']
+
+#get company letter head
+l_head = sql("select letter_head from `tabCompany` where name='%s'" % company)
+l_head = l_head and l_head[0][0] or ''
+
+# Posting date, fiscal year and year start date
+#-----------------------------------------------
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please enter From Date and To Date")
+  raise Exception
+else:
+  from_date = filter_values['posting_date']
+  to_date = filter_values['posting_date1']
+
+ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
+
+
+# define columns
+#---------------
+col = []
+col.append(['Date','Date','80px',''])
+col.append(['Detail','Text','475px',''])
+col.append(['Debit','Currency','75px',''])
+col.append(['Credit','Currency','75px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)
+
+
+total_debit, total_credit, total_opening, total_diff = 0,0,0,0
+
+#total query
+q = query.split('WHERE')[1].split('LIMIT')
+if len(q) > 2:
+  query_where_clause = 'LIMIT'.join(q[:-1])
+else:
+  query_where_clause = q[0]
+
+tot = sql('select sum(`tabGL Entry`.debit),sum(`tabGL Entry`.credit) from `tabGL Entry`, tabAccount where %s' % query_where_clause)
+
+for t in tot:
+  total_debit += t and flt(t[0]) or 0
+  total_credit += t and flt(t[1]) or 0
+
+total_diff = total_debit - total_credit
+
+# opening
+account = filter_values.get('account')
+if account:
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
+  opening_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, add_days(from_date, -1), acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+  if acc_det[0][0] == 'Credit':
+    opening_bal =  -1*opening_bal
+  
+
+out = []
+count = 0
+for r in res:
+  count +=1
+  det = r[1].split('~~~')
+  if from_export == 1:
+    a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
+  else:
+    a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
+  r[1] = a
+  out.append(r)
+
+if total_debit != 0 or total_credit != 0:
+  # Total debit/credit
+  t_row = ['' for i in range(len(colnames))]
+  t_row[1] = 'Total'
+  t_row[col_idx['Debit']-1] = total_debit 
+  t_row[col_idx['Credit']-1] = total_credit 
+  out.append(t_row)
+  
+  # opening
+  if account:
+    t_row = ['' for i in range(len(colnames))]
+    t_row[1] = 'Opening Balance on '+ from_date
+    t_row[col_idx['Debit']-1] = opening_bal
+    out.append(t_row)
+  
+  # diffrence (dr-cr)
+  t_row = ['' for i in range(len(colnames))]
+  t_row[1] = 'Total(Dr-Cr)'
+  t_row[col_idx['Debit']-1] = total_diff 
+  out.append(t_row)
+
+  # closing
+  if account:
+    t_row = ['' for i in range(len(colnames))]
+    t_row[1] = 'Closing Balance on ' + to_date
+    t_row[col_idx['Debit']-1] = flt(opening_bal) + flt(total_diff )
+    out.append(t_row)
+  
+# Print Format
+myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
+</tr>
+<tr> <td>
+<div><h3> %(acc)s </h3></div>
+<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
+
+  """ % {'acc':account,
+         'fdt':from_date,
+         'tdt':to_date}
+ 
+page_template = myheader+"<div>%(table)s</div>"
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.sql b/accounts/search_criteria/debtors_ledger/debtors_ledger.sql
new file mode 100644
index 0000000..59103fd
--- /dev/null
+++ b/accounts/search_criteria/debtors_ledger/debtors_ledger.sql
@@ -0,0 +1,15 @@
+SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
+ FROM `tabGL Entry`, `tabAccount`
+ WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
+ AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
+ AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
+ AND `tabGL Entry`.`company` LIKE '%(company)s%%'
+ AND `tabGL Entry`.`account` LIKE '%(account)s%%'
+ AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
+ AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
+ AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
+ AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
+ AND `tabGL Entry`.`account` = `tabAccount`.`name`
+ AND `tabAccount`.`master_type` = 'Customer'
+ GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
+ ORDER BY `tabGL Entry`.`posting_date` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.txt b/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
new file mode 100644
index 0000000..1042a9d
--- /dev/null
+++ b/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': "Debtor's Ledger",
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-22 17:02:05',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'debtors_ledger',
+		'owner': 'nabin@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/general_ledger/__init__.py b/accounts/search_criteria/general_ledger/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/general_ledger/__init__.py
diff --git a/accounts/search_criteria/general_ledger/general_ledger.js b/accounts/search_criteria/general_ledger/general_ledger.js
new file mode 100644
index 0000000..7140389
--- /dev/null
+++ b/accounts/search_criteria/general_ledger/general_ledger.js
@@ -0,0 +1,23 @@
+report.customize_filters = function() {
+  this.mytabs.tabs['Select Columns'].hide();
+  //to hide all filters
+  this.hide_all_filters();
+  field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
+  for(var i=0;i<field_list.length;i++){
+    this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
+  }
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+}
+
+
+report.aftertableprint = function(t) {
+  $yt(t,'*',2,{whiteSpace:'pre'});
+   $yt(t,'*',3,{whiteSpace:'pre'});
+}
diff --git a/accounts/search_criteria/general_ledger/general_ledger.py b/accounts/search_criteria/general_ledger/general_ledger.py
new file mode 100644
index 0000000..005038a
--- /dev/null
+++ b/accounts/search_criteria/general_ledger/general_ledger.py
@@ -0,0 +1,103 @@
+#get company letter head
+l_head = sql("select content from `tabLetter Head` where ifnull(is_default, 0) = 1 and ifnull(disabled, 0) = 0")
+l_head = l_head and l_head[0][0] or ''
+
+# Posting date, fiscal year and year start date
+#-----------------------------------------------
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please enter From Date and To Date")
+  raise Exception
+else:
+  from_date = filter_values['posting_date']
+  to_date = filter_values['posting_date1']
+
+ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",from_date)[0]
+
+
+# define columns
+#---------------
+col = []
+col.append(['Date','Date','80px',''])
+col.append(['Detail','Text','475px',''])
+col.append(['Debit','Currency','75px',''])
+col.append(['Credit','Currency','75px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)
+
+
+total_debit, total_credit, total_opening, total_diff = 0,0,0,0
+
+#total query
+q = query.split('WHERE')[1].split('LIMIT')
+if len(q) > 2:
+  query_where_clause = 'LIMIT'.join(q[:-1])
+else:
+  query_where_clause = q[0]
+
+tot = sql('select sum(debit),sum(credit) from `tabGL Entry` where %s' % query_where_clause)
+
+for t in tot:
+  total_debit += t and flt(t[0]) or 0
+  total_credit += t and flt(t[1]) or 0
+
+total_diff = total_debit - total_credit
+
+# opening
+account = filter_values.get('account')
+if account:
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
+  closing_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+  if acc_det[0][0] == 'Credit':
+    closing_bal =  -1*closing_bal
+
+out = []
+count = 0
+for r in res:
+  count +=1
+  det = r[1].split('~~~')
+  if from_export == 1:
+    a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
+  else:
+    a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
+  r[1] = a
+  out.append(r)
+
+if total_debit != 0 or total_credit != 0:
+  # Total debit/credit
+  t_row = ['' for i in range(len(colnames))]
+  t_row[1] = 'Total'
+  t_row[col_idx['Debit']-1] = total_debit 
+  t_row[col_idx['Credit']-1] = total_credit 
+  out.append(t_row)
+  
+
+  # diffrence (dr-cr)
+  t_row = ['' for i in range(len(colnames))]
+  t_row[1] = 'Total(Dr-Cr)'
+  t_row[col_idx['Debit']-1] = total_diff 
+  out.append(t_row)
+
+  # closing
+  if account:
+    t_row = ['' for i in range(len(colnames))]
+    t_row[1] = 'Closing Balance on ' + to_date
+    t_row[col_idx['Debit']-1] = flt(closing_bal)
+    out.append(t_row)
+  
+# Print Format
+myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
+</tr>
+<tr> <td>
+<div><h3> %(acc)s </h3></div>
+<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
+
+  """ % {'acc':account,
+         'fdt':from_date,
+         'tdt':to_date}
+ 
+page_template = myheader+"<div>%(table)s</div>"
diff --git a/accounts/search_criteria/general_ledger/general_ledger.sql b/accounts/search_criteria/general_ledger/general_ledger.sql
new file mode 100644
index 0000000..51123cd
--- /dev/null
+++ b/accounts/search_criteria/general_ledger/general_ledger.sql
@@ -0,0 +1,13 @@
+SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
+ FROM `tabGL Entry`
+ WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
+ AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
+ AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
+ AND `tabGL Entry`.`company` LIKE '%(company)s%%'
+ AND `tabGL Entry`.`account` LIKE '%(account)s%%'
+ AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
+ AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
+ AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
+ AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
+ GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
+ ORDER BY `tabGL Entry`.`posting_date` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/general_ledger/general_ledger.txt b/accounts/search_criteria/general_ledger/general_ledger.txt
new file mode 100644
index 0000000..2e23fee
--- /dev/null
+++ b/accounts/search_criteria/general_ledger/general_ledger.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:08',
+		'criteria_name': 'General Ledger',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01From Posting Date\x01lower':'','GL Entry\x01To Posting Date\x01upper':'','GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '',
+		'idx': None,
+		'modified': '2010-11-30 16:26:42',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'general_ledger',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabGL Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/itemwise_purchase_register/__init__.py b/accounts/search_criteria/itemwise_purchase_register/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/itemwise_purchase_register/__init__.py
diff --git a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
new file mode 100644
index 0000000..e73b4a8
--- /dev/null
+++ b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
@@ -0,0 +1,17 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  filter_list = ['From Voucher Date', 'To Voucher Date', 'Credit To', 'Is Opening', 'From Posting Date', 'To Posting Date']
+  for(var i=0;i<filter_list.length;i++)
+    this.filter_fields_dict['Payable Voucher'+FILTER_SEP +filter_list[i]].df.filter_hide = 0;
+
+  this.filter_fields_dict['PV Detail'+FILTER_SEP +'Item'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['PV Detail'+FILTER_SEP +'Item'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company
+
+}
diff --git a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.py b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.py
new file mode 100644
index 0000000..a7e343b
--- /dev/null
+++ b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.py
@@ -0,0 +1,28 @@
+#adding columns
+
+cl = [c[0] for c in sql("select distinct account_head from `tabPurchase Tax Detail` where parenttype='Payable Voucher' and docstatus=1 order by idx asc")]
+
+cl += ['Total Tax', 'Grand Total']
+for c in cl:
+  colnames.append(c)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+
+cl = cl[:-2]
+for r in res:
+  total_tax = 0
+  amt = flt(r[col_idx['Amount (Default Curr.)']] or 0)
+  qty = flt(r[col_idx['Qty']] or 0)
+
+  for c in cl:
+    val = sql("select t1.tax_amount, t2.net_total from `tabPurchase Tax Detail` t1, `tabPayable Voucher` t2 where t2.name = %s and t1.parent = %s and t1.parenttype='Payable Voucher' and t1.account_head = %s", (r[col_idx['ID']],r[col_idx['ID']], c))
+    tax = val and flt(val[0][0]) or 0
+    net_total = val and flt(val[0][1]) or 0
+    if tax != 0:
+      tax = amt*tax/net_total
+    total_tax += tax
+    
+    r.append(tax)
+  r.append(total_tax)
+  r.append(amt + total_tax)
diff --git a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
new file mode 100644
index 0000000..9c66b95
--- /dev/null
+++ b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Credit To,Payable Voucher\x01Company,PV Detail\x01Item,PV Detail\x01Item Name,PV Detail\x01Qty,PV Detail\x01Rate (Default Curr.),PV Detail\x01Amount (Default Curr.)',
+		'creation': '2010-09-10 16:53:48',
+		'criteria_name': 'Itemwise Purchase Register',
+		'custom_query': '',
+		'description': 'Itemwise Purchase Register',
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'PV Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01From Posting Date\x01lower':'2010-04-01','Payable Voucher\x01To Posting Date\x01upper':'2010-09-10','Payable Voucher\x01Is Opening':'No','Payable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-10 16:51:50',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'itemwise_purchase_register',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Payable Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabPayable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/itemwise_sales_register/__init__.py b/accounts/search_criteria/itemwise_sales_register/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/itemwise_sales_register/__init__.py
diff --git a/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt b/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
new file mode 100644
index 0000000..cb341eb
--- /dev/null
+++ b/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'RV Detail\x01Item,RV Detail\x01Item Name,RV Detail\x01Item Group,Receivable Voucher\x01ID,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Posting Date,Receivable Voucher\x01Debit To,RV Detail\x01Cost Center,Receivable Voucher\x01Territory,RV Detail\x01Qty,RV Detail\x01Basic Rate*,RV Detail\x01Amount*',
+		'creation': '2011-01-19 17:47:20',
+		'criteria_name': 'Itemwise Sales Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'RV Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-01-19 15:56:31',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'itemwise_sales_register',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Receivable Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabReceivable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/itemwise_sales_register1/__init__.py b/accounts/search_criteria/itemwise_sales_register1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/itemwise_sales_register1/__init__.py
diff --git a/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.js b/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.js
new file mode 100755
index 0000000..b2bc8a9
--- /dev/null
+++ b/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.js
@@ -0,0 +1,19 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  filter_list = ['From Voucher Date', 'To Voucher Date', 'Debit To', 'From Posting Date', 'To Posting Date']
+  for(var i=0;i<filter_list.length;i++)
+    this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +filter_list[i]].df.filter_hide = 0;
+
+  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Item'].df.filter_hide = 0;
+  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Item Group'].df.filter_hide = 0;
+  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Brand Name'].df.filter_hide = 0;
+  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Cost Center'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Item'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company
+}
diff --git a/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.py b/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.py
new file mode 100755
index 0000000..7f1e4fb
--- /dev/null
+++ b/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.py
@@ -0,0 +1,26 @@
+#adding columns
+cl = [c[0] for c in sql("select distinct account_head from `tabRV Tax Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+cl+=['Total Tax', 'Grand Total']
+for c in cl:
+  colnames.append(c)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+
+cl = cl[:-2]
+for r in res:
+  total_tax = 0
+  qty = flt(r[col_idx['Qty']] or 0)
+  amt = flt(r[col_idx['Amount*']] or 0)
+  for c in cl:
+    val = sql("select t1.tax_amount, t2.net_total from `tabRV Tax Detail` t1, `tabReceivable Voucher` t2 where t2.name = %s and t1.parent = %s and t1.parenttype='Receivable Voucher' and t1.account_head = %s", (r[col_idx['ID']],r[col_idx['ID']], c))
+    tax = val and flt(val[0][0]) or 0
+    net_total = val and flt(val[0][1]) or 0
+    if tax != 0:
+      tax = amt*tax/net_total
+    total_tax += tax
+    
+    r.append(tax)
+  r.append(total_tax)
+  r.append(amt + total_tax)
diff --git a/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.txt b/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.txt
new file mode 100644
index 0000000..50e52c1
--- /dev/null
+++ b/accounts/search_criteria/itemwise_sales_register1/itemwise_sales_register1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'RV Detail\x01Item,RV Detail\x01Item Name,RV Detail\x01Item Group,Receivable Voucher\x01ID,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Posting Date,Receivable Voucher\x01Debit To,RV Detail\x01Cost Center,Receivable Voucher\x01Territory,RV Detail\x01Qty,RV Detail\x01Basic Rate*,RV Detail\x01Amount*',
+		'creation': '2011-01-20 12:49:18',
+		'criteria_name': 'Itemwise Sales Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'RV Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-01-19 15:56:31',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'itemwise_sales_register1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Receivable Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabReceivable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/monthly_ledger_summary_report/__init__.py b/accounts/search_criteria/monthly_ledger_summary_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/monthly_ledger_summary_report/__init__.py
diff --git a/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.js b/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.js
new file mode 100644
index 0000000..d5b5d4d
--- /dev/null
+++ b/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+  flds = ['ID','Owner','Cost Center','From Posting Date', 'To Posting Date', 'Against Voucher','Voucher Type','Voucher No','Is Cancelled','Is Opening','Remarks', 'From Aging Date', 'To Aging Date', 'Company']
+  for(i=0;i<flds.length;i++){
+    this.filter_fields_dict['GL Entry'+FILTER_SEP +flds[i]].df.filter_hide = 1;
+  }
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Fiscal Year'].df['report_default']=sys_defaults.fiscal_year;
+  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Fiscal Year'].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/monthly_ledger_summary_report/monthly_ledger_summary_report.py b/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.py
new file mode 100644
index 0000000..9811b28
--- /dev/null
+++ b/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.py
@@ -0,0 +1,13 @@
+if not filter_values['account']:
+  msgprint("Please Enter filter value for Account")
+  raise Exception
+
+colwidths[col_idx['Fiscal Month']] = '120px'
+colwidths[col_idx['Debit']] = '120px'
+colwidths[col_idx['Credit']] = '120px'
+
+
+month_lst={'1':'Jan','2':'Feb','3':'Mar','4':'Apr','5':'May','6':'Jun','7':'Jul','8':'Aug','9':'Sept','10':'Oct','11':'Nov','12':'Dec'}
+for r in res:
+  mnt = '%s'%r[col_idx['Fiscal Month']]
+  r[col_idx['Fiscal Month']]=month_lst[mnt]
\ No newline at end of file
diff --git a/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.txt b/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.txt
new file mode 100644
index 0000000..193a5a8
--- /dev/null
+++ b/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "month(`tabGL Entry`.posting_date) AS 'Fiscal Month'\nsum(`tabGL Entry`.debit) AS 'Debit'\nsum(`tabGL Entry`.credit) AS 'Credit'",
+		'add_cond': '(`tabGL Entry`.debit > 0 or `tabGL Entry`.credit > 0)',
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Monthly Ledger Summary Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'company',
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': 'month(`tabGL Entry`.posting_date)',
+		'idx': None,
+		'modified': '2010-06-09 16:30:43',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'monthly_ledger_summary_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`Fiscal Month`',
+		'sort_order': 'ASC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_receipt_report/__init__.py b/accounts/search_criteria/payment_receipt_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/payment_receipt_report/__init__.py
diff --git a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py
new file mode 100644
index 0000000..737e658
--- /dev/null
+++ b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py
@@ -0,0 +1,27 @@
+if not filter_values.get('posting_date'):
+  msgprint("Enter From Posting Date.")
+  raise Exception
+
+if not filter_values.get('posting_date1'):
+  msgprint("Enter To Posting Date.")
+  raise Exception
+
+if not filter_values.get('company'):
+  msgprint("Select Comapny.")
+  raise Exception
+
+
+#for r in res:
+#  par_acc = sql("SELECT parent.name FROM `tabAccount` AS node,`tabAccount` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.name = '%s' and parent.cash_flow_level = 'Yes' ORDER BY parent.lft DESC"% r[0])
+#  r.append(par_acc and par_acc[0][0] or '')
+
+col_list = [['Account', 'Link', '150px', 'Account']
+           ,['Total', 'Currency', '150px', '']
+#           ,['Parent Account', 'Link', '150px', 'Account']
+           ]
+for c in col_list:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames) - 1
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.sql b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.sql
new file mode 100644
index 0000000..a4132b7
--- /dev/null
+++ b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.sql
@@ -0,0 +1 @@
+select t1.account, sum(if(t2.debit_or_credit = 'Debit', ifnull(t1.debit,0) - ifnull(t1.credit,0), ifnull(t1.credit,0) - ifnull(t1.debit,0))) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.account_type != 'Bank or Cash' and t1.name in (select t1.name from `tabGL Entry` t1, `tabAccount` t2 where t1.against = t2.name and t2.account_type = 'Bank or Cash' and posting_date >= '%(posting_date)s' and posting_date <= '%(posting_date1)s') group by t1.account
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
new file mode 100644
index 0000000..df79a3f
--- /dev/null
+++ b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Payment Receipt Report',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'GL Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-11 17:00:54',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'payment_receipt_report',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabGL Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_report/__init__.py b/accounts/search_criteria/payment_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/payment_report/__init__.py
diff --git a/accounts/search_criteria/payment_report/payment_report.js b/accounts/search_criteria/payment_report/payment_report.js
new file mode 100644
index 0000000..96f7079
--- /dev/null
+++ b/accounts/search_criteria/payment_report/payment_report.js
@@ -0,0 +1,26 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Voucher Type'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
+
+  this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+  this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
+
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Payable Voucher', 'report_default':'Aging Date'});  
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
+
+}
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_report/payment_report.py b/accounts/search_criteria/payment_report/payment_report.py
new file mode 100644
index 0000000..99ce3e0
--- /dev/null
+++ b/accounts/search_criteria/payment_report/payment_report.py
@@ -0,0 +1,89 @@
+#check mendatory
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
+  raise Exception
+else:
+  from_date = filter_values.get('posting_date')
+  to_date = filter_values.get('posting_date1')
+
+if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
+  msgprint("Please select aging ranges in no of days in 'Set Filters' section")
+  raise Exception
+  
+# ageing based on
+aging_based_on = 'Aging Date'
+if filter_values.has_key('aging_based_on') and filter_values['aging_based_on']:
+  aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
+
+
+# Add columns
+# -----------
+row_list = [['ID','Data','150px',''],
+            ['Account','Data','150px',''],
+            ['Credit','Data','150px',''],
+            ['Debit','Data','150px',''],
+            ['Against Payable','Data','150px',''],
+            ['Is Advance','Data','150px',''],
+            ['Transaction Date','Date','150px',''],
+            ['Aging Date','Date','150px',''],
+            ['Cheque No','Data','100px',''],
+            ['Cheque Date','Date','150px',''],        
+            ['Supplier Type','Data','150px',''],
+            ['Remark','Data','250px',''],
+            ['Advance','Data','250px',''],
+            ['PV Transaction Date','Date','150px',''],
+            ['PV Aging Date','Date','150px',''],
+            ['Age (Days)','Data','100px',''],
+            ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
+            [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
+            [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
+            [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
+            [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]  
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+  
+
+for r in res:
+  if r[col_idx['Against Payable']]:
+    dt=sql("select voucher_date, aging_date from `tabPayable Voucher` where name='%s'"%r[col_idx['Against Payable']])
+    r.append('')
+    r.append(dt and cstr(dt[0][0]) or '')
+    r.append(dt and cstr(dt[0][1]) or '')
+  else:
+    r.append(r[col_idx['Debit']])
+    r.append('')
+    r.append('')
+
+  # Aging Credit Amount
+  val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = diff = 0
+
+  if r[col_idx['Against Payable']]:
+    amt = flt(r[col_idx['Debit']]) or (-1)*flt(r[col_idx['Credit']])
+
+    if aging_based_on == 'Transaction Date' and r[col_idx['PV Transaction Date']]:
+      diff = (getdate(r[col_idx['Transaction Date']]) - getdate(r[col_idx['PV Transaction Date']])).days
+    elif aging_based_on == 'Aging Date' and r[col_idx['PV Aging Date']]:
+      diff = (getdate(r[col_idx['Aging Date']]) - getdate(r[col_idx['PV Aging Date']])).days
+    
+    if diff < cint(filter_values['range_1']):
+      val_l1 = amt
+    if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
+      val_l2 = amt
+    if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
+      val_l3 = amt
+    if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
+      val_l4 = amt
+    if diff >= cint(filter_values['range_4']):
+      val_l5_above = amt
+
+  r.append(diff)
+  r.append(val_l1)
+  r.append(val_l2)
+  r.append(val_l3)
+  r.append(val_l4)
+  r.append(val_l5_above)
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_report/payment_report.sql b/accounts/search_criteria/payment_report/payment_report.sql
new file mode 100644
index 0000000..dec4f4e
--- /dev/null
+++ b/accounts/search_criteria/payment_report/payment_report.sql
@@ -0,0 +1,12 @@
+SELECT `tabJournal Voucher`.`name`,`tabJournal Voucher Detail`.`account`,`tabJournal Voucher Detail`.`credit`,`tabJournal Voucher Detail`.`debit`,`tabJournal Voucher Detail`.`against_voucher`,`tabJournal Voucher Detail`.`is_advance`,`tabJournal Voucher`.`voucher_date`,`tabJournal Voucher`.`aging_date`,`tabJournal Voucher`.`cheque_no`,`tabJournal Voucher`.`cheque_date`,`tabSupplier`.`supplier_type`,`tabJournal Voucher`.`remark`
+ FROM `tabJournal Voucher Detail`,`tabJournal Voucher`,`tabAccount`,`tabSupplier`
+ WHERE `tabJournal Voucher`.docstatus=1
+ AND `tabJournal Voucher`.`posting_date`>='%(posting_date)s'
+ AND `tabJournal Voucher`.`posting_date`<='%(posting_date1)s'
+ AND `tabJournal Voucher`.`company` LIKE '%(company)s%%'
+ AND `tabJournal Voucher Detail`.`account` LIKE '%(account)s%%'
+ AND `tabAccount`.`master_type` = 'Supplier'
+ AND `tabAccount`.`account_name` = `tabSupplier`.`name`
+ AND `tabJournal Voucher Detail`.`account` = `tabAccount`.`name`
+ AND `tabJournal Voucher Detail`.`parent` = `tabJournal Voucher`.`name`
+ ORDER BY `tabJournal Voucher`.`name`
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_report/payment_report.txt b/accounts/search_criteria/payment_report/payment_report.txt
new file mode 100644
index 0000000..0812f00
--- /dev/null
+++ b/accounts/search_criteria/payment_report/payment_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Is Advance',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Payment Report',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90','Receivable Voucher\x01Aging Based On':'','Payable Voucher\x01Aging Based On':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-10 09:48:52',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'payment_report',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabJournal Voucher`.`aging_date`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/progressive_total_excise_duty/__init__.py b/accounts/search_criteria/progressive_total_excise_duty/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/progressive_total_excise_duty/__init__.py
diff --git a/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.js b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.js
new file mode 100644
index 0000000..3771af8
--- /dev/null
+++ b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.js
@@ -0,0 +1,28 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  
+  this.add_filter({fieldname:'main_acc_head', label:'Main Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'edu_cess_acc_head', label:'Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'sh_edu_cess_acc_head', label:'S.H.Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  
+  // un-hide fields 
+  //this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', ignore : 1, parent:'Journal Voucher Detail'});
+  //this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', ignore : 1, parent:'Journal Voucher Detail'});
+  //this.add_filter({fieldname:'posting_date', label:'Posting Date', fieldtype:'Date', ignore : 1, parent:'Journal Voucher Detail'});
+  
+  
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  
+  // set defaults
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+
+  //this.large_report = 1;
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.py b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.py
new file mode 100644
index 0000000..07de853
--- /dev/null
+++ b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.py
@@ -0,0 +1,70 @@
+# Add columns
+# -----------
+row_list = [['Date', 'Date', '150px', '']
+           ,['INVOICE', 'Date', '150px', '']
+           ,['Baisc Excise Duty', 'Currency', '150px', '']
+           ,['Education Cess', 'Currency', '150px', '']
+           ,['S.H.Education Cess', 'Currency', '150px', '']
+           ,['Remarks', 'Data', '150px', '']
+]
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+# Get Object Of GL Control
+#import webnotes
+#import webnotes.model.code
+#from webnotes.model.code import get_obj
+#glc = webnotes.model.code.get_obj('GL Control')
+
+# Get Year Start Date
+ysd = sql("select year_start_date from `tabFiscal Year` where name='%s'" % filter_values['fiscal_year'])
+ysd = ysd and ysd[0][0] or ''
+
+# get as_on_date for opening
+as_on_date = ''
+if filter_values.get('posting_date'):
+  as_on_date = add_days(filter_values['posting_date'], -1)
+
+# Get Opening Balance
+def get_opening_balance(acc, fy, as_on_date, ysd, get_opening_balance):
+  #import webnotes
+  #import webnotes.model.code
+  #from webnotes.model.code import get_obj
+  #glc = webnotes.model.code.get_obj('GL Control')
+  glc = get_obj('GL Control')
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
+  return glc.get_as_on_balance(acc, fy, as_on_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+
+cum_sum_main_acc_head = cum_sum_add_acc_head = cum_sum_cvd_acc_head = cum_sum_edu_cess_acc_head = cum_sum_sh_edu_cess_acc_head = 0
+openg_main_acc_head = openg_add_acc_head = openg_cvd_acc_head = openg_edu_cess_acc_head = openg_sh_edu_cess_acc_head = 0
+
+# Get Opening of Basic Excise Duty
+if not filter_values['main_acc_head']: 
+  msgprint("Please Enter Main Account Head")
+  raise Exception
+cum_sum_main_acc_head = openg_main_acc_head = get_opening_balance(filter_values['main_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
+
+# Get Opening of edu_cess_acc_head
+if not filter_values['edu_cess_acc_head'] :
+  msgprint("Please Enter Edu Cess Account Head")
+  raise Exception
+cum_sum_edu_cess_acc_head = openg_edu_cess_acc_head = get_opening_balance(filter_values['edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
+
+# Get Opening of sh_edu_cess_acc_head
+if not filter_values['sh_edu_cess_acc_head'] :
+  msgprint("Please Enter S.H.Edu Cess Account Head")
+  raise Exception
+cum_sum_sh_edu_cess_acc_head = openg_sh_edu_cess_acc_head = get_opening_balance(filter_values['sh_edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
+
+out = []
+
+out.append(['Opening Balance of Duty in Credit', '', flt(openg_main_acc_head) + flt(openg_add_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head),''])
+out += res
+#if from_export == 0:
+#  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
+#  raise Exception
\ No newline at end of file
diff --git a/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.sql b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.sql
new file mode 100644
index 0000000..e43917a
--- /dev/null
+++ b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.sql
@@ -0,0 +1,28 @@
+SELECT t1.posting_date, t1.name, SUM(CASE WHEN t2.account_head like '%(main_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END), SUM(CASE WHEN t2.account_head like '%(edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(sh_edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END), '' AS remarks
+ FROM `tabDelivery Note` t1, `tabRV Tax Detail` t2
+ WHERE t2.parent = t1.name
+ AND t2.parenttype = 'Delivery Note'
+ AND (t2.account_head LIKE '%(main_acc_head)s%%'
+ OR t2.account_head LIKE '%(edu_cess_acc_head)s%%'
+ OR t2.account_head LIKE '%(sh_edu_cess_acc_head)s%%')
+ AND t1.`posting_date` >= '%(posting_date)s'
+ AND t1.`posting_date` <= '%(posting_date1)s'
+ AND t1.docstatus =1
+ GROUP BY t1.`name`
+
+UNION
+
+SELECT t1.posting_date, t1.name, SUM(CASE WHEN t2.account like '%(main_acc_head)s' THEN t2.credit ELSE 0.00 END), SUM(CASE WHEN t2.account like '%(edu_cess_acc_head)s' THEN t2.credit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(sh_edu_cess_acc_head)s' THEN t2.credit ELSE 0.00 END), t1.`remark`
+ FROM `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
+ WHERE (t2.credit is not NULL OR t2.credit != '')
+ AND t2.credit > 0
+ AND t2.parent = t1.name
+ AND (t2.account LIKE '%(main_acc_head)s%'
+ OR t2.account LIKE '%(edu_cess_acc_head)s%'
+ OR t2.account LIKE '%(sh_edu_cess_acc_head)s%') 
+ AND t1.`posting_date` >= '%(posting_date)s'
+ AND t1.`posting_date` <= '%(posting_date1)s'
+ AND t1.docstatus =1
+ GROUP BY t2.`parent`
+
+ORDER BY `posting_date`,`name`
\ No newline at end of file
diff --git a/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.txt b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.txt
new file mode 100644
index 0000000..cb9065f
--- /dev/null
+++ b/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Owner,Journal Voucher\x01Voucher Type,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher\x01Is Opening,Journal Voucher\x01Fiscal Year,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Clearance Date,Journal Voucher\x01TDS Applicable,Journal Voucher\x01TDS Category,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Cost Center,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
+		'creation': '2010-11-01 10:56:13',
+		'criteria_name': 'Progressive Total Excise Duty',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-29 16:44:43',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'progressive_total_excise_duty',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/purchase_register/__init__.py b/accounts/search_criteria/purchase_register/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/purchase_register/__init__.py
diff --git a/accounts/search_criteria/purchase_register/purchase_register.py b/accounts/search_criteria/purchase_register/purchase_register.py
new file mode 100644
index 0000000..c423b65
--- /dev/null
+++ b/accounts/search_criteria/purchase_register/purchase_register.py
@@ -0,0 +1,49 @@
+# add expense head columns
+expense_acc = [c[0] for c in sql("select distinct expense_head from `tabPV Detail` where parenttype='Payable Voucher' and docstatus=1 order by idx asc")]
+expense_acc.append('Net Total')
+
+for i in expense_acc:
+	colnames.append(i)
+	coltypes.append('Currency')
+	colwidths.append('100px')
+	coloptions.append('')
+
+# Add tax head columns
+tax_acc = [c[0] for c in sql("select distinct account_head from `tabPurchase Tax Detail` where parenttype='Payable Voucher' and category in ('For Total', 'For Both') and add_deduct_tax = 'Add' and docstatus=1 order by idx asc")]
+tax_acc.append('Total Tax')
+tax_acc.append('GrandTotal')
+
+for c in tax_acc:
+	if c:
+		colnames.append(c)
+		coltypes.append('Currency')
+		colwidths.append('100px')
+		coloptions.append('')
+
+# remove total columns from the list
+expense_acc = expense_acc[:-1]
+tax_acc = tax_acc[:-2]
+
+# add the values
+for r in res:
+	net_total = 0
+	
+	# get expense amount
+	for i in expense_acc:
+		val = sql("select sum(amount) from `tabPV Detail` where parent = %s and parenttype='Payable Voucher' and expense_head = %s", (r[col_idx['ID']], i))
+		val = flt(val and val[0][0] or 0)
+		net_total += val
+		r.append(val)
+	r.append(net_total)
+
+	# get tax amount
+	total_tax = 0
+	grand_total = 0
+	for c in tax_acc:
+		if c:
+			val = sql("select tax_amount from `tabPurchase Tax Detail` where parent = %s and parenttype='Payable Voucher' and account_head = %s and	category in ('For Total', 'For Both') and add_deduct_tax = 'Add'", (r[col_idx['ID']], c))
+			val = flt(val and val[0][0] or 0)
+			total_tax += val
+			r.append(val)
+	r.append(total_tax)
+	r.append(total_tax+net_total)	# grand total
diff --git a/accounts/search_criteria/purchase_register/purchase_register.txt b/accounts/search_criteria/purchase_register/purchase_register.txt
new file mode 100644
index 0000000..7fe3cdc
--- /dev/null
+++ b/accounts/search_criteria/purchase_register/purchase_register.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabPayable Voucher`.is_opening != 'Yes'\n`tabPayable Voucher`.name not like 'OP/%'",
+		'add_tab': None,
+		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Posting Date,Payable Voucher\x01Credit To,Payable Voucher\x01Expense Head',
+		'creation': '2010-12-15 08:39:24',
+		'criteria_name': 'Purchase Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Payable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Payable Voucher\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-06-06 14:37:00',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'purchase_register',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': None,
+		'sort_order': None,
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register/__init__.py b/accounts/search_criteria/sales_register/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/sales_register/__init__.py
diff --git a/accounts/search_criteria/sales_register/sales_register.js b/accounts/search_criteria/sales_register/sales_register.js
new file mode 100644
index 0000000..826fb4d
--- /dev/null
+++ b/accounts/search_criteria/sales_register/sales_register.js
@@ -0,0 +1,16 @@
+report.customize_filters = function() {
+ 
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
+}
diff --git a/accounts/search_criteria/sales_register/sales_register.py b/accounts/search_criteria/sales_register/sales_register.py
new file mode 100644
index 0000000..be74df3
--- /dev/null
+++ b/accounts/search_criteria/sales_register/sales_register.py
@@ -0,0 +1,44 @@
+# add additional columns
+
+cl = [c[0] for c in sql("select distinct account_head from `tabRV Tax Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+income_acc = [c[0] for c in sql("select distinct income_account from `tabRV Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+income_acc.append('Net Total')
+
+for i in income_acc:
+  colnames.append(i)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+
+cl.append('Total Tax')
+cl.append('Grand Total')
+for c in cl:
+  colnames.append(c)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+  
+income_acc = income_acc[:-1]
+cl = cl[:-2]
+
+
+# add the values
+for r in res:
+  net_total = 0
+  for i in income_acc:
+    val = sql("select sum(amount) from `tabRV Detail` where parent = %s and parenttype='Receivable Voucher' and income_account = %s", (r[col_idx['ID']], i))
+    val = flt(val and val[0][0] or 0)
+    net_total += val
+    r.append(val)
+  r.append(net_total)
+  
+  total_tax = 0
+  for c in cl:
+    val = sql("select tax_amount from `tabRV Tax Detail` where parent = %s and parenttype='Receivable Voucher' and account_head = %s", (r[col_idx['ID']], c))
+    val = flt(val and val[0][0] or 0)
+    total_tax += val
+    r.append(val)
+  r.append(total_tax)
+  r.append(net_total+total_tax)
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register/sales_register.txt b/accounts/search_criteria/sales_register/sales_register.txt
new file mode 100644
index 0000000..79536b0
--- /dev/null
+++ b/accounts/search_criteria/sales_register/sales_register.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
+		'add_cond': "ifnull(`tabReceivable Voucher`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabReceivable Voucher`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
+		'add_tab': '`tabAccount`\n`tabCustomer`',
+		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Posting Date,Receivable Voucher\x01Debit To',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Sales Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-10 10:48:01',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'sales_register',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`Parent Account`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register1/__init__.py b/accounts/search_criteria/sales_register1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/sales_register1/__init__.py
diff --git a/accounts/search_criteria/sales_register1/sales_register1.js b/accounts/search_criteria/sales_register1/sales_register1.js
new file mode 100644
index 0000000..826fb4d
--- /dev/null
+++ b/accounts/search_criteria/sales_register1/sales_register1.js
@@ -0,0 +1,16 @@
+report.customize_filters = function() {
+ 
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
+}
diff --git a/accounts/search_criteria/sales_register1/sales_register1.py b/accounts/search_criteria/sales_register1/sales_register1.py
new file mode 100644
index 0000000..be74df3
--- /dev/null
+++ b/accounts/search_criteria/sales_register1/sales_register1.py
@@ -0,0 +1,44 @@
+# add additional columns
+
+cl = [c[0] for c in sql("select distinct account_head from `tabRV Tax Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+income_acc = [c[0] for c in sql("select distinct income_account from `tabRV Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+income_acc.append('Net Total')
+
+for i in income_acc:
+  colnames.append(i)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+
+cl.append('Total Tax')
+cl.append('Grand Total')
+for c in cl:
+  colnames.append(c)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+  
+income_acc = income_acc[:-1]
+cl = cl[:-2]
+
+
+# add the values
+for r in res:
+  net_total = 0
+  for i in income_acc:
+    val = sql("select sum(amount) from `tabRV Detail` where parent = %s and parenttype='Receivable Voucher' and income_account = %s", (r[col_idx['ID']], i))
+    val = flt(val and val[0][0] or 0)
+    net_total += val
+    r.append(val)
+  r.append(net_total)
+  
+  total_tax = 0
+  for c in cl:
+    val = sql("select tax_amount from `tabRV Tax Detail` where parent = %s and parenttype='Receivable Voucher' and account_head = %s", (r[col_idx['ID']], c))
+    val = flt(val and val[0][0] or 0)
+    total_tax += val
+    r.append(val)
+  r.append(total_tax)
+  r.append(net_total+total_tax)
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register1/sales_register1.txt b/accounts/search_criteria/sales_register1/sales_register1.txt
new file mode 100644
index 0000000..47d4e19
--- /dev/null
+++ b/accounts/search_criteria/sales_register1/sales_register1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
+		'add_cond': "ifnull(`tabReceivable Voucher`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabReceivable Voucher`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
+		'add_tab': '`tabAccount`\n`tabCustomer`',
+		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Posting Date,Receivable Voucher\x01Debit To',
+		'creation': '2010-12-15 08:39:21',
+		'criteria_name': 'Sales Register1',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:19:10',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'sales_register1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`Parent Account`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register2/__init__.py b/accounts/search_criteria/sales_register2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/sales_register2/__init__.py
diff --git a/accounts/search_criteria/sales_register2/sales_register2.js b/accounts/search_criteria/sales_register2/sales_register2.js
new file mode 100644
index 0000000..586c0c2
--- /dev/null
+++ b/accounts/search_criteria/sales_register2/sales_register2.js
@@ -0,0 +1,17 @@
+report.customize_filters = function() {
+ 
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
+  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
+  
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register2/sales_register2.py b/accounts/search_criteria/sales_register2/sales_register2.py
new file mode 100644
index 0000000..9685e9a
--- /dev/null
+++ b/accounts/search_criteria/sales_register2/sales_register2.py
@@ -0,0 +1,51 @@
+# add additional columns
+
+colnames.append('Income Account')
+coltypes.append('Text')
+colwidths.append('200px')
+coloptions.append('')
+
+cl = [c[0] for c in sql("select distinct account_head from `tabRV Tax Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+income_acc = [c[0] for c in sql("select distinct income_account from `tabRV Detail` where parenttype='Receivable Voucher' and docstatus=1 order by idx asc")]
+
+income_acc.append('Net Total')
+
+for i in income_acc:
+  colnames.append(i)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+
+cl.append('Total Tax')
+cl.append('Grand Total')
+for c in cl:
+  colnames.append(c)
+  coltypes.append('Currency')
+  colwidths.append('100px')
+  coloptions.append('')
+  
+income_acc = income_acc[:-1]
+cl = cl[:-2]
+
+
+# add the values
+for r in res:
+  income_acc_list = [c[0] for c in sql("select distinct income_account from `tabRV Detail` where parenttype='Receivable Voucher' and docstatus=1 and parent = %s order by idx asc", r[col_idx['ID']])]
+  r.append(cstr(income_acc_list))
+  net_total = 0
+  for i in income_acc:
+    val = sql("select sum(amount) from `tabRV Detail` where parent = %s and parenttype='Receivable Voucher' and income_account = %s", (r[col_idx['ID']], i))
+    val = flt(val and val[0][0] or 0)
+    net_total += val
+    r.append(val)
+  r.append(net_total)
+  
+  total_tax = 0
+  for c in cl:
+    val = sql("select tax_amount from `tabRV Tax Detail` where parent = %s and parenttype='Receivable Voucher' and account_head = %s", (r[col_idx['ID']], c))
+    val = flt(val and val[0][0] or 0)
+    total_tax += val
+    r.append(val)
+  r.append(total_tax)
+  r.append(net_total+total_tax)
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register2/sales_register2.txt b/accounts/search_criteria/sales_register2/sales_register2.txt
new file mode 100644
index 0000000..18cda2c
--- /dev/null
+++ b/accounts/search_criteria/sales_register2/sales_register2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
+		'add_cond': "ifnull(`tabReceivable Voucher`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabReceivable Voucher`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
+		'add_tab': '`tabAccount`\n`tabCustomer`',
+		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Owner,Receivable Voucher\x01Debit To',
+		'creation': '2010-10-20 13:07:11',
+		'criteria_name': 'Sales Register2',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:19:19',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'sales_register2',
+		'owner': 'saumil@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`Parent Account`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/service_tax_credit_account___inputs/__init__.py b/accounts/search_criteria/service_tax_credit_account___inputs/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/service_tax_credit_account___inputs/__init__.py
diff --git a/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.js b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.js
new file mode 100644
index 0000000..c87a927
--- /dev/null
+++ b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.js
@@ -0,0 +1,27 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'main_acc_head', label:'Main Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'edu_cess_acc_head', label:'Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  this.add_filter({fieldname:'sh_edu_cess_acc_head', label:'S.H.Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
+  
+  // un-hide fields 
+  //this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', ignore : 1, parent:'Journal Voucher Detail'});
+  //this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', ignore : 1, parent:'Journal Voucher Detail'});
+  //this.add_filter({fieldname:'posting_date', label:'Posting Date', fieldtype:'Date', ignore : 1, parent:'Journal Voucher Detail'});
+  
+  
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  
+  // set defaults
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+
+  //this.large_report = 1;
+}
\ No newline at end of file
diff --git a/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.py b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.py
new file mode 100644
index 0000000..b10307b
--- /dev/null
+++ b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.py
@@ -0,0 +1,119 @@
+# Add columns
+# -----------
+row_list = [['Date', 'Date', '150px', '']
+           ,['ARI/INVOICE/Other Approved document/Bill of entry No.', 'Date', '150px', '']
+           ,['Date', 'Date', '150px', '']
+           ,['Service Tax', 'Currency', '150px', '']
+           ,['Education Cess', 'Currency', '150px', '']
+           ,['S.H.Education Cess', 'Currency', '150px', '']
+           ,[' Service Tax ', 'Currency', '150px', '']
+           ,[' Education Cess ', 'Currency', '150px', '']
+           ,[' S.H.Education Cess ', 'Currency', '150px', '']
+           ,['ARI/INVOICE/ Other Approved document/Bill of entry No.', 'Data', '100px', '']
+           ,['Date', 'Date', '150px', '']
+           ,[' Service Tax', 'Currency', '150px', '']
+           ,[' Education Cess', 'Currency', '150px', '']
+           ,[' S.H.Education Cess', 'Currency', '150px', '']
+           ,['Service Tax ', 'Currency', '150px', '']
+           ,['Education Cess ', 'Currency', '150px', '']
+           ,['S.H.Education Cess ', 'Currency', '150px', '']
+           ,['Remarks', 'Data', '150px', '']
+]
+
+ 
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+# Get Object Of GL Control
+#import webnotes
+#import webnotes.model.code
+#from webnotes.model.code import get_obj
+#glc = webnotes.model.code.get_obj('GL Control')
+
+# Get Year Start Date
+ysd = sql("select year_start_date from `tabFiscal Year` where name='%s'" % filter_values['fiscal_year'])
+ysd = ysd and ysd[0][0] or ''
+
+# get as_on_date for opening
+as_on_date = ''
+if filter_values.get('posting_date'):
+  as_on_date = add_days(filter_values['posting_date'], -1)
+
+# Get Opening Balance
+def get_opening_balance(acc, fy, as_on_date, ysd, get_opening_balance):
+  #import webnotes
+  #import webnotes.model.code
+  #from webnotes.model.code import get_obj
+  #glc = webnotes.model.code.get_obj('GL Control')
+  glc = get_obj('GL Control')
+  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
+  return glc.get_as_on_balance(acc, fy, as_on_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
+
+cum_sum_main_acc_head = cum_sum_edu_cess_acc_head = cum_sum_sh_edu_cess_acc_head = 0
+openg_main_acc_head = openg_edu_cess_acc_head = openg_sh_edu_cess_acc_head = 0
+
+# Get Opening of Basic Excise Duty
+if not filter_values['main_acc_head']: 
+  msgprint("Please Enter Main Account Head")
+  raise Exception
+cum_sum_main_acc_head = openg_main_acc_head = get_opening_balance(filter_values['main_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
+
+# Get Opening of edu_cess_acc_head
+if not filter_values['edu_cess_acc_head'] :
+  msgprint("Please Enter Edu Cess Account Head")
+  raise Exception
+cum_sum_edu_cess_acc_head = openg_edu_cess_acc_head = get_opening_balance(filter_values['edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
+
+# Get Opening of sh_edu_cess_acc_head
+if not filter_values['sh_edu_cess_acc_head'] :
+  msgprint("Please Enter S.H.Edu Cess Account Head")
+  raise Exception
+cum_sum_sh_edu_cess_acc_head = openg_sh_edu_cess_acc_head = get_opening_balance(filter_values['sh_edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
+
+msgprint("Column No "+ cstr(len(col_idx)))
+msgprint(openg_sh_edu_cess_acc_head)
+msgprint(openg_main_acc_head)
+for r in res:
+  msgprint(r)
+  r[col_idx['Service Tax']] = flt(r[col_idx['Education Cess']])
+  r[col_idx['Education Cess']] = flt(r[col_idx['S.H.Education Cess']])
+  r[col_idx['S.H.Education Cess']] = flt(r[col_idx[' Service Tax ']])
+  
+  remarks = r[col_idx[' Education Cess ']]
+ 
+  cum_sum_main_acc_head = flt(cum_sum_main_acc_head) + flt(r[col_idx['Service Tax']])
+  r[col_idx[' Service Tax ']] = cum_sum_main_acc_head
+
+  cum_sum_edu_cess_acc_head = flt(cum_sum_edu_cess_acc_head) + flt(r[col_idx['Education Cess']])
+  r[col_idx[' Education Cess ']] = cum_sum_edu_cess_acc_head
+
+  cum_sum_sh_edu_cess_acc_head = flt(cum_sum_sh_edu_cess_acc_head) + flt(r[col_idx['S.H.Education Cess']])
+  r.append(cum_sum_sh_edu_cess_acc_head)
+
+  r.append('') 
+  r.append('')
+
+  r.append(0) 
+  r.append(0)
+  r.append(0) 
+
+  r.append(cum_sum_main_acc_head)
+  r.append(cum_sum_edu_cess_acc_head) 
+  r.append(cum_sum_sh_edu_cess_acc_head)
+  
+  r.append(remarks)
+ 
+#msgprint(len(res))
+#msgprint(query)
+out = []
+
+msgprint(len(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '', '', '',  flt(openg_main_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head)]))
+out.append(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '', '', '', flt(openg_main_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head)])
+out += res
+#if from_export == 0:
+#  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
+#  raise Exception
\ No newline at end of file
diff --git a/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.sql b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.sql
new file mode 100644
index 0000000..0ecbcbb
--- /dev/null
+++ b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.sql
@@ -0,0 +1,13 @@
+SELECT t1.posting_date, t1.bill_no, t1.bill_date, t1.name, SUM(CASE WHEN t2.account like '%(main_acc_head)s%' THEN t2.debit ELSE 0.00 END), SUM(CASE WHEN t2.account like '%(edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(sh_edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END), t1.`remark`
+ FROM `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
+ WHERE (t2.debit is not NULL OR t2.debit != '')
+ AND t2.debit > 0
+ AND t2.parent = t1.name
+ AND (t2.account LIKE '%(main_acc_head)s%%'
+ OR t2.account LIKE '%(edu_cess_acc_head)s%%'
+ OR t2.account LIKE '%(sh_edu_cess_acc_head)s%%') 
+ AND t1.`posting_date` >= '%(posting_date)s'
+ AND t1.`posting_date` <= '%(posting_date1)s'
+ AND t1.docstatus =1
+ GROUP BY t2.`parent`
+ ORDER BY t1.`posting_date`,t1.`name`
\ No newline at end of file
diff --git a/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.txt b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.txt
new file mode 100644
index 0000000..acdd8fd
--- /dev/null
+++ b/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Owner,Journal Voucher\x01Voucher Type,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher\x01Is Opening,Journal Voucher\x01Fiscal Year,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Clearance Date,Journal Voucher\x01TDS Applicable,Journal Voucher\x01TDS Category,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Cost Center,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
+		'creation': '2010-11-01 10:56:13',
+		'criteria_name': 'Service Tax Credit Account - Inputs',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Journal Voucher Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-29 16:42:59',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'service_tax_credit_account_-_inputs',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Journal Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/tds_return/__init__.py b/accounts/search_criteria/tds_return/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/tds_return/__init__.py
diff --git a/accounts/search_criteria/tds_return/tds_return.js b/accounts/search_criteria/tds_return/tds_return.js
new file mode 100644
index 0000000..95f03a0
--- /dev/null
+++ b/accounts/search_criteria/tds_return/tds_return.js
@@ -0,0 +1,21 @@
+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
new file mode 100644
index 0000000..4ee2770
--- /dev/null
+++ b/accounts/search_criteria/tds_return/tds_return.py
@@ -0,0 +1,34 @@
+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
new file mode 100644
index 0000000..17eb970
--- /dev/null
+++ b/accounts/search_criteria/tds_return/tds_return.sql
@@ -0,0 +1,10 @@
+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
new file mode 100644
index 0000000..371a80e
--- /dev/null
+++ b/accounts/search_criteria/tds_return/tds_return.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '',
+		'add_cond': '',
+		'add_tab': '',
+		'columns': '',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'TDS Return',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': None,
+		'doc_type': 'TDS Payment Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'TDS Payment\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-30 14:38:18',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'tds_return',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': 'TDS Payment',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': '',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/__init__.py b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/__init__.py
diff --git a/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.js b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.js
new file mode 100644
index 0000000..e1c127b
--- /dev/null
+++ b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.js
@@ -0,0 +1,26 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Account'});
+
+  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
+  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Account'+FILTER_SEP+'Company'].df['report_default']=sys_defaults.company;
+
+  this.dt.set_no_limit(1);
+
+  report.aftertableprint = function(t) {
+    $yt(t,'*',1,{whiteSpace:'pre'});
+  }
+}
+
+this.mytabs.items['Select Columns'].hide();
+this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.py b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.py
new file mode 100644
index 0000000..752c002
--- /dev/null
+++ b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.py
@@ -0,0 +1,44 @@
+# columns
+colnames[0] = 'Account'
+col_idx['Account'] = 0
+coltypes[0] = 'Link'
+coloptions[0] =  'Account'
+colwidths[0] = '200px'
+
+cl = [['Debit', 'Data', '100px'],['Credit', 'Data', '100px']]
+for c in cl:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append('')
+  col_idx[c[0]] = len(colnames)-1
+  
+
+# transaction date
+if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'):
+  msgprint("Please enter From Date and To Date")
+  raise Exception
+else:
+  from_date = add_days(filter_values['transaction_date'], -1)
+  to_date = filter_values['transaction_date1']
+
+# if output is more than 300 lines then it will ask to export
+if len(res) > 300  and from_export == 0:
+  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
+  raise Exception
+
+total_debit, total_credit = 0,0
+
+for r in res:
+  amount = sql("select sum(debit), sum(credit) from `tabGL Entry` WHERE posting_date >= '%s' AND posting_date <= '%s' and ifnull(is_opening,'No') = 'No' AND account = '%s' AND ifnull(is_cancelled, 'No') = 'No'" % (from_date,to_date, r[col_idx['Account']].strip()))
+  total_debit = flt(total_debit) + flt(amount[0][0])
+  total_credit = flt(total_credit) + flt(amount[0][1])
+
+  r.append(flt(amount[0][0]))
+  r.append(flt(amount[0][1]))
+
+t_row = ['' for i in range(len(colnames))]
+t_row[col_idx['Account']] = 'Total'
+t_row[col_idx['Debit']] = total_debit
+t_row[col_idx['Credit']] = total_credit
+res.append(t_row)
\ No newline at end of file
diff --git a/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.txt b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.txt
new file mode 100644
index 0000000..67e9cde
--- /dev/null
+++ b/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '(master_type = "Customer" or parent_account like "Sundry Debtors%" or parent_account like "Accounts Receivable%")',
+		'add_tab': None,
+		'columns': 'Account\x01ID',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Total amout collection for a period - Customerwise',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'transaction_date',
+		'disabled': 0,
+		'doc_type': 'Account',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Account\x01Saved':1,'Account\x01Group or Ledger':'','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01From Date\x01lower':'2010-04-01','Account\x01To Date\x01upper':'2010-06-09'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-09 18:09:34',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'total_amout_collection_for_a_period_-_customerwise',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabAccount`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/trial_balance/__init__.py b/accounts/search_criteria/trial_balance/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/trial_balance/__init__.py
diff --git a/accounts/search_criteria/trial_balance/trial_balance.js b/accounts/search_criteria/trial_balance/trial_balance.js
new file mode 100644
index 0000000..5fd6049
--- /dev/null
+++ b/accounts/search_criteria/trial_balance/trial_balance.js
@@ -0,0 +1,31 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.add_filter({fieldname:'show_group_balance', label:'Show Group Balance', fieldtype:'Select', options:'Yes'+NEWLINE+'No',ignore : 1, parent:'Account', 'report_default':'No','in_first_page':1});
+  this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Account', 'in_first_page':1});
+
+  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+
+  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.in_first_page = 1;
+
+  this.dt.set_no_limit(1);
+}
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
+if(window.location.href.search('/v170/') != -1) {
+  this.mytabs.items['More Filters'].hide();
+  this.mytabs.items['Select Columns'].hide();
+} else {
+  $dh(this.mytabs.tabs['More Filters']);
+  $dh(this.mytabs.tabs['Select Columns']);
+}
diff --git a/accounts/search_criteria/trial_balance/trial_balance.py b/accounts/search_criteria/trial_balance/trial_balance.py
new file mode 100644
index 0000000..a4c3f82
--- /dev/null
+++ b/accounts/search_criteria/trial_balance/trial_balance.py
@@ -0,0 +1,110 @@
+
+# Columns
+#----------
+cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing', 'Data', '100px']]
+for c in cl:
+	colnames.append(c[0])
+	coltypes.append(c[1])
+	colwidths.append(c[2])
+	coloptions.append('')
+	col_idx[c[0]] = len(colnames)-1
+	
+# transaction date
+# ------------------
+if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'):
+	msgprint("Please enter From Date and To Date")
+	raise Exception
+else:
+	from_date = filter_values['transaction_date']
+	to_date = filter_values['transaction_date1']
+
+#check for from date and to date within same year
+#------------------------------------------------
+if not sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day) and %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",(from_date, to_date)):
+	msgprint("From Date and To Date must be within same year")
+	raise Exception
+
+# get year of the from date and to date 
+# --------------------------------------
+from_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",add_days(from_date, -1))
+from_date_year = from_date_year and from_date_year[0][0] or ''
+
+to_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",to_date)
+to_date_year = to_date_year and to_date_year[0][0] or ''
+
+# if output is more than 500 lines then it will ask to export
+# ------------------------------------------------------------
+if len(res) > 500	and from_export == 0:
+	msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
+	raise Exception
+
+total_debit, total_credit = 0,0
+glc = get_obj('GL Control')
+
+# Main logic
+# ----------------
+for r in res:
+	# Fetch account details
+	acc = r[col_idx['Account']].strip()
+	acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
+	r.append(acc_det[0][0])
+	r.append(acc_det[0][4])
+	r.append(acc_det[0][1])
+	
+	# if group, check user input
+	if acc_det[0][4] == 'Group' and filter_values.get('show_group_balance') == 'No':
+		for i in range(4):
+			r.append('')
+		continue	
+
+	# opening balance
+	if from_date_year:
+		debit_on_fromdate, credit_on_fromdate, opening = glc.get_as_on_balance(acc, from_date_year, add_days(from_date, -1), acc_det[0][0], acc_det[0][2], acc_det[0][3])
+	else: # if there is no previous year in system
+		debit_on_fromdate, credit_on_fromdate, opening = 0, 0, 0
+
+	# closing balance
+	debit_on_todate, credit_on_todate, closing = glc.get_as_on_balance(acc, to_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])
+
+	# transaction betn the period
+	if from_date_year == to_date_year:
+		debit = flt(debit_on_todate) - flt(debit_on_fromdate)
+		credit = flt(credit_on_todate) - flt(credit_on_fromdate)
+	else: # may be wrong
+		debit = flt(debit_on_todate)
+		credit = flt(credit_on_todate)
+		
+	total_debit += debit
+	total_credit += credit
+
+	if acc_det[0][1] == 'Yes' and from_date_year != to_date_year:
+		opening = 0
+
+	if acc_det[0][0] == 'Credit':
+		opening, closing = -1*opening, -1*closing
+	
+	r.append(flt(opening))
+	r.append(flt(debit))
+	r.append(flt(credit))
+	r.append(flt(closing))
+
+
+# Remove accounts if closing bal = debit = credit = 0
+# -----------------------------------------------------
+
+out =[]
+for r in res:
+	if r[col_idx['Opening']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing']]:
+		out.append(r)
+
+	if r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_balance') == 'No':
+		out.append(r)
+		
+# Total Debit / Credit
+# --------------------------
+if filter_values.get('show_group_balance') == 'No':
+	t_row = ['' for i in range(len(colnames))]
+	t_row[col_idx['Account']] = 'Total'
+	t_row[col_idx['Debit']] = total_debit
+	t_row[col_idx['Credit']] = total_credit
+	out.append(t_row)
diff --git a/accounts/search_criteria/trial_balance/trial_balance.sql b/accounts/search_criteria/trial_balance/trial_balance.sql
new file mode 100644
index 0000000..1f256eb
--- /dev/null
+++ b/accounts/search_criteria/trial_balance/trial_balance.sql
@@ -0,0 +1 @@
+SELECT CONCAT( REPEAT('   ', COUNT(parent.name) - 1), node.name) AS name FROM tabAccount AS node,tabAccount AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt and node.company = '%(company)s' and node.docstatus != 2 GROUP BY node.name ORDER BY node.lft
diff --git a/accounts/search_criteria/trial_balance/trial_balance.txt b/accounts/search_criteria/trial_balance/trial_balance.txt
new file mode 100644
index 0000000..308d24f
--- /dev/null
+++ b/accounts/search_criteria/trial_balance/trial_balance.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': None,
+		'columns': 'Account\x01ID',
+		'creation': '2010-12-14 10:33:08',
+		'criteria_name': 'Trial Balance',
+		'custom_query': None,
+		'description': 'Trial Balance',
+		'dis_filters': 'transaction_date',
+		'disabled': None,
+		'doc_type': 'Account',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01Show Group Balance':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-25 12:25:28',
+		'modified_by': 'Administrator',
+		'module': 'Accounts',
+		'name': 'trial_balance',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabAccount`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/analysis/Module Def/Analysis/Analysis.txt b/analysis/Module Def/Analysis/Analysis.txt
new file mode 100644
index 0000000..97bbb43
--- /dev/null
+++ b/analysis/Module Def/Analysis/Analysis.txt
@@ -0,0 +1,253 @@
+[
+	{
+		'_last_update': '1300959286',
+		'creation': '2010-11-30 17:31:05',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-12-02 09:25:40',
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'module_desc': None,
+		'module_icon': 'chart.png',
+		'module_label': 'Analysis',
+		'module_name': 'Analysis',
+		'module_page': None,
+		'module_seq': 10,
+		'name': 'Analysis',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Reports',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': '000003012',
+		'owner': 'Administrator',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'Yearly Transaction Summary',
+		'doc_name': 'Profile',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': '000003014',
+		'owner': 'Administrator',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:05',
+		'description': 'A quick glance at your work in progress and pipeline',
+		'display_name': 'Work in Progress Monitor',
+		'doc_name': 'WIP Monitor',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'magnifier.gif',
+		'idx': 3,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': 'MDI00063',
+		'owner': 'Administrator',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': 'Analyze trend of sales, purchase and stock over any period',
+		'display_name': 'Monthly Trend Analyzer',
+		'doc_name': 'Profile',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'chart_bar.gif',
+		'idx': 4,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': '000003013',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Reports',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': '000003012',
+		'owner': 'Administrator',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'Yearly Transaction Summary',
+		'doc_name': 'Profile',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': '000003014',
+		'owner': 'Administrator',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:05',
+		'description': 'A quick glance at your work in progress and pipeline',
+		'display_name': 'Work in Progress Monitor',
+		'doc_name': 'WIP Monitor',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'magnifier.gif',
+		'idx': 3,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': 'MDI00063',
+		'owner': 'Administrator',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': 'Analyze trend of sales, purchase and stock over any period',
+		'display_name': 'Monthly Trend Analyzer',
+		'doc_name': 'Profile',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'chart_bar.gif',
+		'idx': 4,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': '000003013',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Analysis',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 17:31:05',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': 'MDR00004',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Analysis',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Manager'
+	},
+	{
+		'creation': '2010-11-30 17:31:05',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': 'MDR00005',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Analysis',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Manager'
+	},
+	{
+		'creation': '2010-11-30 17:31:05',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': 'MDR00006',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Analysis',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Manager'
+	},
+	{
+		'creation': '2010-11-30 17:31:05',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2011-03-24 15:28:54',
+		'modified_by': 'Administrator',
+		'name': 'MDR00007',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Analysis',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts Manager'
+	}
+]
\ No newline at end of file
diff --git a/analysis/__init__.py b/analysis/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/__init__.py
diff --git a/analysis/doctype/__init__.py b/analysis/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/doctype/__init__.py
diff --git a/analysis/doctype/mis_control/__init__.py b/analysis/doctype/mis_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/doctype/mis_control/__init__.py
diff --git a/analysis/doctype/mis_control/mis_control.py b/analysis/doctype/mis_control/mis_control.py
new file mode 100644
index 0000000..08a71f2
--- /dev/null
+++ b/analysis/doctype/mis_control/mis_control.py
@@ -0,0 +1,403 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+    self.account_list = []
+    self.ac_details = {} # key: account id, values: debit_or_credit, lft, rgt
+    
+    self.roles = webnotes.user.get_roles()
+
+    self.period_list = []
+    self.period_start_date = {}
+    self.period_end_date = {}
+
+    self.fs_list = []
+    self.root_bal = []
+    self.flag = 0
+
+  # Get defaults on load of MIS, MIS - Comparison Report and Financial statements
+  # ----------------------------------------------------
+  def get_comp(self):
+    ret = {}
+    type = []
+    comp = []
+    # ------ get period -----------
+    ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
+    
+    # ---- get companies ---------
+    res = sql("select name from `tabCompany`")
+    comp.append('All')
+    for r in res:
+      comp.append(r[0])
+    #comp.append(r[0] for r in res)
+    ret['company'] = comp
+
+    #--- to get fiscal year and start_date of that fiscal year -----
+    res = sql("select name, year_start_date from `tabFiscal Year`")
+    ret['fiscal_year'] = [r[0] for r in res]
+    ret['start_dates'] = {}
+    for r in res:
+      ret['start_dates'][r[0]] = str(r[1])
+      
+    #--- from month and to month (for MIS - Comparison Report) -------
+    month_list = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+    fiscal_start_month = sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(get_defaults()['fiscal_year']))
+    fiscal_start_month = fiscal_start_month and fiscal_start_month[0][0] or 1
+    mon = ['']
+    for i in range(fiscal_start_month,13): mon.append(month_list[i-1])
+    for i in range(0,fiscal_start_month-1): mon.append(month_list[i])
+    ret['month'] = mon
+
+    # ------------------------ get MIS Type on basis of roles of session user ------------------------------------------
+    if has_common(self.roles, ['Sales Manager']):
+      type.append('Sales')
+    if has_common(self.roles, ['Purchase Manager']):
+      type.append('Purchase')
+    ret['type'] = type
+    return ret
+    
+  # Gets Transactions type and Group By options based on module
+  #------------------------------------------------------------------
+  def get_trans_group(self,module):
+    ret = {}
+    st,group = [],[]
+    if module == 'Sales':
+      st = ['Quotation','Sales Order','Delivery Note','Receivable Voucher']
+      group = ['Item','Item Group','Customer','Customer Group','Cost Center']
+    elif module == 'Purchase':
+      st = ['Purchase Order','Purchase Receipt','Payable Voucher']
+      group = ['Item','Item Group','Supplier','Supplier Type']
+    
+    ret['stmt_type'] = st
+    ret['group_by'] = group
+    
+    return ret
+
+  # Get Days based on month (for MIS Comparison Report)
+  # --------------------------------------------------------
+  def get_days(self,month):
+    days = []
+    ret = {}
+    if month == 'Jan' or month == 'Mar' or month == 'May' or month == 'Jul' or month == 'Aug' or month == 'Oct' or month == 'Dec':
+      for i in range(1,32):
+        days.append(i)
+    elif month == 'Apr' or month == 'Jun' or month == 'Sep' or month == 'Nov':
+      for i in range(1,31):
+        days.append(i)
+    elif month == 'Feb':
+      for i in range(1,29):
+        days.append(i)
+    ret['days'] = days
+    return ret
+	
+  # Get from date and to date based on fiscal year (for in summary - comparison report)
+  # -----------------------------------------------------------------------------------------------------
+  def dates(self,fiscal_year,from_date,to_date):
+    import datetime
+    ret = ''
+    start_date = cstr(sql("select year_start_date from `tabFiscal Year` where name = %s",fiscal_year)[0][0])
+    st_mon = cint(from_date.split('-')[1])
+    ed_mon = cint(to_date.split('-')[1])
+    st_day = cint(from_date.split('-')[2])
+    ed_day = cint(to_date.split('-')[2])
+    fiscal_start_month = cint(start_date.split('-')[1])
+    next_fiscal_year = cint(start_date.split('-')[0]) + 1
+    current_year = ''
+    next_year = ''
+    
+    #CASE - 1 : Jan - Mar (Valid)
+    if st_mon < fiscal_start_month and ed_mon < fiscal_start_month:
+      current_year = cint(start_date.split('-')[0]) + 1
+      next_year  = cint(start_date.split('-')[0]) + 1
+    
+    # Case - 2 : Apr - Dec (Valid)
+    elif st_mon >= fiscal_start_month and ed_mon <= 12 and ed_mon >= fiscal_start_month:
+      current_year = cint(start_date.split('-')[0])
+      next_year  = cint(start_date.split('-')[0])
+
+    # Case 3 : Jan - May (Invalid)
+    elif st_mon < fiscal_start_month and ed_mon >= fiscal_start_month:
+      current_year = cint(start_date.split('-')[0]) + 1
+      next_year  = cint(start_date.split('-')[0]) + 2
+	
+    # check whether from date is within fiscal year
+    if datetime.date(current_year, st_mon, st_day) >= datetime.date(cint(start_date.split('-')[0]), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])) and datetime.date(cint(current_year), cint(st_mon), cint(st_day)) < datetime.date((cint(start_date.split('-')[0])+1), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])):
+      begin_date = cstr(current_year)+"-"+cstr(st_mon)+"-"+cstr(st_day)
+    else:
+      msgprint("Please enter appropriate from date.")
+      raise Exception
+    # check whether to date is within fiscal year
+    if datetime.date(next_year, ed_mon, ed_day) >= datetime.date(cint(start_date.split('-')[0]), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])) and datetime.date(cint(next_year), cint(ed_mon), cint(ed_day)) < datetime.date(cint(start_date.split('-')[0])+1, cint(start_date.split('-')[1]), cint(start_date.split('-')[2])):
+      end_date = cstr(next_year)+"-"+cstr(ed_mon)+"-"+cstr(ed_day)
+    else:
+      msgprint("Please enter appropriate to date.")
+      raise Exception
+    ret = begin_date+'~~~'+end_date
+    return ret
+
+  # Get MIS Totals
+  # ---------------
+  def get_totals(self, args):
+    args = eval(args)
+    #msgprint(args)
+    totals = sql("SELECT %s FROM %s WHERE %s %s %s %s" %(cstr(args['query_val']), cstr(args['tables']), cstr(args['company']), cstr(args['cond']), cstr(args['add_cond']), cstr(args['fil_cond'])), as_dict = 1)[0]
+    #msgprint(totals)
+    tot_keys = totals.keys()
+    # return in flt because JSON doesn't accept Decimal
+    for d in tot_keys:
+      totals[d] = flt(totals[d])
+    return totals
+
+  # Get Statement
+  # -------------
+  
+  def get_statement(self, arg): 
+    self.return_data = []    
+
+    # define periods
+    arg = eval(arg)
+    pl = ''
+    
+    self.define_periods(arg['year'], arg['period'])    # declares 1.period_list i.e. (['Jan','Feb','Mar'...] or ['Q1','Q2'...] or ['FY2009-2010']) based on period
+                                                       #          2.period_start_date dict {'Jan':'01-01-2009'...}
+                                                       #          3.period_start_date dict {'Jan':'31-01-2009'...}
+    self.return_data.append([4,'']+self.period_list)
+
+        
+    if arg['statement'] == 'Balance Sheet': pl = 'No'
+    if arg['statement'] == 'Profit & Loss': pl = 'Yes'
+    
+    self.get_children('',0,pl,arg['company'], arg['year'])
+        
+    #self.balance_pl_statement(acct, arg['statement'])
+    #msgprint(self.return_data)
+    return self.return_data
+    
+  # Get Children
+  # ------------
+  def get_children(self, parent_account, level, pl, company, fy):
+    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s order by name asc", (parent_account, pl, company))
+    level0_diff = [0 for p in self.period_list]
+    if pl=='Yes' and level==0: # switch for income & expenses
+      cl = [c for c in cl]
+      cl.reverse()
+    if cl:
+      for c in cl:
+        self.ac_details[c[1]] = [c[2], c[3], c[4]]
+        bal_list = self.get_period_balance(c[1], level, pl, company, fy)
+        if level==0: # top level - put balances as totals
+          self.return_data.append([level, c[0]] + ['' for b in bal_list])
+          totals = bal_list
+          for i in range(len(totals)): # make totals
+            if c[2]=='Credit':
+              level0_diff[i] += flt(totals[i])
+            else:
+              level0_diff[i] -= flt(totals[i])
+        else:
+          self.return_data.append([level, c[0]]+bal_list)
+          
+        if level < 2:
+          self.get_children(c[1], level+1, pl, company, fy)
+          
+        # make totals - for top level
+        # ---------------------------
+        if level==0:
+          # add rows for profit / loss in B/S
+          if pl=='No':
+            if c[2]=='Credit':
+              self.return_data.append([1, 'Total Liabilities'] + totals)
+              level0_diff = [-i for i in level0_diff] # convert to debit
+              self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
+              for i in range(len(totals)): # make totals
+                level0_diff[i] = flt(totals[i]) + level0_diff[i]
+              self.return_data.append([4, 'Total '+c[0]] + level0_diff)
+            else:
+              self.return_data.append([4, 'Total '+c[0]] + totals)
+
+          # add rows for profit / loss in P/L
+          else:
+            if c[2]=='Debit':
+              self.return_data.append([1, 'Total Expenses (before Profit)'] + totals)
+              self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
+              for i in range(len(totals)): # make totals
+                level0_diff[i] = flt(totals[i]) + level0_diff[i]
+              self.return_data.append([4, 'Total '+c[0]] + level0_diff)
+            else:
+              self.return_data.append([4, 'Total '+c[0]] + totals)
+  
+  # Define Periods
+  # --------------
+  
+  def define_periods(self, year, period):
+    
+    # get year start date    
+    ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", year)
+    ysd = ysd and ysd[0][0] or ''
+
+    self.ysd = ysd
+
+    # year
+    if period == 'Annual':
+      pn = 'FY'+year
+      self.period_list.append(pn)
+      self.period_start_date[pn] = ysd
+      self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,11))
+
+    # quarter
+    if period == 'Quarterly':
+      for i in range(4):
+        pn = 'Q'+str(i+1)
+        self.period_list.append(pn)
+      
+        self.period_start_date[pn] = get_first_day(ysd,0,i*3)
+        self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,((i+1)*3)-1))  
+
+    # month
+    if period == 'Monthly':
+      mlist = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+      for i in range(12):
+        fd = get_first_day(ysd,0,i)
+        pn = mlist[fd.month-1]
+        self.period_list.append(pn)
+      
+        self.period_start_date[pn] = fd
+        self.period_end_date[pn] = get_last_day(fd)
+      
+  # Get Balance For A Period
+  # ------------------------
+  
+  def get_period_balance(self, acc, level, pl, company, fy):
+    debit_or_credit, lft, rgt = self.ac_details[acc]
+    ret = []
+    for p in self.period_list:
+      sd, ed = self.period_start_date[p].strftime('%Y-%m-%d'), self.period_end_date[p].strftime('%Y-%m-%d')
+      cond = "and t1.voucher_type != 'Period Closing Voucher'"
+      if pl=='No':
+        sd = self.ysd.strftime('%Y-%m-%d')
+        cond = ""
+
+      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening,'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
+      
+      
+      bal = bal and (flt(bal[0][0]) - flt(bal[0][1])) or 0
+      if debit_or_credit == 'Credit' and bal:
+        bal = -bal
+      if pl=='No':
+        op = sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))
+        op = op and op[0][0] or 0
+        bal += flt(op)
+      
+      ret.append(bal)
+    return ret
+    
+  # Get Dashboard Amounts
+  # ---------------------
+  
+  def get_balance(self, acc, sd, ed, company, fy):
+    a = sql("select account_name, name, debit_or_credit, lft, rgt, is_pl_account from `tabAccount` where account_name=%s and company=%s", (acc, company), as_dict=1)
+    if a:
+      a = a[0]
+      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
+      if a['debit_or_credit']=='Debit':
+        bal = flt(flt(bal[0][0]) - flt(bal[0][1]))
+      else:
+        bal = flt(flt(bal[0][1]) - flt(bal[0][0]))
+
+      if a['is_pl_account']=='No':
+        op = sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))
+        op = op and op[0][0] or 0
+        bal += flt(op)
+
+      return flt(bal)
+
+    else:
+      msgprint("Did not find %s for %s" % (acc, company))
+      return 0
+
+  def get_cur_balance(self, acc, company):
+    bal = sql("select IFNULL(t1.balance,0) from `tabAccount Balance` t1, `tabAccount` t2 where t1.account = %s and t1.period=%s and t1.account = t2.name and t2.company=%s", (acc, self.fiscal_year, company))
+    return bal and flt(bal[0][0]) or 0
+  
+  def get_top_5_cust(self, company):
+    rec_grp = sql("select receivables_group from tabCompany where name=%s", company)
+    if rec_grp:
+      pa_lft_rgt = sql("select lft, rgt from tabAccount where name=%s and company=%s", (rec_grp[0][0], company))[0]
+      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
+    else:
+      return []
+
+  def get_top_5_exp(self, company):
+    a = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where account_name=%s and company=%s", ('Expenses', company), as_dict=1)[0]
+    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
+  
+  def bl(self, acc, company):
+    dt = getdate(nowdate())
+
+    r = []
+    # cur
+    r.append(self.get_cur_balance(acc, company))
+    # this month
+    r.append(self.get_balance(acc, get_first_day(dt), get_last_day(dt), company, self.fiscal_year))
+    # last month
+    r.append(self.get_balance(acc, get_first_day(dt,0,-1), get_last_day(get_first_day(dt,0,-1)), company, self.fiscal_year))
+    return r
+
+  def bl_bs(self, acc, company, sd):
+    dt = getdate(nowdate())
+    r = []
+    # cur
+    r.append(self.get_cur_balance(acc, company))
+    # last month
+    r.append(self.get_balance(acc, sd, get_last_day(get_first_day(dt,0,-1)), company, self.fiscal_year))
+    # opening
+    r.append(self.get_balance(acc, sd, sd, company, self.fiscal_year))
+    return r
+
+  def get_dashboard_values(self, arg=''):
+    d = get_defaults()
+    self.fiscal_year = d['fiscal_year']
+    if arg:
+      company = arg
+    else:
+      company = d['company']
+
+    r = {}
+    r['Income'] = self.bl('Income', company)
+    r['Expenses'] = self.bl('Expenses', company)
+
+    r['Profit'] = []
+    for i in range(3):
+      r['Profit'].append(r['Income'][i] - r['Expenses'][i])
+    
+    r['Current Assets'] = self.bl_bs('Current Assets', company, getdate(d['year_start_date']))
+    r['Current Liabilities'] = self.bl_bs('Current Liabilities', company, getdate(d['year_start_date']))
+    
+    r['Working Capital'] = []
+    for i in range(3):
+      r['Working Capital'].append(r['Current Assets'][i] - r['Current Liabilities'][i])
+
+    r['Bank Accounts'] = self.bl_bs('Bank Accounts', company, getdate(d['year_start_date']))
+    
+    r['Top Customers'] = convert_to_lists(self.get_top_5_cust(company))
+    r['Top Expenses'] = convert_to_lists(self.get_top_5_exp(company))
+    
+    return r
diff --git a/analysis/doctype/mis_control/mis_control.txt b/analysis/doctype/mis_control/mis_control.txt
new file mode 100644
index 0000000..73038c0
--- /dev/null
+++ b/analysis/doctype/mis_control/mis_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:21', 'search_fields': None, 'module': 'Analysis', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 124, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'MIS Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-10-25 17:20:04', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/analysis/doctype/ta_control/__init__.py b/analysis/doctype/ta_control/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/analysis/doctype/ta_control/__init__.py
diff --git a/analysis/doctype/ta_control/ta_control.py b/analysis/doctype/ta_control/ta_control.py
new file mode 100755
index 0000000..87754ae
--- /dev/null
+++ b/analysis/doctype/ta_control/ta_control.py
@@ -0,0 +1,107 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+        def __init__(self, d, dl):
+                self.doc, self.doclist = d, dl
+
+
+        # Define Globals
+        # ---------------
+        def define_globals(self, trans, fiscal_year):
+                self.month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+
+                if trans == 'Purchase Receipt' or trans == 'Delivery Note' or trans == 'Payable Voucher' or trans == 'Receivable Voucher':
+                        self.trans_date = 'posting_date'
+                else:
+                        self.trans_date = 'transaction_date'
+                
+                ysd = sql("select year_start_date from `tabFiscal Year` where name = %s",fiscal_year)[0][0]
+                self.year_start_date = ysd.strftime('%Y-%m-%d')
+                self.start_month = cint(self.year_start_date.split('-')[1])
+
+
+        # Get Column Names and Query for Annual Trend
+        # ---------------------------------------------
+        def get_annual_trend_details(self, fiscal_year):
+                col_names = [fiscal_year+' (Qty)', fiscal_year+' (Amt)']
+                query_val = 'SUM(t2.qty) ,SUM(t2.amount),'
+                return col_names, query_val
+
+
+        # Get Column Names and Query for Half Yearly Trend
+        # --------------------------------------------------
+        def get_half_yearly_trend_details(self):
+                first_half_start = self.year_start_date
+                first_half_end = add_days(add_months(first_half_start,6),-1)
+                second_half_start = add_days(first_half_end,1)
+                second_half_end = add_days(add_months(second_half_start,6),-1)
+                
+                col_names = ['First Half (Qty)', 'First Half (Amt)', 'Second Half (Qty)', 'Second Half (Amt)']
+               
+                query_val = 'SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+first_half_start+'" AND "'+first_half_end+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+first_half_start+'" AND "'+first_half_end+'" THEN t2.amount ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+second_half_start+'" AND "'+second_half_end+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+second_half_start+'" AND "'+second_half_end+'" THEN t2.amount ELSE NULL END),'
+
+                return col_names, query_val
+
+
+        # Get Column Names and Query for Quarterly Trend
+        # ------------------------------------------------
+        def get_quarterly_trend_details(self):
+                first_qsd, second_qsd, third_qsd, fourth_qsd = self.year_start_date, add_months(self.year_start_date,3), add_months(self.year_start_date,6), add_months(self.year_start_date,9)
+
+                first_qed, second_qed, third_qed, fourth_qed = add_days(add_months(first_qsd,3),-1), add_days(add_months(second_qsd,3),-1), add_days(add_months(third_qsd,3),-1), add_days(add_months(fourth_qsd,3),-1)
+
+                col_names = ['Q1 (Qty)','Q1 (Amt)','Q2 (Qty)','Q2 (Amt)','Q3 (Qty)','Q3 (Amt)','Q4 (Qty)','Q4 (Amt)']
+                query_val = ''
+                bet_dates = [[first_qsd,first_qed],[second_qsd,second_qed],[third_qsd,third_qed],[fourth_qsd,fourth_qed]]
+
+                for d in bet_dates:
+                        query_val += 'SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+d[0]+'" AND "'+d[1]+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+d[0]+'" AND "'+d[1]+'" THEN t2.amount ELSE NULL END),'
+                
+                return col_names, query_val
+
+
+        # Get Column Names and Query for Monthly Trend
+        # -----------------------------------------------
+        def get_monthly_trend_details(self):
+                col_names, query_val = [], ''
+                for i in range(self.start_month-1, len(self.month_name)):
+                        col_names.append(self.month_name[i]+' (Qty)')
+                        col_names.append(self.month_name[i]+' (Amt)')
+                        query_val += 'SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.qty ELSE NULL END), SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
+
+                for i in range(0, self.start_month-1):
+                        col_names.append(self.month_name[i]+' (Qty)')
+                        col_names.append(self.month_name[i]+' (Amt)')
+                        query_val += 'SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.qty ELSE NULL END), SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
+                
+                return col_names, query_val
+
+
+        # Get Single Year Trend's Query and Columns
+        # -------------------------------------------
+        def get_single_year_query_value(self, fiscal_year, period, trans, trans_det):
+                self.define_globals(trans, fiscal_year)
+                if period == 'Annual':
+                        return self.get_annual_trend_details(fiscal_year)
+                elif period == 'Half Yearly':
+                        return self.get_half_yearly_trend_details()
+                elif period == 'Quarterly':
+                        return self.get_quarterly_trend_details()
+                elif period == 'Monthly':
+                        return self.get_monthly_trend_details()
diff --git a/analysis/doctype/ta_control/ta_control.txt b/analysis/doctype/ta_control/ta_control.txt
new file mode 100755
index 0000000..4822e27
--- /dev/null
+++ b/analysis/doctype/ta_control/ta_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2011-01-07 14:56:35', 'search_fields': None, 'module': 'Analysis', 'doctype': 'DocType', 'change_log': None, 'print_outline': None, 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'TA Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2011-01-07 14:56:35', 'server_code_error': None, 'name_case': None, 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/analysis/page/__init__.py b/analysis/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/page/__init__.py
diff --git a/analysis/search_criteria/__init__.py b/analysis/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/search_criteria/__init__.py
diff --git a/analysis/search_criteria/monthly_transaction_summary/__init__.py b/analysis/search_criteria/monthly_transaction_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/search_criteria/monthly_transaction_summary/__init__.py
diff --git a/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
new file mode 100644
index 0000000..68aa856
--- /dev/null
+++ b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
@@ -0,0 +1,13 @@
+
+
+report.customize_filters = function() {
+  this.mytabs.items['Select Columns'].hide()
+  this.hide_all_filters();
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'DocType'});
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'DocType'});
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',ignore : 1, parent:'DocType'});
+}
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{NEWLINE:'<br>'});
+}
\ No newline at end of file
diff --git a/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
new file mode 100644
index 0000000..c485497
--- /dev/null
+++ b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
@@ -0,0 +1,151 @@
+if filter_values.get('period'):
+  period_values = filter_values.get('period').split(NEWLINE)
+
+if not filter_values.get('fiscal_year'):
+  msgprint("Please Select Fiscal Year")
+  raise Exception
+elif not filter_values.get('period'):
+  msgprint("Please Select Period")
+  raise Exception
+elif len(period_values) > 2:
+  msgprint("You can view report only for one period. Please select only one value in period.")
+  raise Exception
+else:
+  fiscal_year = filter_values.get('fiscal_year')
+  period = filter_values.get('period')
+  company = filter_values.get('company')
+
+# get fiscal year start date and start month
+# ---------------------------------------------------------  
+year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
+start_date = year_start_date and year_start_date[0][0] or ''
+start_month = year_start_date and year_start_date[0][1] or ''
+month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+
+# Add columns based on period
+# --------------------------------
+columns = []
+columns.append(['ID','Data','150px',''])
+columns.append(['Description','Data','150px',''])
+# ================ Annual ======================
+if period == 'Annual':
+  columns.append([fiscal_year,'Currency','150px',''])
+  
+# =========== Half Yearly ======================
+elif period == 'Half Yearly':
+  columns.append([month_name[start_month-1]+' to '+month_name[start_month+4],'Currency','150px','']) # first half
+  if start_month == 1:  # this is case when fiscal year starts with JAN
+    columns.append([month_name[start_month+5]+' to '+month_name[start_month+11],'Currency','150px',''])
+  else:  #this is case when fiscal year starts with other than JAN
+    columns.append([month_name[start_month+5]+' to '+month_name[start_month-2],'Currency','150px',''])
+  columns.append(['Total','Currency','150px',''])
+  
+# ================ Quarterly ===================
+elif period == 'Quarterly':
+  length_1 = (len(month_name) - start_month + 1) / 3  #this gives the total no. of times we need to iterate for quarter
+  val = length_1 % 4
+  q_no = 1
+  for i in range(length_1):
+    value = 3*i + val
+    columns.append(['Q'+cstr(q_no)+' ('+month_name[value]+' to '+month_name[value+2]+')','Currency','150px',''])
+    q_no += 1
+  length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
+  for i in range(length_2):
+    columns.append(['Q'+cstr(q_no)+' ('+month_name[3*i]+' to '+month_name[3*i+2]+')','Currency','150px',''])
+    q_no += 1;
+  columns.append(['Total','Currency','150px',''])
+  
+# =============== Monthly ======================
+elif period == 'Monthly':
+  for i in range(start_month-1,len(month_name)):
+    columns.append([month_name[i],'Currency','150px',''])
+  for i  in range(start_month-1):
+    columns.append([month_name[i],'Currency','150px',''])
+  columns.append(['Total','Currency','150px',''])
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+
+out = []
+if company:
+  condition = 'docstatus = 1 and fiscal_year = "'+fiscal_year+'" and company = "'+company+'"'
+else:
+  condition = 'docstatus = 1 and fiscal_year = "'+fiscal_year+'"'
+
+for r in res:
+  det = ''
+  list_range = 0
+  query = ''
+  # ================= Annual Report =============== 
+  if period == 'Annual':
+    # Main Query
+    det = sql("SELECT count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s" %(r[col_idx['ID']],condition))
+    list_range = 1
+    
+  # ============ Half Yearly Report ===============
+  elif period == 'Half Yearly':
+    # first half
+    query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
+    # second half
+    query += 'COUNT(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
+    
+    # Main Query
+    det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
+    list_range = 3
+
+  # =============== Quarterly Report ==============  
+  elif period == 'Quarterly':
+    length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
+    val = length_1 % 4;
+    for i in range(length_1):
+      value = 3*i + val;
+      query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
+    length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
+    for i in range(length_2):
+      query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),';  
+    # Main Query
+    det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
+    list_range = 5
+    
+  # ================ Monthly Report =============== 
+  elif period == 'Monthly':
+    # for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
+    for i in range(start_month-1,len(month_name)):
+      query += 'COUNT(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN name ELSE NULL END), SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), MAX(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), AVG(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
+      # the above query calculates total_no, total_amt, min_amt, max_amt, avg_amt of doctypes in monthwise
+    for i  in range(start_month-1):
+      query += 'COUNT(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN name ELSE NULL END), SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), MAX(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), AVG(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
+    
+    # Main Query
+    det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
+    list_range = 13
+  
+  # bifurcate all values and append them in list
+  total_no,total_amt,min_amt,max_amt,avg_amt = [],[],[],[],[]
+  
+  count = 0
+  # append values to list
+  for i in range(list_range):
+    total_no.append(cstr(det and det[0][count] or 0))
+    total_amt.append(cstr(det and det[0][count+1] or 0))
+    min_amt.append(cstr(det and det[0][count+2] or 0))
+    max_amt.append(cstr(det and det[0][count+3] or 0))
+    avg_amt.append(cstr(det and det[0][count+4] or 0))
+    count += 5
+    
+  for col in range(len(colnames)-1): # this would make all first row blank. just for look
+    r.append('')
+  out.append(r)
+  
+  d = [['Total No',total_no],['Total Amount',total_amt],['Min Amount',min_amt],['Max Amount',max_amt],['Avg Amount',avg_amt]]
+  
+  for des in range(5):
+    t_row = ['' for i in range(len(colnames))]
+    t_row[col_idx['Description']] = d[des][0]
+    for v in range(list_range):
+      t_row[col_idx[colnames[v+2]]] = flt(d[des][1][v])
+    out.append(t_row)
\ No newline at end of file
diff --git a/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
new file mode 100644
index 0000000..b05de58
--- /dev/null
+++ b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
@@ -0,0 +1 @@
+SELECT DISTINCT name FROM tabDocType WHERE document_type="Transaction" AND ifnull(istable,0) = 0
\ No newline at end of file
diff --git a/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
new file mode 100644
index 0000000..506518c
--- /dev/null
+++ b/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Profile\x01ID',
+		'creation': '2010-09-20 13:00:41',
+		'criteria_name': 'Monthly Transaction Summary',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Profile',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'DocType\x01Period':'Monthly'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-17 16:02:25',
+		'modified_by': 'Administrator',
+		'module': 'Analysis',
+		'name': 'monthly_transaction_summary',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabProfile`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/analysis/search_criteria/trend_analyzer/__init__.py b/analysis/search_criteria/trend_analyzer/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/search_criteria/trend_analyzer/__init__.py
diff --git a/analysis/search_criteria/trend_analyzer/trend_analyzer.js b/analysis/search_criteria/trend_analyzer/trend_analyzer.js
new file mode 100644
index 0000000..72334df
--- /dev/null
+++ b/analysis/search_criteria/trend_analyzer/trend_analyzer.js
@@ -0,0 +1,121 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.add_filter({fieldname:'transaction', label:'Transaction', fieldtype:'Select', options:'Quotation'+NEWLINE+'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice'+NEWLINE+'Purchase Order'+NEWLINE+'Purchase Receipt'+NEWLINE+'Purchase Invoice',report_default:'Delivery Note',ignore : 1,parent:'Profile',in_first_page : 1,single_select : 1});
+
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Profile',in_first_page:1,single_select:1});
+
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Item'+NEWLINE+'Item Group'+NEWLINE+'Customer'+NEWLINE+'Customer Group'+NEWLINE+'Territory'+NEWLINE+'Supplier'+NEWLINE+'Supplier Type', ignore : 1, parent:'Profile', report_default:'Item', in_first_page : 1,single_select:1});
+
+  this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item'+NEWLINE+'Customer'+NEWLINE+'Supplier', ignore : 1, parent:'Profile',single_select:1});
+
+  this.add_filter({fieldname:'order_type', label:'Order Type', fieldtype:'Select', options:NEWLINE+'Sales'+NEWLINE+'Maintenance',ignore : 1, parent:'Profile',single_select:1});
+
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
+
+  this.set_filter_properties('Profile','Fiscal Year',{filter_hide:0, in_first_page:1, report_default: sys_defaults.fiscal_year});
+  this.get_filter('Profile', 'Fiscal Year').set_as_single();
+
+  // Add Filters
+  this.add_filter({fieldname:'item', label:'Item', fieldtype:'Link', options:'Item', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'customer', label:'Customer', fieldtype:'Link', options:'Customer', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'customer_group', label:'Customer Group', fieldtype:'Link', options:'Customer Group', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'supplier', label:'Supplier', fieldtype:'Link', options:'Supplier', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'supplier_type', label:'Supplier Type', fieldtype:'Link', options:'Supplier Type', ignore : 1, parent:'Profile'});
+}
+
+
+this.mytabs.tabs['Select Columns'].hide();
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
+
+var validate_values = function(trans,based_on,order_type) {
+  if(!fiscal_year){
+    msgprint("Please select Fiscal Year");
+    return 0;
+  }
+  if((in_list(['Quotation','Sales Order','Delivery Note','Sales Invoice'],trans) && in_list(['Supplier','Supplier Type'],based_on)) || (in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && in_list(['Customer','Customer Group','Territory'],based_on))){
+    msgprint("Sorry! You cannot fetch "+trans+" trend based on "+based_on);
+    return 0;
+  }
+  if(in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && order_type){
+    msgprint("Please deselect Order Type for "+trans);
+    return 0;
+  }
+  return 1;
+}
+
+
+report.get_query = function() {
+  trans = this.get_filter('Profile', 'Transaction').get_value();
+  order_type = this.get_filter('Profile', 'Order Type').get_value();
+  based_on = this.get_filter('Profile', 'Based On').get_value();
+  company = this.get_filter('Profile', 'Company').get_value();
+  fiscal_year = this.get_filter('Profile', 'Fiscal Year').get_value();
+
+  if(validate_values(trans,based_on,order_type)){
+    col = '';
+    add_cond = '';
+    add_col = '';
+    add_tables = '';
+    sp_cond = '';
+    if(trans == 'Sales Invoice') trans = 'Receivable Voucher';
+    else if(trans == 'Purchase Invoice') trans = 'Payable Voucher';
+
+    trans_det = trans+' Detail'
+
+    if(trans == 'Receivable Voucher') trans_det = 'RV Detail';
+    else if(trans == 'Payable Voucher') trans_det = 'PV Detail';
+    else if(trans == 'Purchase Order') trans_det = 'PO Detail';
+
+    if(order_type != '') add_code += ' AND t1.order_type = '+order_type;
+
+    switch(based_on){
+      case 'Item'           :     item = this.get_filter('Profile', 'Item').get_value();
+                                  col = 'DISTINCT t2.item_code, t3.item_name';
+                                  add_tables = ',tabItem t3';
+                                  add_cond += ' AND t2.item_code = t3.name';
+                                  if(item) add_cond += ' AND t2.item_code = "'+item+'"';
+                                  break;
+      case 'Customer'       :     cust = this.get_filter('Profile', 'Customer').get_value();
+                                  col = 'DISTINCT t1.customer, t3.territory';
+                                  add_tables = ',tabCustomer t3';
+                                  add_cond += ' AND t1.customer = t3.name';
+                                  if(cust) add_cond += ' AND t1.customer = "'+cust+'"';
+                                  break;
+      case 'Supplier'      :      supp = this.get_filter('Profile', 'Supplier').get_value();
+                                  col = 'DISTINCT t1.supplier, t3.supplier_type';
+                                  add_tables = ',tabSupplier t3';
+                                  add_cond += ' AND t1.supplier = t3.name';
+                                  if(supp) add_cond += ' AND t1.supplier = "'+supp+'"';
+                                  break;
+      case 'Supplier Type'  :     supp_type = this.get_filter('Profile', 'Supplier Type').get_value();
+                                  col = 'DISTINCT t3.supplier_type';
+                                  add_tables = ',tabSupplier t3';
+                                  add_cond += ' AND t1.supplier = t3.name';
+                                  if(supp_type) add_cond += ' AND t1.supplier_type = "'+supp_type+'"';
+                                  break;
+      case 'Item Group'     :     ig = this.get_filter('Profile', 'Item Group').get_value();
+                                  if(ig) sp_cond += ' AND parent.name = "'+ig+'"';
+                                  break;
+      case 'Customer Group' :     cg = this.get_filter('Profile', 'Customer Group').get_value();
+                                  if(cg) sp_cond += ' AND parent.name = "'+cg+'"';
+                                  break;
+      case 'Territory'      :     ter = this.get_filter('Profile', 'Territory').get_value();
+                                  if(ter) sp_cond += ' AND parent.name = "'+ter+'"';
+                                  break;
+    }
+
+    
+    if(based_on == 'Item' || based_on == 'Customer' || based_on == 'Supplier' || based_on == 'Supplier Type')
+      var q ='SELECT '+col+' FROM `tab'+trans+'` t1, `tab'+trans_det+'` t2 '+add_tables+' WHERE t1.fiscal_year = "'+fiscal_year+'" and t1.company = "'+company+'" and t2.parent = t1.name '+add_cond;
+    else
+      var q = 'SELECT CONCAT(REPEAT("     ", COUNT(parent.name) - 1), node.name) AS "Name" FROM `tab'+based_on+'` node,`tab'+based_on+'` parent WHERE node.lft BETWEEN parent.lft and parent.rgt and node.docstatus !=2 '+sp_cond+' GROUP BY node.name ORDER BY node.lft';
+   
+    return q;
+  }
+}
\ No newline at end of file
diff --git a/analysis/search_criteria/trend_analyzer/trend_analyzer.py b/analysis/search_criteria/trend_analyzer/trend_analyzer.py
new file mode 100644
index 0000000..9edf045
--- /dev/null
+++ b/analysis/search_criteria/trend_analyzer/trend_analyzer.py
@@ -0,0 +1,160 @@
+# ********************************************* INITIALIZATION *******************************************
+out = []
+
+# Filter Values
+# =============================================
+based_on = filter_values.get('based_on')
+group_by = filter_values.get('group_by')
+trans = filter_values.get('transaction')
+period = filter_values.get('period')
+order_type = filter_values.get('order_type')
+company = filter_values.get('company')
+fiscal_year = filter_values.get('fiscal_year')
+item = filter_values.get('item')
+item_group = filter_values.get('item_group')
+customer = filter_values.get('customer')
+customer_group = filter_values.get('customer_group')
+territory = filter_values.get('territory')
+supplier = filter_values.get('supplier')
+supplier_type = filter_values.get('supplier_type')
+
+
+
+# ********************************************* SET DEFAULTS **************************************************
+# Details Table
+# --------------
+if trans == 'Sales Invoice': trans = 'Receivable Voucher'
+elif trans == 'Purchase Invoice': trans = 'Payable Voucher'
+
+trans_det = trans+' Detail'
+
+if trans == 'Receivable Voucher': trans_det = 'RV Detail'
+elif trans == 'Payable Voucher': trans_det = 'PV Detail'
+elif trans == 'Purchase Order': trans_det = 'PO Detail'
+
+col_names, query_val = get_obj('TA Control').get_single_year_query_value(fiscal_year, period, trans, trans_det)
+query_val += 'SUM(t2.qty), SUM(t2.amount)'
+
+col_names.append('Total (Qty)')
+col_names.append('Total (Amt)')
+
+
+# ********************************************* VALIDATIONS ***************************************************
+if (based_on in ['Customer','Customer Group','Territory'] and group_by == 'Supplier') or (based_on in ['Supplier','Supplier Type'] and group_by == 'Customer'):
+  msgprint("Sorry! You cannot group Trend Analyzer based on %s by %s" % (based_on,group_by))
+  raise Exception
+
+if based_on == group_by:
+  msgprint("Based On and Group By value cannot be same for Trend Analyzer")
+  raise Exception
+
+
+# ********************************************** ADD COLUMNS **********************************************
+cols = [[based_on, 'Data', '300px', '']]
+cr = 1
+if based_on == 'Item':
+  cols.append(['Item Name','Data','200px',''])
+  cr = 2
+elif based_on == 'Customer':
+  cols.append(['Territory','Link','150px','Territory'])
+  cr = 2
+elif based_on == 'Supplier':
+  cols.append(['Supplier Type','Link','150px','Supplier Type'])
+  cr = 2
+if group_by:
+  cr += 1
+
+if group_by:
+  cols.append([group_by,'Data','150px',''])
+
+for c in col_names:
+  cols.append([c,'Currency','150px',''])
+
+for c in cols:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+
+
+# ******************************************* ADDITIONAL CONDITION ************************************************
+add_cond = ' t2.parent = t1.name AND t1.company = "%s" AND t1.fiscal_year = "%s" and t1.docstatus = 1' % (company, fiscal_year)
+add_tab = ' `tab'+trans+'` t1, `tab'+trans_det+'` t2'
+if order_type: add_cond += ' AND t1.order_type = "%s"' % order_type
+
+
+# Item
+if item or based_on == 'Item':
+  add_cond += ' AND t2.item_code = "%s"' % (based_on != 'Item' and item or '%(value)s')
+
+# Item Group
+if item_group or based_on == 'Item Group':
+  add_tab += ' ,`tabItem` t3, `tabItem Group` t4 '
+  add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and ifnull(t5.is_group,"No") = "No" and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s')
+
+# Customer
+if customer or based_on == 'Customer':
+  add_cond += ' AND t1.customer = "%s"' % (based_on != 'Customer' and customer or '%(value)s')
+
+# Customer Group
+if customer_group or based_on == 'Customer Group':
+  add_tab += ' ,`tabCustomer` t7, `tabCustomer Group` t8 '
+  add_cond += ' AND t7.name = t1.customer AND t7.customer_group = t8.name and (t8.name = "%s" or t8.name IN (SELECT t9.name FROM `tabCustomer Group` t9,`tabCustomer Group` t10 WHERE t9.lft BETWEEN t10.lft and t10.rgt and t9.docstatus !=2 and ifnull(t9.is_group,"No") = "No" and t10.name = "%s"))' % (based_on != 'Customer Group'  and customer_group or '%(value)s', based_on != 'Customer Group'  and customer_group or '%(value)s')
+  
+# Territory
+if territory or based_on == 'Territory':
+  add_tab += ' ,`tabTerritory` t11 '
+  add_cond += ' AND t1.territory = t11.name AND t1.territory = t11.name and (t11.name = "%s" or t11.name IN (SELECT t12.name FROM `tabTerritory` t12,`tabTerritory` t13 WHERE t12.lft BETWEEN t13.lft and t13.rgt and t12.docstatus !=2 and ifnull(t12.is_group,"No") = "No" and t13.name = "%s"))' % (based_on != 'Territory' and territory or '%(value)s', based_on != 'Territory' and territory or '%(value)s')
+
+# Supplier
+if supplier or based_on == 'Supplier':
+  add_cond += ' AND t1.supplier = "%s"' % (based_on != 'Supplier' and supplier or '%(value)s')
+  
+# Supplier Type
+if supplier_type or based_on == 'Supplier Type':
+  add_tab += ' ,`tabSupplier` t14, `tabSupplier Type` t15 '
+  add_cond += ' AND t14.name = t1.supplier AND t14.supplier_type = t15.name and t15.name = "%s"' % (based_on != 'Supplier Type' and supplier_type or '%(value)s')
+
+  
+# Column to be seleted for group by condition
+# ==============================================
+sel_col = ''
+if group_by == 'Item':
+  sel_col = 't2.item_code'
+elif group_by == 'Customer':
+  sel_col = 't1.customer'
+elif group_by == 'Supplier':
+  sel_col = 't1.supplier'
+  
+  
+# ********************************************** Result Set ************************************************
+for r in res:
+  main_det = sql("SELECT %s FROM %s WHERE %s" % (query_val, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
+  if group_by:
+    for col in range(cr,cr+1): # this would make all first row blank. just for look
+      r.append('')
+  if main_det[0][len(colnames) - cr - 1]:
+    for d in range(len(colnames) - cr):
+      r.append(flt(main_det[0][d]))
+    out.append(r)
+    
+    if group_by:
+      flag = 1
+      # check for root nodes
+      if based_on in ['Item Group','Customer Group','Territory']:
+        is_grp = sql("select is_group from `tab%s` where name = '%s'" % (based_on, cstr(r[col_idx[based_on]]).strip()))
+        is_grp = is_grp and cstr(is_grp[0][0]) or ''
+        if is_grp != 'No':
+          flag = 0
+
+      if flag == 1:	
+        det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
+
+        for des in range(len(det)):
+          t_row = ['' for i in range(len(colnames))]
+          t_row[col_idx[group_by]] = cstr(det[des])
+          gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
+          for d in range(len(col_names)):
+            t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
+          out.append(t_row)
\ No newline at end of file
diff --git a/analysis/search_criteria/trend_analyzer/trend_analyzer.txt b/analysis/search_criteria/trend_analyzer/trend_analyzer.txt
new file mode 100644
index 0000000..91a355b
--- /dev/null
+++ b/analysis/search_criteria/trend_analyzer/trend_analyzer.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Profile\x01ID,Profile\x01Owner',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Trend Analyzer',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Profile',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': '{}',
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-10 11:06:06',
+		'modified_by': 'Administrator',
+		'module': 'Analysis',
+		'name': 'trend_analyzer',
+		'owner': 'saumil@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabProfile`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/analysis/search_criteria/yearly_transaction_summary/__init__.py b/analysis/search_criteria/yearly_transaction_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/analysis/search_criteria/yearly_transaction_summary/__init__.py
diff --git a/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
new file mode 100644
index 0000000..dd99d28
--- /dev/null
+++ b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
@@ -0,0 +1,12 @@
+report.customize_filters = function() {
+  this.mytabs.items['Select Columns'].hide()
+  this.hide_all_filters();
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'from_fiscal_year', label:'From Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'to_fiscal_year', label:'To Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Profile'});
+}
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{NEWLINE:'<br>'});
+}
\ No newline at end of file
diff --git a/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
new file mode 100644
index 0000000..22d6f00
--- /dev/null
+++ b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
@@ -0,0 +1,115 @@
+if not filter_values.get('from_fiscal_year'):
+  msgprint("Please Select From Fiscal Year")
+  raise Exception
+elif not filter_values.get('to_fiscal_year'):
+  msgprint("Please Select To Fiscal Year")
+  raise Exception
+else:
+  from_fiscal_year = filter_values.get('from_fiscal_year')
+  to_fiscal_year = filter_values.get('to_fiscal_year')
+  company = filter_values.get('company')
+  from_date = filter_values.get('date')
+  to_date = filter_values.get('date1')
+  if from_date != "" and to_date != "":
+    get_obj('MIS Control').dates(from_fiscal_year,from_date,to_date) # validate dates (i.e. dates should be between particular fiscal year)
+	
+# Add columns based on from and to fiscal year
+# --------------------------------------------------------------------------------------------------
+columns = []
+columns.append(['ID','Data','150px',''])
+columns.append(['Description','Data','150px',''])
+columns.append([from_fiscal_year,'Data','150px','']) # append from fiscal year column
+
+# === get no. of fiscal years between from and to fiscal year and append columns accordingly ========
+start_year = from_fiscal_year.split('-')[1] # eg. from fiscal year 2008-2009 . this gives value 2009
+end_year = to_fiscal_year.split('-')[0] # eg. to fiscal year 2009-2010 . this gives value 2009
+diff = cint(end_year)-cint(start_year)
+if diff > 0:
+  year = cint(start_year);
+  next_year = 0
+  f_year = ''
+  for i in range(1,diff+1):
+    next_year = cint(year)+1
+    f_year = cstr(year)+'-'+cstr(next_year)
+    columns.append([f_year,'Data','150px',''])
+# ====================================================================================================
+
+columns.append([to_fiscal_year,'Data','150px','']) # append to fiscal year column
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+  
+out = []
+# =========================== condition for result ===================================================
+if company:
+  condition = 'docstatus = 1 and company = "'+company+'"'
+else:
+  condition = 'docstatus = 1'
+  
+# ====================================================================================================
+
+for r in res:
+  det = ''
+  query = ''
+  list_range = 0
+  if from_date != "" and to_date != "":
+    date_1 = cstr(get_obj('MIS Control').dates(from_fiscal_year,from_date,to_date))
+    query += 'COUNT(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),'
+  else:
+    query += 'COUNT(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),'
+  list_range += 1
+	
+  if diff > 0:
+    year = cint(start_year);
+    next_year = 0
+    f_year = ''
+    for i in range(1,diff+1):
+      next_year = cint(year)+1;
+      f_year = cstr(year)+'-'+cstr(next_year);
+      if from_date != "" and to_date != "":
+        date_2 = cstr(get_obj('MIS Control').dates(f_year,from_date,to_date))
+        query += 'COUNT(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),'
+      else:
+        query += 'COUNT(CASE WHEN fiscal_year = "'+f_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),'
+      year += 1
+      list_range += 1
+
+  if from_date != "" and to_date != "":
+    date_3 = cstr(get_obj('MIS Control').dates(to_fiscal_year,from_date,to_date))
+    query += 'COUNT(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END)'
+  else:
+    query += 'COUNT(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END)'
+  list_range += 1
+  
+  # Main Query
+  det = sql("SELECT %s from `tab%s` where %s" %(query,r[col_idx['ID']],condition))
+  
+  # bifurcate all values and append them in list
+  total_no,total_amt,min_amt,max_amt,avg_amt = [],[],[],[],[]
+  
+  count = 0
+  # append values to list
+  for i in range(list_range):
+    total_no.append(cstr(det and det[0][count] or 0))
+    total_amt.append(cstr(det and det[0][count+1] or 0))
+    min_amt.append(cstr(det and det[0][count+2] or 0))
+    max_amt.append(cstr(det and det[0][count+3] or 0))
+    avg_amt.append(cstr(det and det[0][count+4] or 0))
+    count += 5
+	
+  for col in range(len(colnames)-1): # this would make all first row blank. just for look
+    r.append('')
+  out.append(r)
+  
+  d = [['Total No',total_no],['Total Amount',total_amt],['Min Amount',min_amt],['Max Amount',max_amt],['Avg Amount',avg_amt]]
+  
+  for des in range(5):
+    t_row = ['' for i in range(len(colnames))]
+    t_row[col_idx['Description']] = d[des][0]
+    for v in range(list_range):
+      t_row[col_idx[colnames[v+2]]] = flt(d[des][1][v])
+    out.append(t_row)
\ No newline at end of file
diff --git a/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
new file mode 100644
index 0000000..b05de58
--- /dev/null
+++ b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
@@ -0,0 +1 @@
+SELECT DISTINCT name FROM tabDocType WHERE document_type="Transaction" AND ifnull(istable,0) = 0
\ No newline at end of file
diff --git a/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
new file mode 100644
index 0000000..91cba25
--- /dev/null
+++ b/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Profile\x01ID',
+		'creation': '2010-09-20 13:00:41',
+		'criteria_name': 'Yearly Transaction Summary',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Profile',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'DocType\x01Fiscal Year':'2009-2010','DocType\x01Company':'Alpha Company','DocType\x01Period':'Monthly'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-17 16:03:04',
+		'modified_by': 'Administrator',
+		'module': 'Analysis',
+		'name': 'yearly_transaction_summary',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabProfile`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/application_internal/DocType Label/Payable Voucher/Payable Voucher.txt b/application_internal/DocType Label/Payable Voucher/Payable Voucher.txt
new file mode 100644
index 0000000..37c89a0
--- /dev/null
+++ b/application_internal/DocType Label/Payable Voucher/Payable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Payable Voucher', 'parent': None, 'dt_label': 'Purchase Invoice', 'creation': '2010-06-10 10:44:55', 'modified': '2010-06-10 10:44:55', 'module': 'Application Internal', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Payable Voucher', 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/DocType Label/Receivable Voucher/Receivable Voucher.txt b/application_internal/DocType Label/Receivable Voucher/Receivable Voucher.txt
new file mode 100644
index 0000000..b09e59d
--- /dev/null
+++ b/application_internal/DocType Label/Receivable Voucher/Receivable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Receivable Voucher', 'parent': None, 'dt_label': 'Sales Invoice', 'creation': '2010-06-10 10:44:40', 'modified': '2010-06-10 10:44:40', 'module': 'Application Internal', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Receivable Voucher', 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/Module Def/Application Internal/Application Internal.txt b/application_internal/Module Def/Application Internal/Application Internal.txt
new file mode 100644
index 0000000..a966e82
--- /dev/null
+++ b/application_internal/Module Def/Application Internal/Application Internal.txt
@@ -0,0 +1,218 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 17:30:06',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': 'DocType Label, Payable Voucher\nDocType Label, Receivable Voucher',
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module_desc': None,
+		'module_icon': None,
+		'module_label': 'Application Internal',
+		'module_name': 'Application Internal',
+		'module_page': None,
+		'module_seq': None,
+		'name': 'Application Internal',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'Code History',
+		'doc_name': 'Code History',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00016',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'DocType Label',
+		'doc_name': 'DocType Label',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00017',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'DocType Mapper',
+		'doc_name': 'DocType Mapper',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00018',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'Form Settings',
+		'doc_name': 'Form Settings',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00019',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'GL Mapper',
+		'doc_name': 'GL Mapper',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00020',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'Impact Analysis',
+		'doc_name': 'Impact Analysis',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00021',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'Rating Template',
+		'doc_name': 'Rating Template',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00022',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:30:06',
+		'description': None,
+		'display_name': 'Search Criteria',
+		'doc_name': 'Search Criteria',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00023',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:46',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Forms',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': '000003078',
+		'owner': 'Administrator',
+		'parent': 'Application Internal',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	}
+]
\ No newline at end of file
diff --git a/application_internal/__init__.py b/application_internal/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/__init__.py
diff --git a/application_internal/doctype/__init__.py b/application_internal/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/__init__.py
diff --git a/application_internal/doctype/code_editor/__init__.py b/application_internal/doctype/code_editor/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/code_editor/__init__.py
diff --git a/application_internal/doctype/code_editor/code_editor.js b/application_internal/doctype/code_editor/code_editor.js
new file mode 100644
index 0000000..8ab1c4f
--- /dev/null
+++ b/application_internal/doctype/code_editor/code_editor.js
@@ -0,0 +1,204 @@
+
+// get the script
+loadscript("js/edit_area/edit_area_full.js", function() { });
+
+// property div
+cur_frm.fields_dict['Property HTML'].prop_div = $a(cur_frm.fields_dict['Property HTML'].wrapper,'div','',{margin:'8px 0px'});
+
+// comment div
+cur_frm.cscript.comment_div = $a(cur_frm.fields_dict['Code Toolbar'].wrapper,'div','',{display: 'none', marginBottom:'8px', width: '90%', backgroundColor: '#FFD', fontSize: '14px', padding:'4px'})
+
+// field master
+cur_frm.cscript.type_fields = {
+  'DocType': 'doc_type'
+  ,'Page': 'page_name'
+  ,'Search Criteria': 'criteria_id'
+  ,'Print Format': 'print_format'
+}
+
+// syntax master
+// -------------
+cur_frm.cscript.code_syntax = {
+  // --- DocType   
+   client_script:'js'
+  ,client_script_core:'js'
+  ,server_code:'python'
+  ,server_code_core:'python'  
+
+  // --- Page
+  ,content:'html'
+  ,script:'js'
+  ,style:'css'
+
+  // --- Search Criteria
+  ,report_script:'js'
+  ,server_script:'python'
+
+  // --- Print Format
+  ,code:'html'
+}
+
+// get field name of code
+// ----------------------
+
+cur_frm.cscript.get_field_name = function(doc) {
+  // field names
+  if(doc.script_from =='DocType') {
+    var code_field = doc.code_type.toLowerCase().replace(/ /g,'_');
+  } else if(doc.script_from =='Page') {
+    var code_field = doc.code_type_page.toLowerCase().replace(/ /g,'_');
+  } else if(doc.script_from =='Search Criteria') {
+    var code_field = doc.code_type_criteria.toLowerCase().replace(/ /g,'_');
+  } else if(doc.script_from =='Print Format') {
+    var code_field = 'html';
+  }
+  return code_field;
+}
+
+// update comment
+// --------------
+cur_frm.cscript.update_comment = function() {
+  var ce = cur_frm.cscript.cur_editor;
+  if(!ce) return;
+  var c = cur_frm.cscript.comment_div;
+  c.innerHTML = "Currently Editing '<b>" + ce.fn + "</b>' from " + ce.dt + " <b>" + ce.dn + "</b><span style='color: #888'> (Last Modified: " + ce.code_modified + ")</span>";
+  if(ce.saved)
+    c.innerHTML += "<br><b style='color: GREEN'>Saved</b>"
+  else
+    c.innerHTML += "<br><b style='color: ORANGE'>Changes are not saved</b>"
+
+  $ds(c);
+}
+
+// get code button
+// ---------------
+cur_frm.cscript.get_code = function() {
+  var doc = locals[cur_frm.doctype][cur_frm.docname];
+
+  if(!editAreaLoader) {
+    msgprint('Waiting for the editor to load. Please try again');
+    return;
+  }
+
+  if(cur_frm.cscript.cur_editor && (!cur_frm.cscript.cur_editor.saved)) {
+    if(!confirm("Current script not saved. Do you want to continue?")) return;
+  }
+
+  // field names
+  var code_field = cur_frm.cscript.get_field_name(doc);
+
+  var callback = function(r, rt) {
+
+    cur_frm.cscript.make_editor(cur_frm.cscript.code_syntax[code_field]);
+    editAreaLoader.setValue(cur_frm.cscript.cur_editor.editor_id, r.message[0]);
+    
+    var ce = cur_frm.cscript.cur_editor;
+
+    ce.code_modified = r.message[1];
+    ce.dt = doc.script_from;
+    ce.dn = doc[cur_frm.cscript.type_fields[doc.script_from]];
+    ce.fn = code_field;
+    ce.saved = 1;
+    cur_frm.cscript.update_comment();
+  }
+  $c_obj([doc], 'get_code', [doc.script_from, doc[cur_frm.cscript.type_fields[doc.script_from]], code_field].join('~~~'), callback);
+}
+
+// make a new editor
+// -----------------
+
+cur_frm.cscript.make_editor = function(syntax) {
+
+  // hide editor if exists
+  if(cur_frm.cscript.cur_editor) {
+  }
+
+  // set id
+  var myid = 'code_edit_1' //+ cur_frm.cscript.mycnt;
+
+  editAreaLoader.init({id: myid, start_highlight: true, word_wrap: false, syntax: syntax
+    ,change_callback : "cur_frm.cscript.editor_change_callback"
+    ,EA_load_callback: "cur_frm.cscript.editor_load_callback"
+  });
+  editAreaLoader.window_loaded(); // make the editor
+
+  if(!cur_frm.cscript.cur_editor) { 
+
+    // parent
+    var div = $a(cur_frm.fields_dict['Code HTML'].wrapper,'div');
+    div.editor_id = myid;
+
+    // make the form
+    div.innerHTML = '<form method="POST"></form>';
+
+    div.form = div.childNodes[0];
+
+    // make the text area
+    div.ta = $a(div.form,'textarea','',{height: '400px'}); div.ta.setAttribute('id',myid);
+
+    cur_frm.cscript.cur_editor = div;
+  }
+}
+
+cur_frm.cscript.editor_change_callback = function(id) {
+  cur_frm.cscript.cur_editor.saved = 0; cur_frm.cscript.update_comment();
+}
+
+cur_frm.cscript.editor_load_callback = function(id) {
+  cur_frm.cscript.cur_editor.saved = 1; cur_frm.cscript.update_comment();
+}
+
+// get properties 
+// --------------
+cur_frm.cscript.get_properties = function() {
+  var callback = function(r,rt) {
+    var div = cur_frm.fields_dict['Property HTML'].prop_div;
+    div.innerHTML = '';
+    
+    var t = make_table(div, r.message.length, 4, '90%', ['25%','25%','25%','25%'], {padding: '3px'})
+    var cl = r.message;
+    for(var i=0; i<cl.length; i++) {
+      $td(t,i,0).innerHTML = cl[i][0];
+      $td(t,i,1).innerHTML = cl[i][1];
+      $td(t,i,2).innerHTML = cl[i][2];
+      $td(t,i,3).innerHTML = cl[i][3];
+    }
+
+  }
+
+  $c_obj([locals[cur_frm.doctype][cur_frm.docname]], 'get_properties', '', callback);
+}
+
+// set code button
+// ---------------
+
+cur_frm.cscript.set_code = function() {
+  ce = cur_frm.cscript.cur_editor;
+
+  var doc = locals[cur_frm.doctype][cur_frm.docname];  
+  
+  if(doc.add_to_history) {
+    var comment = prompt("Please enter comment before saving");
+    if(!comment) { msgprint("Comment is necessary. Not saved"); return; }
+  }
+
+  doc.code = editAreaLoader.getValue(ce.editor_id);
+  $c_obj([doc], 'set_code', [ce.dt, ce.dn, ce.fn, comment, ce.code_modified].join('~~~'), 
+    function(r,rt) { 
+      if(r.exc)return; 
+      cur_frm.cscript.cur_editor.code_modified = r.message;
+      cur_frm.cscript.cur_editor.saved = 1; 
+      cur_frm.cscript.update_comment(); 
+    }
+  );
+}
+
+cur_frm.cscript.is_doctype = function(doc,dt,dn) { return doc.script_from == 'DocType' }
+cur_frm.cscript.is_page    = function(doc,dt,dn) { return doc.script_from == 'Page' }
+cur_frm.cscript.is_criteria = function(doc,dt,dn) { return doc.script_from == 'Search Criteria' }
+cur_frm.cscript.is_print_format = function(doc,dt,dn) { return doc.script_from == 'Print Format' }
+cur_frm.cscript.test = function(doc,dt,dn) { return false }
+
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+  cur_frm.cscript.update_comment();
+}
\ No newline at end of file
diff --git a/application_internal/doctype/code_editor/code_editor.py b/application_internal/doctype/code_editor/code_editor.py
new file mode 100644
index 0000000..6dca696
--- /dev/null
+++ b/application_internal/doctype/code_editor/code_editor.py
@@ -0,0 +1,73 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+
+  # get the code
+  # ------------
+  def get_code(self, arg):
+    dt, dn, field = arg.split('~~~')
+    return [str(r or '') for r in sql("select `%s`, modified from `tab%s` where name='%s'" % (field, dt, dn))[0]]
+  
+  # set code
+  # check modified, add to history, update code
+  # -------------------------------------------
+  def set_code(self, arg):
+    dt, dn, field, comment, modified = arg.split('~~~')
+
+    # validate modified
+    old_modified = sql("select modified from `tab%s` where name='%s'" % (dt, dn))[0][0]
+    if str(old_modified) != modified:
+       msgprint('error:Someone has updated the code after you checked it out. Please update to the latest copy of the code before saving.')
+       raise Exception
+
+    # add to history
+    if self.doc.add_to_history:
+      self.add_to_history(dt, dn, field, self.doc.code, comment)
+
+    # update
+    new_modified = now()
+    sql("update `tab%s` set `%s` = %s, modified = %s where name=%s" % (dt, field, '%s', '%s', '%s'), (self.doc.code, new_modified, dn))
+
+    # compile
+    if dt=='DocType':
+      get_obj('DocType',dn).compile_code()
+      sql("delete from __DocTypeCache where name=%s", dn)
+
+    msgprint('ok:Saved')
+    return new_modified
+
+  # get properties
+  # --------------
+  def get_properties(self, arg=''):
+    #return convert_to_lists(sql("select fieldname, label, fieldtype, options from tabDocField where parent=%s and ifnull(fieldname,'') != '' order by idx asc", self.doc.select_doctype))
+    return convert_to_lists(sql("select fieldname, label, fieldtype, options from tabDocField where parent=%s and ifnull(label,'') != '' order by idx asc", self.doc.select_doctype))
+  # add to history
+  # --------------
+  def add_to_history(self, dt, dn, fn, code, comment):
+    ch = Document('Code History')
+    ch.script_from = dt
+    ch.record_id = dn
+    ch.field_name = fn
+    ch.comment = comment
+    ch.code = code
+    ch.save(1)
+    
\ No newline at end of file
diff --git a/application_internal/doctype/code_editor/code_editor.txt b/application_internal/doctype/code_editor/code_editor.txt
new file mode 100644
index 0000000..5df5470
--- /dev/null
+++ b/application_internal/doctype/code_editor/code_editor.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-04 13:46:32', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': 1, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 131, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Code Editor', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00498', 'parent': 'Code Editor', 'read': 1, 'create': 1, 'creation': '2009-11-04 13:46:32', 'modified': '2010-04-16 15:06:58', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Head HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03265', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<h1>Code Editor</h1>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03266', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Code Hidden', 'width': None, 'trigger': None, 'depends_on': 'fn:test', 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03267', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'code', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Script From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03268', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'script_from', 'fieldtype': 'Select', 'options': 'DocType\nPage\nSearch Criteria\nPrint Format', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': 'doc_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Doc Type', 'width': None, 'trigger': '', 'depends_on': 'fn:is_doctype', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03269', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'doc_type', 'fieldtype': 'Select', 'options': 'link:DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Page Name', 'width': None, 'trigger': None, 'depends_on': 'fn:is_page', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03270', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'page_name', 'fieldtype': 'Select', 'options': 'link:Page', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Criteria ID', 'width': None, 'trigger': None, 'depends_on': 'fn:is_criteria', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03271', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'criteria_id', 'fieldtype': 'Link', 'options': 'Search Criteria', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Print Format', 'width': None, 'trigger': None, 'depends_on': 'fn:is_print_format', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03272', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'print_format', 'fieldtype': 'Select', 'options': 'link:Print Format', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': 'select', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code Type - DocType', 'width': None, 'trigger': None, 'depends_on': 'fn:is_doctype', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03273', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'code_type', 'fieldtype': 'Select', 'options': 'Server Code Core\nClient Script Core\nServer Code\nClient Script', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code Type - Page', 'width': None, 'trigger': None, 'depends_on': 'fn:is_page', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03274', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'code_type_page', 'fieldtype': 'Select', 'options': 'Script\nStyle\nContent', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code Type - Search Criteria', 'width': None, 'trigger': None, 'depends_on': 'fn:is_criteria', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03275', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'code_type_criteria', 'fieldtype': 'Select', 'options': 'Server Script\nReport Script', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code Toolbar', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03276', 'idx': 12, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<div style="padding: 4px; background-color: #DDD; margin: 8px 0px; width: 90%;">\n<button onclick="cur_frm.cscript.get_code();">Checkout Code</button>\n<button onclick="cur_frm.cscript.set_code();"><b>Save</b></button>\n<button onclick="loadreport(\'Code History\');">Open History</button>\n</div>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-05 10:02:27', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Add to history', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03288', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'add_to_history', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03277', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03278', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Property Head', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03279', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<h3 style="margin-top: 32px;">Property Reference</h3>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select DocType', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03280', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': 'select_doctype', 'fieldtype': 'Select', 'options': 'link:DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Property Toolbar', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03281', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<div style="padding: 4px; background-color: #DDD;margin: 8px 0px; width: 90%;">\n<button onclick="cur_frm.cscript.get_properties();">Get Properties</button>\n</div>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-11-04 13:46:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Property HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code Editor', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03282', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-04-16 15:06:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/code_history/__init__.py b/application_internal/doctype/code_history/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/code_history/__init__.py
diff --git a/application_internal/doctype/code_history/code_history.txt b/application_internal/doctype/code_history/code_history.txt
new file mode 100644
index 0000000..25ee935
--- /dev/null
+++ b/application_internal/doctype/code_history/code_history.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-04 13:46:36', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': '_CH.#######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Code History', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00499', 'parent': 'Code History', 'read': 1, 'create': None, 'creation': '2009-11-04 13:46:36', 'modified': '2010-03-31 11:15:39', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-04 13:46:37', 'doctype': 'DocField', 'oldfieldname': 'script_from', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Script From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code History', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03283', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 11:15:39', 'parenttype': 'DocType', 'fieldname': 'script_from', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-04 13:46:37', 'doctype': 'DocField', 'oldfieldname': 'record_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Record ID', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code History', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03284', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 11:15:39', 'parenttype': 'DocType', 'fieldname': 'record_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-04 13:46:37', 'doctype': 'DocField', 'oldfieldname': 'field_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code History', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03285', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 11:15:39', 'parenttype': 'DocType', 'fieldname': 'field_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-11-04 13:46:37', 'doctype': 'DocField', 'oldfieldname': 'comment', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Comment', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code History', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03286', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 11:15:39', 'parenttype': 'DocType', 'fieldname': 'comment', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Code', 'creation': '2009-11-04 13:46:37', 'doctype': 'DocField', 'oldfieldname': 'code', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Code History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03287', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-03-31 11:15:39', 'parenttype': 'DocType', 'fieldname': 'code', 'fieldtype': 'Code', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/doctype_label/__init__.py b/application_internal/doctype/doctype_label/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/doctype_label/__init__.py
diff --git a/application_internal/doctype/doctype_label/doctype_label.txt b/application_internal/doctype/doctype_label/doctype_label.txt
new file mode 100644
index 0000000..12f0cf8
--- /dev/null
+++ b/application_internal/doctype/doctype_label/doctype_label.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-10 10:41:58', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:dt', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'DocType Label', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01036', 'parent': 'DocType Label', 'read': 1, 'create': 1, 'creation': '2010-06-10 10:41:58', 'modified': '2010-06-10 10:44:09', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-10 10:41:58', 'doctype': 'DocField', 'oldfieldname': 'dt', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select DocType', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Label', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05322', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-10 10:44:09', 'parenttype': 'DocType', 'fieldname': 'dt', 'fieldtype': 'Select', 'options': 'link:DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-10 10:41:58', 'doctype': 'DocField', 'oldfieldname': 'dt_label', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'DocType Label', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Label', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05323', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-10 10:44:09', 'parenttype': 'DocType', 'fieldname': 'dt_label', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/doctype_property_setter/__init__.py b/application_internal/doctype/doctype_property_setter/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/doctype_property_setter/__init__.py
diff --git a/application_internal/doctype/doctype_property_setter/doctype_property_setter.py b/application_internal/doctype/doctype_property_setter/doctype_property_setter.py
new file mode 100644
index 0000000..28eccd4
--- /dev/null
+++ b/application_internal/doctype/doctype_property_setter/doctype_property_setter.py
@@ -0,0 +1,15 @@
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    
+  def update_dt(self):
+    sql("update tabDocType set module=%s, autoname=%s, read_only_onload=%s, section_style=%s, description=%s where name=%s limit 1", (self.doc.module, self.doc.autoname, self.doc.show_print_format_first, self.doc.page_style, self.doc.description, self.doc.select_doctype))
+    
+  def get_details(self):
+    ret = sql("select module, autoname, read_only_onload, section_style, description from tabDocType where name=%s", (self.doc.select_doctype))    
+    self.doc.module = ret[0][0] or ''
+    self.doc.autoname = ret[0][1] or ''
+    self.doc.show_print_format_first = ret[0][2] or 0
+    self.doc.page_style = ret[0][3] or 'Simple'
+    self.doc.description = ret[0][4] or ''
+    
\ No newline at end of file
diff --git a/application_internal/doctype/doctype_property_setter/doctype_property_setter.txt b/application_internal/doctype/doctype_property_setter/doctype_property_setter.txt
new file mode 100644
index 0000000..c2d47a5
--- /dev/null
+++ b/application_internal/doctype/doctype_property_setter/doctype_property_setter.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-11-30 22:45:10', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'DocType Property Setter', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00646', 'parent': 'DocType Property Setter', 'read': 1, 'create': 1, 'creation': '2010-11-30 22:45:10', 'modified': '2010-11-30 22:45:10', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select DocType', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03525', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': 'select_doctype', 'fieldtype': 'Select', 'options': 'link:DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get Details', 'width': None, 'trigger': 'Server', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03526', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Module', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03527', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': 'module', 'fieldtype': 'Link', 'options': 'Module Def', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Autoname', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03528', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': 'autoname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Page Style', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03529', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': 'page_style', 'fieldtype': 'Select', 'options': 'Simple\nTabbed\nTray', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Show Print Format First', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03530', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': 'show_print_format_first', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03531', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-30 22:45:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Update', 'width': None, 'trigger': 'Server', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'DocType Property Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03532', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-11-30 22:45:10', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'update_dt', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/documentation/__init__.py b/application_internal/doctype/documentation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/documentation/__init__.py
diff --git a/application_internal/doctype/documentation/documentation.txt b/application_internal/doctype/documentation/documentation.txt
new file mode 100644
index 0000000..6295434
--- /dev/null
+++ b/application_internal/doctype/documentation/documentation.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-09-11 12:51:55', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': 'index_html = \'\'\'\n  <div class = "divmargin" style="margin-left:%s;border">\n    <table style="width:100%%;font-family: Arial, Sans; font-size:%s;font-weight:%s;">\n      <tr>\n        <td style="width:40px;text-align:right;">%s</td>\n        <td>%s</td>        \n      </tr>\n    </table>%s\n  </div>\n\'\'\'\n\nmod_html = \'\'\'\n    <br><div class = "divmargin" style="margin-left:32px;">\n      <table style="width:100%%;font-family: Arial, Sans; font-size: 20px;font-weight:normal;">\n        <tr>\n          <td style="width:40px;text-align:right;">%s</td>\n          <td>%s</td>\n        </tr>\n      </table>%s\n    </div>\n\'\'\'\n\nreport_html = \'\'\'\n  <div class = "divmargin" style="margin-left:40px;">\n    <table style="width:100%%;font-family: Arial, Sans; font-size: 18px;font-weight:normal;">\n      <tr>\n        <td style="width:40px;text-align:right;">%s</td>\n        <td>%s</td>\n      </tr>\n    </table>\n  </div>\n\'\'\'\n\ndoc_html=\'\'\'\n    <br><div class = "divmargin" style="margin-left:40px;">\n      <table style="width:100%%;font-family: Arial, Sans; font-size: 18px;font-weight:normal;">\n        <tr>\n          <td style="width:40px;text-align:right;">%s</td>\n          <td>%s</td>\n        </tr>\n      </table>%s\n    </div>\n\'\'\'\n\ndocsec_html=\'\'\'\n  <div class = "divmargin" style="margin-left:48px;">\n      <table style="width:100%%;font-family: Arial, Sans; font-size: 16px;font-weight:normal;">\n        <tr>\n          <td style="width:40px;text-align:right;">%s</td>\n          <td>%s</td>\n        </tr>\n      </table>%s\n  </div>\n  <div style="page-break-after:always;">\n  </div>\n\'\'\'\n\nscreenshot_html=\'\'\'\n  <br><div class = "divmargin"><img src="cgi-bin/getfile.cgi?name=%s"></img></div>\n\'\'\'\n\ndocfields_html = \'\'\'\n  <div class = "divmargin" style="margin-left:56px; width:800px;">\n    <table style="border:%s;background-color:%s;">\n      <tr>\n        <td>%s:</td>\n      </tr>\n      <tr>\n        <td><div class = "divmargin" style="margin-left:20px;width:550;"><p><code>%s</code></p></div></td>  \n      </tr>\n    </table>\n  </div>\n\'\'\'\n\ndoctables_html = \'\'\'\n  <div class = "divmargin" style="margin-left:56px;">\n    <table style="width:100%%;">\n      <tr>\n        <td>%s</td>\n      </tr>\n      <tr>\n        <td>%s</td>\n      </tr>      \n    </table>\n  </div>\n\'\'\'\n\nclass DocType:\n  def __init__(self,doc,doclist=[]):\n    self.doc = doc\n    self.doclist = doclist\n    self.main_html = \'\'\n    self.out = \'\'\n    self.index_html = \'\'\n    \n  def get_doc(self):\n    self.main_html = \'\'\'<html><head><style type="text/css">p{white-space:pre-wrap}</style><style>.simpletable {border-collapse:collapse;}</style><style>.simpletable td {padding: 3px; border: 1pt solid #000; font-family: Arial, Sans; font-size: 12px; vertical-align: top; }</style><style>.divmargin {margin-right:25px;}</style><style>.margin {margin:50px;}</style></head><body class="margin" style="border-collapse:collapse"><div style="margin:20px;border:1px solid #000;border-collapse:collapse;">%s</div><div style="page-break-after:always;"></div><div style="margin:20px;border:1px solid #000;border-collapse:collapse">%s</div></body><html>\'\'\'\n\n#All modules\n    modules = sql("select module_name from `tabModule Def`")\n    n=0\n    grp_mod_html= \'\'\n    grp_modindex_html = \'\'\n    temp_main_html = \'\'\n    for m in modules:\n      n1=0\n      n = n+1\n      rp_no = 0\n      grp_doc_html=\'\'\'<br><div style="margin-left:40px;font-family: Arial, Sans; font-size: 16px;font-weight:normal;">DocTypes</div>\'\'\'\n      grp_report_html=\'\'\'<br><div style="margin-left:40px;font-family: Arial, Sans; font-size: 16px;font-weight:normal;">Reports</div>\'\'\'\n      grp_docindex_html =\'\'\n      reports = sql("select distinct criteria_name from `tabSearch Criteria` where module= \'%s\'" % m[0])\n      doctypes = sql("select name from `tabDocType` where module =\'%s\'" %(m[0]))\n\n      for rp in reports:\n        rp_no +=1\n        grp_report_html += report_html % (str(rp_no), rp[0])\n\n      for d in doctypes:\n        n1 = n1+1\n        n2 = 0\n        sr = \'\'\n        sr= str(n) + \'.\' + str(n1)\n        grp_docsec_html = \'\'\n        grp_secindex_html = \'\'\n        grp_ss_html=\'\'\n        docfields_name = sql("select name,autoname,description,client_script,server_code,client_string from `tabDocType` where name=%s",d[0],as_dict = 1)\n#        docsections = [\'Screenshot\',\'Options\',\'Permissions\',\'Fields\',\'Client Script\', \'Server Script\',\'Client String\']\n        docsections = [\'Options\',\'Permissions\',\'Fields\']        \n        for ds in docsections:\n          n2 = n2+1\n          sr1 = \'\'\n          sr1 = str(n)+\'.\'+str(n1)+\'.\'+str(n2)\n          for df in docfields_name:\n            grp_docfields_html = \'\'\n            if ds == \'Options\':\n              self.out = \'\'\n              if df[\'name\']:\n                grp_docfields_html += docfields_html % (\'0pt none #FFFFFF\',\'#FFFFFF\',\'Name\',str(df[\'name\']))\n              if df[\'autoname\']:             \n                grp_docfields_html += docfields_html % (\'0pt none #FFFFFF\',\'#FFFFFF\',\'AutoName\',str(df[\'autoname\']))\n              if df[\'description\']:\n                grp_docfields_html += docfields_html % (\'0pt none #FFFFFF\',\'#FFFFFF\',\'Description\',str(df[\'description\']))\n          \n            if ds == \'Client Script\':\n              if df[\'client_script\']:\n                cl_sc = df[\'client_script\'].replace(\'<\',\'< \')\n                grp_docfields_html += docfields_html % (\'1pt solid #000\',\'#EBECE4\',\'Code\',cl_sc)\n            if ds == \'Server Script\':\n              if df[\'server_code\']:\n                ser_sc = df[\'server_code\'].replace(\'<\',\'< \')\n                grp_docfields_html += docfields_html % (\'1pt solid #000\',\'#EBECE4\',\'Code\',ser_sc)\n            if ds == \'Client String\':\n              if df[\'client_string\']:\n                cl_str = df[\'client_string\'].replace(\'<\',\'< \')\n                grp_docfields_html += docfields_html % (\'1pt solid #000\',\'#EBECE4\',\'Code\',cl_str)\n\n#for screenshot\n#            if ds == \'Screenshot\':\n #             fname = sql("select file_list from `tabDocType` where name=%s", d[0])[0][0] or \'\'\n  #            fname = fname.split(\',\')[0]\n   #           if fname:\n    #            grp_docfields_html += screenshot_html % (fname)\n              \n#              grp_docsec_html += docsec_html % (str(sr1),ds,grp_ss_html)\n\n#for permission table\n            if ds == \'Permissions\':\n              lbl1 = [\'Level\',\'Role\',\'Read\',\'Write\',\'Create\',\'Submit\',\'Cancel\',\'Amend\',\'Execute\',\'Match\']\n              perm = sql("select `permlevel`,`role`,`read`,`write`,`create`,`submit`,`cancel`,`amend`,`execute`,`match` from `tabDocPerm` where parent=\'%s\' order by idx" % d[0])\n              self.make_table(perm,\'Roles & Permissions\',lbl1)                \n            \n              grp_docfields_html += doctables_html % (\'\', self.out)\n            \n#for table fields\n            if ds == \'Fields\':\n              self.out = \'\'\n              tbl_name = \'\'\n              #Doctype fields\n              lbl = [\'Label\',\'Type\',\'Name\',\'Option\',\'Perm Level\']\n              \n              option1 = sql("select label,fieldtype,fieldname,options,permlevel from `tabDocField` where parent=\'%s\' and fieldtype !=\'Section Break\' and fieldtype != \'Column Break\' order by idx" % d[0])\n\n              self.make_table(option1,d[0],lbl)\n\n              #table fields\n              tbl = sql("select options from `tabDocField` where parent=\'%s\' and fieldtype=\'Table\'" % d[0])\n              for t in tbl:\n                option2 = sql("select label,fieldtype,fieldname,options,permlevel from `tabDocField` where parent=\'%s\' and fieldtype !=\'Section Break\' and fieldtype != \'Column Break\' order by idx" % t[0])\n                self.make_table(option2,t[0],lbl)\n\n              grp_docfields_html +=doctables_html % (\'\', self.out)\n#              grp_docsec_html += docsec_html % (str(sr1),ds,grp_ss_html)\n          grp_docsec_html += docsec_html % (str(sr1), ds, grp_docfields_html)\n          grp_secindex_html += index_html % (\'48px\',\'16px\',\'normal\',str(sr1),ds,\'\')        \n        grp_doc_html += doc_html % (str(sr), d[0], grp_docsec_html)\n        grp_docindex_html += index_html % (\'40px\',\'18px\',\'normal\',str(sr), d[0],grp_secindex_html)      \n      grp_mod_html += mod_html % (str(n),m[0],grp_doc_html)\n      grp_mod_html += grp_report_html\n      grp_modindex_html += \'<br>\' + index_html % (\'32px\',\'20px\',\'normal\',str(n),m[0],grp_docindex_html)\n\n    self.main_html = self.main_html % (grp_modindex_html, grp_mod_html)\n    return self.main_html\n    \n  def make_table(self,opt,heading,lbl):\n    sr_no = 0\n    self.out += \'<br><div style="margin-left:56px; width:100%%">\' + heading + \'</div>\'\n    self.out += \'\'\'<br><div style="margin-left:56px; width:100%%">\n                <table class="simpletable" width="100%%" style="page-break-after:always;">\n                  <tr>\n                    <td style="width:5%%;">Sr</td>\'\'\'\n\n    for l in lbl:\n      self.out += \'<td>\' + l + \'</td>\'\n    self.out +=\'</tr>\'\n                  \n    for op in opt:\n      sr_no += 1\n      self.out = self.out + \'<tr>\'\n      self.out = self.out + \'<td>\'+cstr(sr_no)+\'</td>\'\n      for i in range(len(lbl)):\n        self.out = self.out + \'<td>\'+cstr(op[i])+\'</td>\'\n\n    self.out = self.out + \'</table></div>\'\n    return self.out', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Documentation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': "cur_frm.cscript['Print Document'] = function(doc,cdt,cdn){\n  $c('runserverobj',args={'method':'get_doc','docs':compress_doclist([doc])},\n    function(r,rt){\n      get_print_doc(r.message);\n    }\n  );\n}\n\nvar get_print_doc = function(html){\n//  alert('print - ' + html)\n  var w = window.open('');\n  w.document.write(html);\n  w.document.close();\n}", 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00415', 'parent': 'Documentation', 'read': 1, 'create': 1, 'creation': '2009-09-11 12:51:55', 'modified': '2010-03-31 10:33:16', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-11 12:51:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Print Document', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Documentation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02955', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:33:16', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/form_settings/__init__.py b/application_internal/doctype/form_settings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/form_settings/__init__.py
diff --git a/application_internal/doctype/form_settings/form_settings.js b/application_internal/doctype/form_settings/form_settings.js
new file mode 100644
index 0000000..bbf9617
--- /dev/null
+++ b/application_internal/doctype/form_settings/form_settings.js
@@ -0,0 +1,25 @@
+cur_frm.fields_dict['doctype_name'].get_query = function(doc){
+  return 'SELECT tabDocType.name FROM tabDocType WHERE (tabDocType.istable != 1 OR tabDocType.istable is null) AND (tabDocType.issingle !=1 OR tabDocType.issingle is null) AND tabDocType.name LIKE "%s"';
+}
+
+cur_frm.fields_dict['report_filter_details'].grid.get_field("field_label_fr").get_query = function(doc){
+  return 'SELECT tabDocField.label FROM tabDocField WHERE tabDocField.parent = "' + doc.doctype_name+ '" AND tabDocField.fieldname is not null AND tabDocField.fieldname != "'+''+'" AND tabDocField.fieldtype != "Table" AND tabDocField.label LIKE "%s"';
+}
+
+cur_frm.fields_dict['report_field_details'].grid.get_field("field_label_fd").get_query = function(doc){
+  return 'SELECT tabDocField.label FROM tabDocField WHERE tabDocField.parent = "' + doc.doctype_name+ '" AND tabDocField.fieldname is not null AND tabDocField.fieldname != "'+''+'" AND tabDocField.fieldtype != "Table" AND tabDocField.label LIKE "%s"';
+}
+
+cur_frm.cscript.field_label_fr = function(doc,cdt,cdn){
+  var d = locals[cdt][cdn];
+  if(d.field_label_fr){
+    get_server_fields('get_filter_details',d.field_label_fr,'report_filter_details',doc,cdt,cdn,1);
+  }
+}
+
+cur_frm.cscript.field_label_fd = function(doc,cdt,cdn){
+  var d = locals[cdt][cdn];
+  if(d.field_label_fd){
+    get_server_fields('get_field_details',d.field_label_fd,'report_field_details',doc,cdt,cdn,1);
+  }
+}
\ No newline at end of file
diff --git a/application_internal/doctype/form_settings/form_settings.py b/application_internal/doctype/form_settings/form_settings.py
new file mode 100644
index 0000000..8ccf990
--- /dev/null
+++ b/application_internal/doctype/form_settings/form_settings.py
@@ -0,0 +1,54 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def autoname(self):
+    rep_nm = self.doc.doctype_name + '-' + 'Settings'
+    if sql("select name from `tabForm Settings` where name=%s",rep_nm):
+      msgprint("Settings for this form already created, please open existing form to do any changes.")
+      raise Exception
+    else:
+      self.doc.name = rep_nm
+      
+  def get_filter_details(self,arg=''):
+    dt_det = sql("select label, fieldtype, options, fieldname from tabDocField where parent=%s and label=%s",(self.doc.doctype_name,arg),as_dict=1)
+        
+    ret = {
+      'field_label_fr' : dt_det and dt_det[0]['label'] or '',
+      'field_type_fr'  : dt_det and dt_det[0]['fieldtype'] or '',
+      'options_fr'     : dt_det and dt_det[0]['options'] or '',
+      'field_name_fr'  : dt_det and dt_det[0]['fieldname'] or '',
+      'table_name_fr'  : self.doc.doctype_name 
+    }
+    return cstr(ret)
+    
+  def get_field_details(self,arg=''):
+    dt_det = sql("select label, fieldtype, options, fieldname from tabDocField where parent=%s and label=%s",(self.doc.doctype_name,arg),as_dict=1)
+    ret = {
+      'field_label_fd' : dt_det and dt_det[0]['label'] or '',
+      'field_type_fd'  : dt_det and dt_det[0]['fieldtype'] or '',
+      'options_fd'     : dt_det and dt_det[0]['options'] or '',
+      'field_name_fd'  : dt_det and dt_det[0]['fieldname'] or '',
+      'table_name_fd'  : self.doc.doctype_name 
+    }
+    return cstr(ret)    
\ No newline at end of file
diff --git a/application_internal/doctype/form_settings/form_settings.txt b/application_internal/doctype/form_settings/form_settings.txt
new file mode 100644
index 0000000..021c4d1
--- /dev/null
+++ b/application_internal/doctype/form_settings/form_settings.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-29 15:13:46', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 30, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Form Settings', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-29 15:13:46', 'doctype': 'DocField', 'oldfieldname': 'doctype_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'DocType Name', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02235', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:56', 'parenttype': 'DocType', 'fieldname': 'doctype_name', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-06-01 18:37:22', 'doctype': 'DocField', 'oldfieldname': 'is_master', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Is Master', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02260', 'idx': 2, 'default': 'No', 'colour': None, 'modified': '2010-03-31 10:11:56', 'parenttype': 'DocType', 'fieldname': 'is_master', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-05-29 15:13:46', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Report Filters', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02237', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:56', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-05-29 15:13:46', 'doctype': 'DocField', 'oldfieldname': 'report_filter_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Report Filter Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02236', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:56', 'parenttype': 'DocType', 'fieldname': 'report_filter_details', 'fieldtype': 'Table', 'options': 'Report Filter Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-05-29 15:13:46', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Report Fields', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02238', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:56', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-05-29 15:13:46', 'doctype': 'DocField', 'oldfieldname': 'report_field_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Report Field Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Form Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02239', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:56', 'parenttype': 'DocType', 'fieldname': 'report_field_details', 'fieldtype': 'Table', 'options': 'Report Field Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/gl_mapper/__init__.py b/application_internal/doctype/gl_mapper/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/gl_mapper/__init__.py
diff --git a/application_internal/doctype/gl_mapper/gl_mapper.txt b/application_internal/doctype/gl_mapper/gl_mapper.txt
new file mode 100644
index 0000000..927a322
--- /dev/null
+++ b/application_internal/doctype/gl_mapper/gl_mapper.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:20', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'field:doc_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'GL Mapper', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00034', 'parent': 'GL Mapper', 'read': 1, 'create': 0, 'creation': '2009-03-12 12:09:20', 'modified': '2010-04-08 12:29:12', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00660', 'parent': 'GL Mapper', 'read': 1, 'create': None, 'creation': '2010-02-10 13:50:27', 'modified': '2010-03-31 10:38:44', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'doc_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Doc Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00361', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:38:44', 'parenttype': 'DocType', 'fieldname': 'doc_type', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'fields', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fields', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00362', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:38:44', 'parenttype': 'DocType', 'fieldname': 'fields', 'fieldtype': 'Table', 'options': 'GL Mapper Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/gl_mapper_detail/__init__.py b/application_internal/doctype/gl_mapper_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/gl_mapper_detail/__init__.py
diff --git a/application_internal/doctype/gl_mapper_detail/gl_mapper_detail.txt b/application_internal/doctype/gl_mapper_detail/gl_mapper_detail.txt
new file mode 100644
index 0000000..929118a
--- /dev/null
+++ b/application_internal/doctype/gl_mapper_detail/gl_mapper_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:20', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'GLMDetail.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'GL Mapper Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'table_field', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Table Field', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00363', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'table_field', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'account', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00364', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'account', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'debit', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Debit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00365', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'debit', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'credit', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Credit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00366', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'credit', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'cost_center', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Cost Center', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00367', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'cost_center', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'against', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Against', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00368', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'against', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'remarks', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Remarks', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00369', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'remarks', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'voucher_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Voucher Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00370', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'voucher_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'voucher_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Voucher No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00371', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'voucher_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'posting_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Posting Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date at which current entry will get or has actually executed.', 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00372', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'posting_date', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'transaction_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Transaction Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date at which current entry is made in system.', 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00373', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'transaction_date', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-30 17:55:40', 'doctype': 'DocField', 'oldfieldname': 'aging_date', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Aging Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04931', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'aging_date', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00374', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'against_voucher', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Against Voucher', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00375', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'against_voucher', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'against_voucher_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Against Voucher Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00376', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'against_voucher_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:20', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00377', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-04 16:40:02', 'doctype': 'DocField', 'oldfieldname': 'is_opening', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Is Opening', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01966', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'is_opening', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-07-21 16:59:08', 'doctype': 'DocField', 'oldfieldname': 'is_advance', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Is Advance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'GL Mapper Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02620', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-04-30 17:55:40', 'parenttype': 'DocType', 'fieldname': 'is_advance', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/impact_analysis/__init__.py b/application_internal/doctype/impact_analysis/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/impact_analysis/__init__.py
diff --git a/application_internal/doctype/impact_analysis/impact_analysis.txt b/application_internal/doctype/impact_analysis/impact_analysis.txt
new file mode 100644
index 0000000..1640f05
--- /dev/null
+++ b/application_internal/doctype/impact_analysis/impact_analysis.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-09 16:04:30', 'search_fields': 'change_title', 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'IA/.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Impact Analysis', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00510', 'parent': 'Impact Analysis', 'read': 1, 'create': 1, 'creation': '2009-11-09 16:22:32', 'modified': '2010-03-31 10:39:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00511', 'parent': 'Impact Analysis', 'read': 1, 'create': None, 'creation': '2009-11-09 16:22:32', 'modified': '2010-03-31 10:39:26', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Analysis', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03314', 'idx': 1, 'default': None, 'colour': 'Light Blue:DEF', 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03315', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': 'change_title', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03311', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': 'change_title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': 'analysis_verified_by', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Analysis Verified By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03312', 'idx': 4, 'default': '', 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': 'analysis_verified_by', 'fieldtype': 'Select', 'options': 'link:Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': 'code_verified_by', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Code Verified By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03313', 'idx': 5, 'default': '', 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': 'code_verified_by', 'fieldtype': 'Select', 'options': 'link:Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03316', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': 'related_doctype', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Related DocType', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03308', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': 'related_doctype', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Action', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03317', 'idx': 8, 'default': None, 'colour': 'Light Blue:DEF', 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': 'changes_to_be_made', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Changes To Be Made', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03309', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': 'changes_to_be_made', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Code', 'creation': '2009-11-09 16:22:32', 'doctype': 'DocField', 'oldfieldname': 'effect_on_existing_account', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Patching Procedure', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Impact Analysis', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03310', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-03-31 10:39:26', 'parenttype': 'DocType', 'fieldname': 'effect_on_existing_account', 'fieldtype': 'Code', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/mail/__init__.py b/application_internal/doctype/mail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/mail/__init__.py
diff --git a/application_internal/doctype/mail/mail.txt b/application_internal/doctype/mail/mail.txt
new file mode 100644
index 0000000..806c28c
--- /dev/null
+++ b/application_internal/doctype/mail/mail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-04 10:23:48', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'Mail/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Mail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01028', 'parent': 'Mail', 'read': 1, 'create': 1, 'creation': '2010-06-04 10:23:48', 'modified': '2010-08-08 15:04:31', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01029', 'parent': 'Mail', 'read': 1, 'create': None, 'creation': '2010-06-04 10:23:48', 'modified': '2010-08-08 15:04:31', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-07 11:13:15', 'doctype': 'DocField', 'oldfieldname': 'to_user', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'To user', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05261', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'to_user', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-07 11:13:15', 'doctype': 'DocField', 'oldfieldname': 'from_user', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'From User', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05262', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'from_user', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'is_main_thread', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Is Main Thread', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05228', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'is_main_thread', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'main_thread_id', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Main Thread Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05229', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'main_thread_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'subject', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Subject', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05230', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'subject', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'message', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05231', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'message_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Message Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05232', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'message_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'last_updated_by', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Last Updated By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05233', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'last_updated_by', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'last_updated_on', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Last Updated On', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05234', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'last_updated_on', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-04 10:23:48', 'doctype': 'DocField', 'oldfieldname': 'previous_updated_by', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Previous Updated By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05235', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'previous_updated_by', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-06-04 10:28:22', 'doctype': 'DocField', 'oldfieldname': 'mail_participant', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Mail Participant', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05239', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:31', 'parenttype': 'DocType', 'fieldname': 'mail_participant', 'fieldtype': 'Table', 'options': 'Mail Participant Details', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/mail_participant_details/__init__.py b/application_internal/doctype/mail_participant_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/mail_participant_details/__init__.py
diff --git a/application_internal/doctype/mail_participant_details/mail_participant_details.txt b/application_internal/doctype/mail_participant_details/mail_participant_details.txt
new file mode 100644
index 0000000..b6a13b2
--- /dev/null
+++ b/application_internal/doctype/mail_participant_details/mail_participant_details.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-04 10:40:44', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Mail Participant Details', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-04 10:40:44', 'doctype': 'DocField', 'oldfieldname': 'participant_name', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Participant Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail Participant Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05240', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:17', 'parenttype': 'DocType', 'fieldname': 'participant_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-04 10:40:44', 'doctype': 'DocField', 'oldfieldname': 'read_status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Read Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail Participant Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05241', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:17', 'parenttype': 'DocType', 'fieldname': 'read_status', 'fieldtype': 'Select', 'options': '\nRead\nUnread', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-04 10:40:44', 'doctype': 'DocField', 'oldfieldname': 'delete_status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Delete Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Mail Participant Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05242', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 15:04:17', 'parenttype': 'DocType', 'fieldname': 'delete_status', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/menu_control/__init__.py b/application_internal/doctype/menu_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/menu_control/__init__.py
diff --git a/application_internal/doctype/menu_control/menu_control.js b/application_internal/doctype/menu_control/menu_control.js
new file mode 100644
index 0000000..96c4b3c
--- /dev/null
+++ b/application_internal/doctype/menu_control/menu_control.js
@@ -0,0 +1,82 @@
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d,dl
+
+  def get_children(self, arg='', only_type='', in_roles=[]):
+
+    type_cond = only_type and (" and menu_item_type='%s'" % only_type) or ''
+    
+    if globals().has_key('version') and version=='v170':
+      import webnotes
+      roles = webnotes.user.get_roles()
+      all_read = webnotes.user.can_read
+    else:    
+      roles = in_roles or session['data']['roles']
+      all_read = session['data']['all_readtypes']
+      
+    cl = sql("select name, menu_item_label, menu_item_type, link_id, link_content, has_children, icon, `order`, criteria_name, doctype_fields, onload from `tabMenu Item` where ifnull(disabled,'No')!='Yes' and ifnull(parent_menu_item,'')='%s' %s order by `order` asc" % (arg, type_cond), as_dict=1)
+    ol = []
+    for c in cl:
+      c['has_children'] = cint(c['has_children'])
+      c['order'] = cint(c['order'])
+      for k in c.keys(): 
+        if c[k]==None: c[k] = ''
+
+      # check permission
+      if c['menu_item_type'] in ('DocType','Single','Report'):
+        if c['link_id'] in all_read:
+          ol.append(c)
+      elif c['menu_item_type']=='Page':
+        # page
+        if c['link_id'].startswith('_'):
+          ol.append(c)
+        elif has_common([r[0] for r in sql("select role from `tabPage Role` where parent=%s", c['link_id'])], roles):
+          ol.append(c)
+      elif cstr(c['menu_item_type'])=='':
+        # sections
+        if has_common([r[0] for r in sql("select role from `tabMenu Item Role` where parent=%s", c['name'])], roles):
+          ol.append(c)
+      else:
+        ol.append(c)
+    
+    return ol
+
+  def get_dt_details(self, arg):
+    dt, fl = arg.split('~~~')    
+
+    out = {}
+
+    # filters
+    # -------
+
+    sf = sql("select search_fields from tabDocType where name=%s", dt)[0][0] or ''
+    sf = [s.strip() for s in sf.split(',')]
+    if sf and sf[0]:
+      res = sql("select fieldname, label, fieldtype, options from tabDocField where parent='%s' and fieldname in (%s)" % (dt, '"'+'","'.join(sf)+'"'))
+    else:
+      res = []
+
+    res = [[c or '' for c in r] for r in res]
+    for r in res:
+      if r[2]=='Select' and r[3] and r[3].startswith('link:'):
+        tdt = r[3][5:]
+        ol = sql("select name from `tab%s` where docstatus!=2 order by name asc" % tdt)
+        r[3] = NEWLINE.join([''] + [o[0] for o in ol])
+
+    if not res:
+      out['filters'] = [['name', 'ID', 'Data', '']]
+    else:
+      out['filters'] = res
+    
+    # columns
+    # -------
+    fl = fl.split(NEWLINE)
+    fl = [f.split(',')[0] for f in fl]
+    res = []
+    for f in fl:
+      res += [[c or '' for c in r] for r in sql("select fieldname, label, fieldtype, options from tabDocField where parent='%s' and fieldname='%s'" % (dt, f))]
+
+    out['columns'] = [['name', 'ID', 'Link', dt]] + res
+
+    return out
+ 
\ No newline at end of file
diff --git a/application_internal/doctype/menu_control/menu_control.py b/application_internal/doctype/menu_control/menu_control.py
new file mode 100644
index 0000000..0718006
--- /dev/null
+++ b/application_internal/doctype/menu_control/menu_control.py
@@ -0,0 +1,265 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cint, cstr
+from webnotes.model.doc import Document
+from webnotes.model.code import get_obj
+from webnotes import session, form, msgprint, errprint
+
+sql = webnotes.conn.sql
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d,dl
+
+	# --------------------------------------------------------------
+	def get_children(self, arg='', only_type='', in_roles=[]):
+
+		type_cond = only_type and (" and menu_item_type='%s'" % only_type) or ''
+		
+		import webnotes
+		roles = webnotes.user.get_roles()
+		all_read = webnotes.user.can_get_report
+			
+		cl = sql("select name, menu_item_label, menu_item_type, link_id, link_content, has_children, icon, `order`, criteria_name, doctype_fields, onload from `tabMenu Item` where ifnull(disabled,'No')!='Yes' and ifnull(parent_menu_item,'')='%s' %s order by `order` asc" % (arg, type_cond), as_dict=1)
+		ol = []
+		for c in cl:
+			c['has_children'] = cint(c['has_children'])
+			c['order'] = cint(c['order'])
+			for k in c.keys(): 
+				if c[k]==None: c[k] = ''
+
+			# check permission
+			if c['menu_item_type'] in ('DocType','Single','Report'):
+				if c['link_id'] in all_read:
+					ol.append(c)
+			elif c['menu_item_type']=='Page':
+				# page
+				if c['link_id'].startswith('_'):
+					ol.append(c)
+				elif has_common([r[0] for r in sql("select role from `tabPage Role` where parent=%s", c['link_id'])], roles):
+					ol.append(c)
+			elif cstr(c['menu_item_type'])=='':
+				# sections
+				if has_common([r[0] for r in sql("select role from `tabMenu Item Role` where parent=%s", c['name'])], roles):
+					ol.append(c)
+			else:
+				ol.append(c)
+		
+		return ol
+
+	# --------------------------------------------------------------
+	def has_result(self, dt):
+		return sql("select name from `tab%s` limit 1" % dt) and 'Yes' or 'No'
+
+	# --------------------------------------------------------------
+
+	def is_submittable(self, dt):
+		return sql("select name from tabDocPerm where parent=%s and ifnull(submit,0)=1 and docstatus<1 limit 1", dt)
+
+	# --------------------------------------------------------------
+
+	def can_cancel(self, dt):
+		return sql('select name from tabDocPerm where parent="%s" and ifnull(cancel,0)=1 and docstatus<1 and role in ("%s") limit 1' % (dt, '", "'.join(webnotes.user.get_roles())))
+
+	# --------------------------------------------------------------
+	def get_dt_trend(self, dt):
+		ret = {}
+		for r in sql("select datediff(now(),modified), count(*) from `tab%s` where datediff(now(),modified) between 0 and 30 group by date(modified)" % dt):
+			ret[cint(r[0])] = cint(r[1])
+		return ret
+
+	# --------------------------------------------------------------
+
+	def get_columns(self, out, sf, fl, dt):
+		if not fl:
+			fl = sf
+
+		res = []
+		for f in fl:
+			if f:
+				res += [[c or '' for c in r] for r in sql("select fieldname, label, fieldtype, options from tabDocField where parent='%s' and fieldname='%s'" % (dt, f))]
+				
+		return res
+
+	# --------------------------------------------------------------
+
+	def check_user_tags(self, dt):
+		try:
+			sql("select `_user_tags` from `tab%s` limit 1" % dt)
+		except Exception, e:
+			if e.args[0] == 1054:
+				webnotes.conn.commit()
+				sql("alter table `tab%s` add column `_user_tags` varchar(180)" % dt)
+				webnotes.conn.begin()
+
+	# --------------------------------------------------------------
+	# NOTE: THIS SHOULD BE CACHED IN DOCTYPE CACHE
+	# --------------------------------------------------------------
+	
+	def get_dt_details(self, arg):
+		dt, fl, color_map = eval(arg)
+		submittable = self.is_submittable(dt) and 1 or 0
+	 
+		out = {
+			'submittable':(self.is_submittable(dt) and 1 or 0), 
+			'can_cancel':(self.can_cancel(dt) and 1 or 0)
+		}
+
+		# filters
+		# -------
+
+		sf = sql("select search_fields from tabDocType where name=%s", dt)[0][0] or ''
+
+		# get fields from in_filter (if not in search_fields)
+		if not sf.strip():
+			res = sql("select fieldname, label, fieldtype, options from tabDocField where parent=%s and `in_filter` = 1 and ifnull(fieldname,'') != ''", dt)
+			sf = [s[0] for s in res]
+		else:
+			sf = [s.strip() for s in sf.split(',')]
+			res = sql("select fieldname, label, fieldtype, options from tabDocField where parent='%s' and fieldname in (%s)" % (dt, '"'+'","'.join(sf)+'"'))
+
+		# select "link" options
+		res = [[c or '' for c in r] for r in res]
+		for r in res:
+			if r[2]=='Select' and r[3] and r[3].startswith('link:'):
+				tdt = r[3][5:]
+				ol = sql("select name from `tab%s` where docstatus!=2 order by name asc" % tdt)
+				r[3] = "\n".join([''] + [o[0] for o in ol])
+
+		if not res:
+			out['filters'] = [['name', 'ID', 'Data', '']]
+		else:
+			out['filters'] = [['name', 'ID', 'Data', '']] + res
+		
+		# columns
+		# -------
+		res = self.get_columns(out, sf, fl, dt)
+		
+		self.check_user_tags(dt)
+		
+		out['columns'] = [['name', 'ID', 'Link', dt], ['modified', 'Modified', 'Data', ''], ['_user_tags', 'Tags', 'Data', '']] + res
+		
+		if cint(color_map):
+			out['color_map'] = self.get_color_map()
+			
+		return out
+
+	# --------------------------------------------------------------
+
+	def get_color_map(self):
+		d={}
+		try:
+			for tag in sql("select name, tag_color from tabTag"):
+				d[tag[0]] = tag[1]
+		except Exception, e:
+			if e.args[0] in (1146, 1054):
+				return {}
+			else:
+				raise e
+		return d
+
+	# --------------------------------------------------------------
+
+	def get_trend(self, dt):
+		return {'trend': self.get_dt_trend(dt)}
+
+	# --------------------------------------------------------------
+
+	def get_tags(self, dt, dn):
+		tl = sql("select ifnull(_user_tags,'') from tab%s where name=%s" % (dt,'%s'), dn)[0][0]
+		return tl and tl.split(',') or []
+	
+	# --------------------------------------------------------------
+
+	def update_tags(self, dt, dn, tl):
+		if len(','.join(tl)) > 179:
+			msgprint("Too many tags")
+			raise Exception
+		
+		tl = filter(lambda x: x, tl)
+		
+		# update in table
+		sql("update tab%s set _user_tags=%s where name=%s" % (dt,'%s','%s'), (',' + ','.join(tl), dn))
+		
+		# update in feed (if present)
+		sql("update tabFeed set _user_tags=%s where doc_label=%s and doc_name=%s", (',' + ','.join(tl), dt, dn))
+
+	# --------------------------------------------------------------
+
+	def _add_tag_to_master(self, tag, color):
+		if color:
+			t, cond = color, ("on duplicate key update tag_color='%s'" % color)
+		else:
+			t, cond = 'Default', ''
+			
+		sql("insert ignore into tabTag(name, tag_color) values ('%s', '%s') %s" % (tag, t, cond))
+		
+	def create_tag(self, tag, color):
+		try:
+			self._add_tag_to_master(tag, color)
+		except Exception, e:
+			# add the table
+			if e.args[0]==1146:
+				webnotes.conn.commit()
+				sql("create table `tabTag`(`name` varchar(180), tag_color varchar(180), primary key (`name`))")
+				webnotes.conn.begin()
+				self._add_tag_to_master(tag, color)
+
+			# udpate the color column
+			if e.args[0]==1054:
+				webnotes.conn.commit()
+				sql("alter table tabTag add column tag_color varchar(180)")
+				webnotes.conn.begin()
+				self._add_tag_to_master(tag, color)
+				
+			else:
+				raise e
+
+	# --------------------------------------------------------------
+
+	def add_tag(self,arg):
+		dt, dn, tag, color = eval(arg)
+		
+		# create tag in tag table
+		self.create_tag(tag, color)
+		
+		# add in _user_tags
+		tl = self.get_tags(dt, dn)
+		
+		if not tag in tl:
+			tl.append(tag)
+			self.update_tags(dt, dn, tl)
+			
+		return tag
+ 
+ 	# --------------------------------------------------------------
+
+	def remove_tag(self,arg):
+		dt, dn, tag = eval(arg)
+		tl = self.get_tags(dt, dn)				
+		self.update_tags(dt, dn, filter(lambda x:x!=tag, tl))
+		
+	# --------------------------------------------------------------
+
+	def delete_items(self,arg):
+		il = eval(arg)
+		from webnotes.model import delete_doc
+		for d in il:
+			dt_obj = get_obj(d[0], d[1])
+			if hasattr(dt_obj, 'on_trash'):
+				dt_obj.on_trash()
+			delete_doc(d[0], d[1])
+
+	# --------------------------------------------------------------
+
+	def archive_items(self,arg):
+		arg = eval(arg)
+		
+		from webnotes.utils.archive import archive_doc
+		for d in arg['items']:
+			archive_doc(d[0], d[1], arg['action']=='Restore' and 1 or 0)
diff --git a/application_internal/doctype/menu_control/menu_control.txt b/application_internal/doctype/menu_control/menu_control.txt
new file mode 100644
index 0000000..37f7268
--- /dev/null
+++ b/application_internal/doctype/menu_control/menu_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-06-12 12:08:31', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 55, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Menu Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/message/__init__.py b/application_internal/doctype/message/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/message/__init__.py
diff --git a/application_internal/doctype/message/message.txt b/application_internal/doctype/message/message.txt
new file mode 100644
index 0000000..6a7d6ec
--- /dev/null
+++ b/application_internal/doctype/message/message.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-13 13:47:58', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'MSG.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Message', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00770', 'parent': 'Message', 'read': 1, 'create': 1, 'creation': '2010-04-13 13:47:58', 'modified': '2010-08-08 15:03:43', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Customer', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00771', 'parent': 'Message', 'read': 1, 'create': 1, 'creation': '2010-04-13 13:47:58', 'modified': '2010-08-08 15:03:43', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Supplier', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00772', 'parent': 'Message', 'read': 1, 'create': 1, 'creation': '2010-04-13 13:47:58', 'modified': '2010-08-08 15:03:43', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-13 13:47:58', 'doctype': 'DocField', 'oldfieldname': 'subject', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Subject', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Message', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04639', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:43', 'parenttype': 'DocType', 'fieldname': 'subject', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-13 13:47:58', 'doctype': 'DocField', 'oldfieldname': 'message_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Message Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Message', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04641', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:43', 'parenttype': 'DocType', 'fieldname': 'message_type', 'fieldtype': 'Select', 'options': 'Enquiry\nFeedback\nComplaint\nSuggestion', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-13 13:47:58', 'doctype': 'DocField', 'oldfieldname': 'details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Message', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04640', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:43', 'parenttype': 'DocType', 'fieldname': 'details', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/message_control/__init__.py b/application_internal/doctype/message_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/message_control/__init__.py
diff --git a/application_internal/doctype/message_control/message_control.py b/application_internal/doctype/message_control/message_control.py
new file mode 100644
index 0000000..0903f16
--- /dev/null
+++ b/application_internal/doctype/message_control/message_control.py
@@ -0,0 +1,307 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  #get list of unread messages
+  #------------------------------------
+  def get_unread_msg_lst(self,arg):
+    ret = {}
+    ret['ur_lst'] = convert_to_lists(sql("select t1.name from `tabMail` t1, `tabMail Participant Details` t2 where t2.participant_name = '%s' and t2.parent = t1.name and (t2.read_status = 'No' or t2.read_status is NULL) and (t2.delete_status = 'No' or t2.delete_status is NULL) and t1.last_updated_by != t2.participant_name" % arg))
+    return ret
+  
+  # get list of email participants at the time of reply msg. This will give name of iwebnotes user and email id of non iwebnotes user if envolved in that email
+  #------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+  def get_thread_details(self,arg):
+    arg = eval(arg)
+    ret = {}
+    to_list3 = []
+    
+    ret['tl'] = convert_to_lists(sql("select t1.subject,t1.message, t1.owner, t1.message_date, t1.main_thread_id, t2.first_name, t2.file_list from `tabMail` t1, `tabProfile` t2 where t1.main_thread_id='%s' and t2.name=t1.owner" % arg['cur_msg_id']))
+    
+    to_user_list = sql("select participant_name from `tabMail Participant Details` where participant_name != '%s' and parent = '%s'" % (arg['user_name'], arg['cur_msg_id']))
+    to_list1 = [x[0] for x in to_user_list]
+    
+    non_member_dict = self.get_non_member_list(to_list1)
+    non_member_list = non_member_dict['non_erp_user']
+    
+    for m in to_list1:
+      if m not in non_member_list:
+        to_list2 = sql("select first_name from `tabProfile` where name = '%s'" % (m))
+        to_list3.append(to_list2[0][0])
+    
+    for y in non_member_list:
+      to_list3.append(y)
+    
+    ret['to_list'] = to_list3    
+    return ret
+  
+  #validate message
+  #---------------------
+  def validate_message(self, msg, to_list = []):
+    ml = ['subject','message']
+    for m in ml:
+      if not msg.fields.get(m):
+        msgprint("error:To, Subject and Message are required. Please try again.")
+        raise Exception
+  
+  #get list of emails which are not registered on that iwebnotes account
+  #----------------------------------------------------------------------------------
+  def get_non_member_list(self, arg):
+    to_list, ret, new_list, non_valid_lst, non_valid_lst_msg= arg, {}, [], [], ''
+    
+    for m in to_list:
+      check_user = sql("select name from `tabProfile` where name = '%s'" % m)
+      check_user = check_user and check_user[0][0] or 'not_user'
+      
+      if check_user == 'not_user':
+        if not validate_email_add(m):
+          non_valid_lst.append(m)
+        else:
+          new_list.append(m)
+    
+    if non_valid_lst:
+      for x in non_valid_lst:
+        if non_valid_lst_msg == '' :
+          non_valid_lst_msg = x
+        else :
+          non_valid_lst_msg = non_valid_lst_msg + ', ' + x
+      msgprint("error:Incorrect email id format. Message can not be sent to following mentioned email-id(s)." + "\n" + "\n" + non_valid_lst_msg)
+    
+    ret['non_erp_user'] = new_list
+    ret['non_valid_lst'] = non_valid_lst
+    return ret
+  
+  #create message thread
+  #----------------------------------
+  def create_msg_thread(self, arg, to_list, new_msg):
+    arg = eval(arg)
+    msg_fld = {'message_date':nowdate(), 'owner':arg['user_name'], 'subject':arg['subject'], 'message':arg['message'], 'last_updated_on':nowdate(), 'last_updated_by':arg['user_name'], 'is_main_thread':new_msg and 'Yes' or 'No', 'to_user':new_msg and cstr(to_list) or '', 'from_user': new_msg and arg['user_name'] or '', 'previous_updated_by': new_msg and arg['user_name'] or ''}
+    
+    msg = Document('Mail')
+    for f in msg_fld:
+      msg.fields[f]=msg_fld[f]
+    if new_msg:
+      self.validate_message(msg, to_list)
+    if not new_msg:
+      msg.main_thread_id = arg['message_id']
+    msg.save(new=1)
+    return msg.name
+  
+  #add mail participants
+  #---------------------------
+  def add_mail_participants(self, participant, msg_id):
+    fields = {'participant_name': participant, 'parent':msg_id, 'parenttype':'Mail', 'parentfield':'mail_participant'}
+    child = Document('Mail Participant Details')
+    for f in fields:
+      child.fields[f]=fields[f]
+    child.save(new=1)
+  
+  #send email notification to personal id
+  #-----------------------------------------------
+  def email_to_personal_id(self, email_arg, non_member_list):
+    message_subject =''
+    if email_arg['participant'] not in non_member_list:
+      r_full_nm = sql("select first_name from`tabProfile` where name = '%s'" % email_arg['participant'])
+      r_full_nm = r_full_nm and r_full_nm[0][0] or ''
+    
+    if not(email_arg['participant'] == email_arg['sender']):
+      if email_arg['participant'] not in non_member_list:
+        self.notification_email_to_members(email_arg['participant'],r_full_nm,email_arg['sender'],email_arg['sender_nm'])
+      else :
+        message_subject = 'Message from ' + cstr(email_arg['sender_nm']) + '- '
+        if email_arg['new_msg']:
+          message_subject=message_subject+ cstr(email_arg['mail_sub'])
+        else:
+          message_subject=message_subject+ 'Re: '+cstr(email_arg['mail_sub'])
+        self.notification_email_to_non_members(email_arg['participant'], email_arg['sender'], email_arg['sender_nm'], message_subject, email_arg['mail_msg'])
+  
+  #send new message
+  #----------------------------
+  def send_message(self,arg1):
+    arg = eval(arg1)
+    val, to_list1 = 'false', arg['to_list'].split(',')
+    new_list = [l.strip() for l in to_list1 if l.strip()]
+    
+    non_member_dict = self.get_non_member_list(new_list)
+    non_member_list = non_member_dict['non_erp_user']
+    non_valid_lst = non_member_dict['non_valid_lst']
+    
+    if len(new_list) > len(non_valid_lst) :
+      to_list = [m for m in new_list if m not in non_valid_lst]
+      to_list.append(arg['user_name'])
+      msg_id = self.create_msg_thread(arg1, to_list, 1)
+      sql("update `tabMail` set main_thread_id = '%s' where name = '%s'" % (msg_id, msg_id))
+      
+      s_full_nm = sql("select first_name from`tabProfile` where name = '%s'" % arg['user_name'])
+      s_full_nm = s_full_nm and s_full_nm[0][0] or ''
+      
+      for t in to_list:
+        self.add_mail_participants(t,msg_id)
+        val = 'true'
+        
+        # email notification to personal email id
+        email_arg = {'participant':t, 'sender':arg['user_name'], 'sender_nm':s_full_nm, 'mail_sub':arg['subject'], 'mail_msg':arg['message'], 'new_msg':1}
+        self.email_to_personal_id(email_arg, non_member_list) 
+      return cstr(val)
+    else :
+      msgprint("error:Please mention preper email-ids. Message can not be sent.");
+  
+  #update main msg thread
+  #---------------------------------
+  def update_main_thread_msg(self, arg):
+    thread_msg = Document('Mail',arg['message_id'])
+    thread_msg.last_updated_on = nowdate()
+    if thread_msg.last_updated_by != session['user']:
+      thread_msg.previous_updated_by = thread_msg.last_updated_by
+    thread_msg.last_updated_by = arg['user_name']
+    thread_msg.save()
+  
+  #send reply msg
+  #---------------------
+  def send_reply(self,arg1):
+    arg = eval(arg1)
+    val = 'false'
+    
+    if not arg['message']:
+      msgprint("Please type some message")
+      raise Exception
+    
+    msg_id = self.create_msg_thread(arg1, '', 0)
+    self.update_main_thread_msg(arg)
+    
+    nm = sql("select name from `tabMail` where main_thread_id = '%s' and is_main_thread = 'Yes'" % arg['message_id'])
+    msg_nm = nm and nm[0][0] or ''
+    sql("update `tabMail Participant Details` set delete_status = 'No' where parent='%s'" % (msg_nm))
+    sql("update `tabMail Participant Details` set read_status = 'No' where parent='%s' and participant_name != '%s'" % (msg_nm, session['user']))
+    val = 'true'
+    
+    p_nm = sql("select participant_name from `tabMail Participant Details` where parent='%s' and participant_name!='%s'"%(msg_nm, session['user']))
+    if p_nm:
+      p_nm_lst = [x[0] for x in p_nm]
+      
+      non_member_dict = self.get_non_member_list(p_nm_lst)
+      non_member_list = non_member_dict['non_erp_user']
+      
+      s_full_nm = sql("select first_name from`tabProfile` where name = '%s'" % arg['user_name'])
+      s_full_nm = s_full_nm and s_full_nm[0][0] or ''
+      
+      for m in p_nm_lst:
+        # email notification to personal email id
+        email_arg = {'participant':m, 'sender':arg['user_name'], 'sender_nm':s_full_nm, 'mail_sub':arg['subject'], 'mail_msg':arg['message'], 'new_msg':0}
+        self.email_to_personal_id(email_arg, non_member_list)    
+    return cstr(val)
+  
+  #delete message
+  #----------------------
+  def delete_message(self, arg):
+    m_arg = arg.split('~~')
+    user_nm = m_arg[0]
+    msg_lst = m_arg[1].split(',')
+    msg_del = 'false'
+    for i in msg_lst:
+      sql("update `tabMail Participant Details` set delete_status = 'Yes' where parent='%s' and participant_name = '%s'" % (i, user_nm))
+      msg_del = 'true'
+    return cstr(msg_del)
+  
+  # set read or unread status of message
+  #---------------------------------------------
+  def read_unread_message(self,arg):
+    arg = eval(arg);
+    sql("update `tabMail Participant Details` set read_status = '%s' where parent='%s' and participant_name = '%s'" % (arg['read'],arg['msg'], arg['user']))
+  
+  # function for checking message is already read or not
+  #--------------------------------------------------------------
+  def check_read(self,arg):
+    arg = eval(arg);
+    chk_val=sql("select read_status from `tabMail Participant Details` where parent='%s' and participant_name = '%s'" % (arg['msg'], arg['user']))[0][0] or ''
+    if chk_val == '':
+      chk_val = 'blank'
+    
+    return cstr(chk_val)
+  
+  #list of autosuggested users for 'to list'
+  #-----------------------------------------------
+  def get_to_list(self, arg):
+    li = sql("select name, first_name from `tabProfile` where first_name like '%s%%' and name!='%s' and name!='Guest' limit 10" % (arg.strip(), session['user']))
+    li = [{'id':l[0], 'value':l[0], 'info':l[1]} for l in li]
+    return {'results':li}    
+  
+  # unread message count
+  #--------------------------
+  def get_unread_msg_count(self, arg):
+    ret = convert_to_lists(sql("select count(t1.name) from `tabMail` t1, `tabMail Participant Details` t2 where t2.participant_name = '%s' and t2.parent = t1.name and (t2.read_status = 'No' or t2.read_status is NULL) and (t2.delete_status = 'No' or t2.delete_status is NULL) and t1.last_updated_by != t2.participant_name" % arg))
+    
+    if ret:
+      return cstr(ret[0][0])
+    else:
+      return cstr(0)
+  
+  # email notification to personal email id of registered users
+  #--------------------------------------------------------------------
+  def notification_email_to_members(self, receiver_id, r_full_nm, sender_id, s_full_nm):
+    msg = """
+<html>
+<body>
+
+Dear %s,<br><br>    
+You have received a new message from %s.<br>
+
+To check the message, visit Inbox of erpnext.<br><br>
+Stay connected using the link:<br><br>
+<div><a href ='https://www.erpnext.com' target ='_blank'> https://www.erpnext.com</a></div><br><br>
+ 
+Thank You,<br><br>
+Administrator<br>
+erpnext
+</body>
+</html>
+    """ % (r_full_nm, s_full_nm)
+
+    # send email
+    sendmail([receiver_id], sender = sender_id, msg=msg, subject='ERP - You have received a new message')
+  
+  # email to non ERP member's personal id
+  #-------------------------------------------------------
+  def notification_email_to_non_members(self, receiver_id, sender_id, s_full_nm, message_subject, message):
+    msg = """
+<html>
+<body>
+
+Hi,<br><br>
+You have received a new message from %s via erpnext.<br><br>
+Message:<br>
+%s<br><br>
+
+Not on erpnext? Sign up now! <br>
+Stay connected using the link:<br><br>
+<div><a href ='https://www.erpnext.com' target ='_blank'> https://www.erpnext.com</a></div><br><br>
+
+Thank You,<br><br>
+Administrator<br>
+erpnext
+</body>
+</html>
+    """ % (s_full_nm, message)
+
+    # send email
+    sendmail([receiver_id], sender = sender_id, msg=msg, subject=message_subject)
\ No newline at end of file
diff --git a/application_internal/doctype/message_control/message_control.txt b/application_internal/doctype/message_control/message_control.txt
new file mode 100644
index 0000000..c88731e
--- /dev/null
+++ b/application_internal/doctype/message_control/message_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-07 11:26:34', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 17, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Message Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-04 14:20:37', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/module_setter/__init__.py b/application_internal/doctype/module_setter/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/module_setter/__init__.py
diff --git a/application_internal/doctype/module_setter/module_setter.py b/application_internal/doctype/module_setter/module_setter.py
new file mode 100644
index 0000000..3bfc264
--- /dev/null
+++ b/application_internal/doctype/module_setter/module_setter.py
@@ -0,0 +1,25 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d,dl):
+    self.doc, self.doclist = d,dl
+
+  def set_module(self):
+    sql("update tabDocType set module=%s where name=%s", (self.doc.module, self.doc.doc_type))
\ No newline at end of file
diff --git a/application_internal/doctype/module_setter/module_setter.txt b/application_internal/doctype/module_setter/module_setter.txt
new file mode 100644
index 0000000..e570e2d
--- /dev/null
+++ b/application_internal/doctype/module_setter/module_setter.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:36:55', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Module Setter', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00143', 'parent': 'Module Setter', 'read': 1, 'create': 1, 'creation': '2009-03-12 12:36:55', 'modified': '2010-03-31 10:42:15', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:36:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Doc Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Module Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01328', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:42:15', 'parenttype': 'DocType', 'fieldname': 'doc_type', 'fieldtype': 'Select', 'options': 'link:DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:36:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Module', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Module Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01329', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:42:15', 'parenttype': 'DocType', 'fieldname': 'module', 'fieldtype': 'Select', 'options': 'link:Module Def', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:36:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Set', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Module Setter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01330', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:42:15', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'set_module', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/module_tip_control/__init__.py b/application_internal/doctype/module_tip_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/module_tip_control/__init__.py
diff --git a/application_internal/doctype/module_tip_control/module_tip_control.py b/application_internal/doctype/module_tip_control/module_tip_control.py
new file mode 100644
index 0000000..9b97ad5
--- /dev/null
+++ b/application_internal/doctype/module_tip_control/module_tip_control.py
@@ -0,0 +1,34 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  # get update on recent activities of module
+  # -----------------------------------------
+  def get_module_activity(self, args):
+    args = eval(args)
+    ret = {}
+    for tr in args['tr_list']:
+      cnt = sql("select ifnull(count(name),0) from `tab%s` where datediff(now(),creation) between 0 and 7"%(tr))
+      if cnt[0][0]:
+        ret[tr] = cnt
+    if ret:        
+      return ret
\ No newline at end of file
diff --git a/application_internal/doctype/module_tip_control/module_tip_control.txt b/application_internal/doctype/module_tip_control/module_tip_control.txt
new file mode 100644
index 0000000..ee56819
--- /dev/null
+++ b/application_internal/doctype/module_tip_control/module_tip_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-10 12:54:12', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 30, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Module Tip Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-08 11:50:50', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/multiple_transfer/__init__.py b/application_internal/doctype/multiple_transfer/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/multiple_transfer/__init__.py
diff --git a/application_internal/doctype/multiple_transfer/multiple_transfer.js b/application_internal/doctype/multiple_transfer/multiple_transfer.js
new file mode 100644
index 0000000..d12bfa4
--- /dev/null
+++ b/application_internal/doctype/multiple_transfer/multiple_transfer.js
@@ -0,0 +1,158 @@
+cur_frm.cscript.is_list = function(d) { return d.modules_or_list=='List' ? 1 : 0 }
+cur_frm.cscript.is_modules = function(d) { return d.modules_or_list=='Modules' ? 1 : 0 }
+
+cur_frm.cscript['Do Transfer'] = function(doc) {
+  al = getchildren('Transfer Account', doc.name, 'transfer_accounts');
+  ml = getchildren('Transfer Module', doc.name, 'transfer_modules');
+  sl = doc.selected_list.split(NEWLINE)
+  
+  cur_frm.cscript.cancel_transfer = 0;
+
+  cur_frm.cscript.do_list = [];
+
+  // for each account
+  for(var ai = 0; ai < al.length; ai++) {
+
+
+    // if transfer
+    if(cint(al[ai].transfer)) {
+
+      // module
+      // ------
+      if(doc.modules_or_list == 'Modules') {
+      
+        for(var mi = 0; mi < ml.length; mi++) {
+        
+          if(ml[mi].transfer) {
+            var args = {server:al[ai].server, path:al[ai].path, pwd:al[ai].admin_password, act: al[ai].account, module:ml[mi].module, transfer_what:doc.transfer_what}
+            cur_frm.cscript.do_list.push(args);
+          }
+        }
+      }
+
+      // list
+      // ------
+      if(doc.modules_or_list == 'List') {
+      
+        for(var si = 0; si < sl.length; si++) {
+          if(sl[si]){
+          var s = sl[si].split(',');        
+          var args = {server:al[ai].server, path:al[ai].path, pwd:al[ai].admin_password, act: al[ai].account, dt: strip(s[0]), dn:strip(s[1]), transfer_what:doc.transfer_what}
+          cur_frm.cscript.do_list.push(args);}
+        }
+      }
+    }
+
+  }
+  
+  locals[doc.doctype][doc.name].transfer_log = 'Transferring...'.bold();
+  refresh_field('transfer_log');
+    
+  if(cur_frm.cscript.do_list.length)
+  	cur_frm.cscript.do_next();
+
+}
+
+cur_frm.cscript.do_next = function() {
+
+  if(cur_frm.cscript.do_list.length){
+    var t = cur_frm.cscript.do_list[0];
+
+    // do transfer
+
+    locals[doc.doctype][doc.name].transfer_log += '<br>Transferring... Account:' + t.act + ':' + t.module + ', Record:'+t.dt + ',' + t.dn;
+    refresh_field('transfer_log');
+
+    $c_obj(make_doclist(doc.doctype, doc.name), 'do_transfer', docstring(t), cur_frm.cscript.ret_fn);
+
+    
+    // remove from list
+    var tmp = [];
+    for(var i=1;i<cur_frm.cscript.do_list.length;i++)tmp.push(cur_frm.cscript.do_list[i]);
+    cur_frm.cscript.do_list = tmp;
+  }
+}
+
+cur_frm.cscript.ret_fn = function(r,rt) {
+  locals[doc.doctype][doc.name].transfer_log += '<br>' + r.message;
+  refresh_field('transfer_log');
+
+  
+  if(cur_frm.cscript.do_list.length <= 0) {
+    locals[doc.doctype][doc.name].transfer_log += '<br><b>Completed!</b>';
+    refresh_field('transfer_log');
+    return;
+  }
+  if(!cur_frm.cscript.cancel_transfer)
+    cur_frm.cscript.do_next();
+  else {
+    locals[doc.doctype][doc.name].transfer_log += '<br><b>Cancelled!</b>';
+    refresh_field('transfer_log');
+
+  }
+}
+
+cur_frm.cscript['Cancel Transfer'] = function(doc,dt,dn) {
+  cur_frm.cscript.cancel_transfer = 1;
+}
+
+
+/*-------------------------- running remote script in account selected-----------------------*/
+
+cur_frm.cscript['Update Accounts'] = function(doc) {
+  var al = getchildren('Transfer Account', doc.name, 'transfer_accounts');
+  
+  cur_frm.cscript.update_list = [];
+  cur_frm.cscript.cancel_updates = 0;
+  
+  for(var ai = 0; ai < al.length; ai++) {
+    if(cint(al[ai].transfer)){
+      var args = {server:al[ai].server, path:al[ai].path, pwd:al[ai].admin_password, act: al[ai].account};
+      cur_frm.cscript.update_list.push(args);
+    }  
+  }
+  
+  locals[doc.doctype][doc.name].transfer_log = 'Updating...'.bold();
+  refresh_field('transfer_log');
+    
+  if(cur_frm.cscript.update_list.length)
+    cur_frm.cscript.update_accounts();
+}
+
+cur_frm.cscript.update_accounts = function(){
+  if(cur_frm.cscript.update_list.length){
+    var t = cur_frm.cscript.update_list[0];
+
+    // update account
+    locals[doc.doctype][doc.name].transfer_log += '<br>Updating... Account:' + t.act;
+    refresh_field('transfer_log');
+    
+    $c_obj(make_doclist(doc.doctype, doc.name), 'execute_remote_code', docstring(t), cur_frm.cscript.accounts_updated);
+    
+    // remove from list
+    var tmp = [];
+    for(var i=1;i<cur_frm.cscript.update_list.length;i++)tmp.push(cur_frm.cscript.update_list[i]);
+    cur_frm.cscript.update_list = tmp;
+  }
+}
+
+cur_frm.cscript.accounts_updated = function(r,rt){
+  locals[doc.doctype][doc.name].transfer_log += '<br>' + r.message;
+  refresh_field('transfer_log');
+
+  if(cur_frm.cscript.update_list.length <= 0) {
+    locals[doc.doctype][doc.name].transfer_log += '<br><b>Completed!</b>';
+    refresh_field('transfer_log');
+    return;
+  }
+  if(!cur_frm.cscript.cancel_updates)
+    cur_frm.cscript.update_accounts();
+  else {
+    locals[doc.doctype][doc.name].transfer_log += '<br><b>Cancelled!</b>';
+    refresh_field('transfer_log');
+  }
+}
+
+cur_frm.cscript['Cancel Updates'] = function(doc,dt,dn) {
+  cur_frm.cscript.cancel_updates = 1;
+}
\ No newline at end of file
diff --git a/application_internal/doctype/multiple_transfer/multiple_transfer.py b/application_internal/doctype/multiple_transfer/multiple_transfer.py
new file mode 100644
index 0000000..c0fba21
--- /dev/null
+++ b/application_internal/doctype/multiple_transfer/multiple_transfer.py
@@ -0,0 +1,159 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d,dl
+    
+  # Modules
+  # -----------
+
+  def get_module_items(self, mod, only_dt=0):
+    dl = []
+    if only_dt:
+      transfer_types = ['DocType']
+    else:
+      transfer_types = ['Role',  'Print Format','DocType', 'Page', 'DocType Mapper', 'Search Criteria','Menu Item']
+      dl = ['Module Def,'+mod]
+	  
+    for dt in transfer_types:
+      try:
+        dl2 = sql('select name from `tab%s` where module="%s"' % (dt,mod))
+        dl += [(dt+','+e[0]) for e in dl2]
+      except:
+        pass
+
+    if not only_dt:
+      dl1 = sql('select doctype_list from `tabModule Def` where name=%s', mod)
+      dl += dl1[0][0].split("\n")
+
+    # build finally
+    dl = [e.split(',') for e in dl]
+    dl = [[e[0].strip(), e[1].strip()] for e in dl] # remove blanks
+    return dl
+
+  def do_transfer(self, arg):
+    import datetime
+    arg = eval(arg)
+    # server, path, act, pwd, dt, dn, module
+    
+    standard_menu_items = ""      # to store all standard menu items in remote account
+    super_doclist = []            # to make the list of all doctypes to transfer and then send together 
+    modified_time = ''
+    # get dt list
+    # -----------
+    
+    dt_only = 1
+    if arg['transfer_what']=='Everything':
+      dt_only = 0
+    
+    if arg.get('module'):
+      dtl = self.get_module_items(arg['module'], dt_only)
+    else:
+      dtl = [[arg['dt'], arg['dn']]]
+
+    # login to target
+    # ---------------
+    
+    rem_serv = FrameworkServer(arg.get('server'),arg.get('path'),"Administrator",arg.get('pwd'),arg.get('act', ''))
+    
+    msg = []
+    for dt in dtl:
+      
+      transfer = 1
+      # check version
+      # -------------
+      if dt[0]=='DocType':
+        get_modified_time = '''msgprint(sql("SELECT modified FROM `tab%s` WHERE name = '%s'"))''' %(dt[0],dt[1])
+        ret = rem_serv.runserverobj('Control Panel','Control Panel','execute_test',get_modified_time)
+        if ret.get('exc'):
+          msg.append(ret['exc'])
+        elif eval(ret.get('server_messages')):    # get modified time
+          modified_time = eval(ret.get('server_messages'))
+          for t in modified_time:
+            original_date = sql("select modified from `tab%s` where name = '%s'"%(dt[0],dt[1]))
+            if cstr(t[0])==cstr(original_date[0][0]):
+              transfer = 0
+              msg.append("DocType '%s' is already transferred"%(dt[1]))
+            else:
+              transfer = 1
+      
+      # transfer menu items
+      # -------------------------
+      if dt[0]=='Menu Item' or dt[0]=='Print Format' or dt[0]=='Search Criteria' or dt[0]=='Page':
+        # get name and standard field of all menu items
+        get_standard_menu_items = '''msgprint(sql("SELECT name, standard, modified FROM `tab%s` WHERE name = '%s'"))''' %(dt[0],dt[1])
+        ret = rem_serv.runserverobj('Control Panel','Control Panel','execute_test',get_standard_menu_items)
+        if ret.get('exc'):
+          msg.append(ret['exc'])
+        elif eval(ret.get('server_messages')):    # checks for standard menu items
+          standard_menu_items = eval(ret.get('server_messages'))
+          for sml in standard_menu_items:
+            original_date = sql("select modified from `tab%s` where name = '%s'"%(dt[0],sml[0]))
+            if sml[1] == 'Yes' and cmp(sml[2],original_date[0][0]) != 0:
+              super_doclist.append(self.transfer(dt[0], sml[0]))
+            else:
+              msg.append(dt[0]+" : "+dt[1]+" is customized or already transferred.")
+          transfer = 0
+
+        elif not eval(ret.get('server_messages')): # for first time entry
+          transfer = 1
+              
+      if transfer != 0:
+        super_doclist.append(self.transfer(dt[0], dt[1]))
+    
+    if super_doclist:
+      myargs = { 'ovr': 1, 'ignore': 1, 'onupdate': 1, 'super_doclist': {'super_doclist':super_doclist} }
+      res = rem_serv.http_get_response(method = 'acctr_remote_setdoclist', args = myargs)
+      data = eval(res.read())
+      msg.append(data['message'])
+	
+      if data.has_key('exc'):
+        msg.append(data['exc'])
+            
+    return '<br>'.join(msg)
+    
+  def transfer(self, dt, dn):
+    tl = getdoc(dt, dn)
+    # clean up
+    no_export_fields = ('creation','modified_by','owner','server_code_compiled','recent_documents','oldfieldtype','oldfieldname','superclass','ss_colourkey','has_monitors','onupdate','permtype','no_copy', 'print_hide','transaction_safe','setup_test')
+
+    for d in tl:
+      for f in no_export_fields:
+        if d.fields.has_key(f): del d.fields[f]
+
+    return [d.fields for d in tl]
+
+
+  # run remote script
+  # ----------------------------------------
+  
+  def execute_remote_code(self, arg):
+    msg = []
+    arg = eval(arg)
+    remote_server = FrameworkServer(arg.get('server'),arg.get('path'),"Administrator",arg.get('pwd'),arg.get('act', ''))
+    ret = remote_server.runserverobj('Control Panel','Control Panel','execute_test',self.doc.remote_code)
+    if ret.get('exc'):
+      msg.append(ret['exc'])
+    else:
+      if ret.get('server_messages'):  # this returns msg in msgprints from remote account
+        msgprint(arg.get('act')+':')
+        msgprint(ret['server_messages'])
+      msg.append(arg.get('act')+" updated")
+    return '<br>'.join(msg)
\ No newline at end of file
diff --git a/application_internal/doctype/multiple_transfer/multiple_transfer.txt b/application_internal/doctype/multiple_transfer/multiple_transfer.txt
new file mode 100644
index 0000000..2c5cbd7
--- /dev/null
+++ b/application_internal/doctype/multiple_transfer/multiple_transfer.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-04-29 15:06:28', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 392, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Multiple Transfer', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00284', 'parent': 'Multiple Transfer', 'read': 1, 'create': 1, 'creation': '2009-04-29 15:06:28', 'modified': '2010-08-08 14:50:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00285', 'parent': 'Multiple Transfer', 'read': 1, 'create': None, 'creation': '2009-04-29 16:46:42', 'modified': '2010-08-08 14:50:02', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Accounts', 'width': '62%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01943', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-22 10:52:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Application Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05676', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'application_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-22 10:52:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Get App Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05677', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_app_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer Accounts', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01944', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'transfer_accounts', 'fieldtype': 'Table', 'options': 'Transfer Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer List', 'width': '38%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01945', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 16:29:42', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Modules or List', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01950', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'modules_or_list', 'fieldtype': 'Select', 'options': 'Modules\nList', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 16:29:42', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer List', 'width': None, 'trigger': '', 'depends_on': 'fn:is_list', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'List individual items to transfer in the format DocType, name, each on a new line.<br>\nExample: DocType, Sales Order', 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01951', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'selected_list', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer Modules', 'width': None, 'trigger': '', 'depends_on': 'fn:is_modules', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01946', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'transfer_modules', 'fieldtype': 'Table', 'options': 'Transfer Module', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01947', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer What', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01948', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'transfer_what', 'fieldtype': 'Select', 'options': '\nDocTypes\nEverything', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-23 13:27:03', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer To', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05680', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'transfer_to', 'fieldtype': 'Select', 'options': 'Selected Accounts\nAll Accounts', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 15:06:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Do Transfer', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01949', 'idx': 12, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-29 16:46:42', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer Log', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01952', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'transfer_log', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-05-11 16:12:19', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Cancel Transfer', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02023', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 14:25:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Remote Script', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02554', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 14:25:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Remote Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02555', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': 'remote_code', 'fieldtype': 'Code', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 17:59:46', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02561', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 17:54:04', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02558', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 14:25:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update Accounts', 'width': '', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'HANDLE WITH CARE !!!!!', 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02556', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 17:54:04', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02559', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-07-08 17:54:04', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Cancel Updates', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'OOOOPS !!!!! MISTAKE !!!!!!!!! SORRY !!!!!!', 'parent': 'Multiple Transfer', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02560', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-08-08 14:50:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/password_control/__init__.py b/application_internal/doctype/password_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/password_control/__init__.py
diff --git a/application_internal/doctype/password_control/password_control.py b/application_internal/doctype/password_control/password_control.py
new file mode 100644
index 0000000..fbe95f1
--- /dev/null
+++ b/application_internal/doctype/password_control/password_control.py
@@ -0,0 +1,40 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+  
+  def get_date_diff(self):
+    if session['user'] != 'Administrator' and session['user'] != 'Demo':
+      last_pwd_date = sql("select password_last_updated from tabProfile where name=%s",session['user'])[0][0] or ''
+      if cstr(last_pwd_date) == '':
+        sql("update tabProfile set password_last_updated = '%s' where name='%s'"% (nowdate(),session['user']))
+      else:
+        date_diff = (getdate(nowdate()) -last_pwd_date).days
+        return date_diff
+        
+  def get_cur_pwd(self):
+    if session['user'] != 'Administrator' and session['user'] != 'Demo':
+      cur_pwd = sql("select password from tabProfile where name=%s",session['user'])[0][0] or ''
+      return cur_pwd
+      
+  def reset_password(self,pwd):
+    sql("update tabProfile set password= '%s',password_last_updated='%s' where name = '%s'" % (pwd,nowdate(),session['user']))
\ No newline at end of file
diff --git a/application_internal/doctype/password_control/password_control.txt b/application_internal/doctype/password_control/password_control.txt
new file mode 100644
index 0000000..c2d5632
--- /dev/null
+++ b/application_internal/doctype/password_control/password_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-25 17:17:29', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 7, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Password Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/patch_util/__init__.py b/application_internal/doctype/patch_util/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/patch_util/__init__.py
diff --git a/application_internal/doctype/patch_util/patch_util.py b/application_internal/doctype/patch_util/patch_util.py
new file mode 100644
index 0000000..f26d110
--- /dev/null
+++ b/application_internal/doctype/patch_util/patch_util.py
@@ -0,0 +1,101 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+
+	def get_field_id(self, doctype, fieldname):
+		f = sql("select name, idx from tabDocField where parent=%s and fieldname=%s", (doctype, fieldname))
+		if not f:
+			f=sql("select name, idx from tabDocField where parent=%s and label=%s", (doctype, fieldname))
+		if not f:
+			return '__notfound__', 0
+			#msgprint("No field found for %s" % fieldname)
+			#raise Exception
+		return f[0]
+
+	def set_field_property(self, doctype, fieldname, property, value):
+		f = self.get_field_id(doctype, fieldname)
+		sql("update tabDocField set `%s`=%s where name=%s" % (property,'%s','%s'), (value, f[0]))
+	
+	def move_field(self, doctype, fieldname, before_field='', after_field=''):
+		f1 = self.get_field_id(doctype, fieldname)
+		
+		# get new id
+		new_idx = self.get_field_id(doctype, before_field or after_field)[1]
+		if after_field: 
+			new_idx = new_idx + 1
+				
+		# push fields down at new idx
+		sql("update tabDocField set idx=idx+1 where idx>=%s and parent=%s", (new_idx, doctype))
+
+		# push fields up at old idx
+		sql("update tabDocField set idx=idx-1 where idx>%s and parent=%s", (f1[1], doctype))
+		
+		# set field idx
+		sql("update tabDocField set idx=%s where name=%s", (new_idx, f1[0]))
+	
+	def delete_field(self, doctype, fieldname):
+		sql("delete from tabDocField where name=%s limit 1", self.get_field_id(doctype, fieldname)[0])
+
+	def delete_unnamed_field(self, doctype, after_field=''):
+		f1 = self.get_field_id(doctype, after_field)
+		
+		if f1[0]=='__notfound__':
+			return
+		
+		# check if truly un-named
+		f2 = sql("select name, fieldname, label from tabDocField where idx=%s and parent=%s limit 1", (f1[1]+1, doctype))
+		
+		if not f2:
+			return
+		f2 = f2[0]
+		
+		if f2[1] or f2[2]:
+			return
+		else:
+			sql("delete from tabDocField where name=%s limit 1", (f2[0]))
+
+			# move fields up
+			sql("update tabDocField set idx=idx-1 where idx>%s and parent=%s", (f1[1], doctype))
+		
+	def add_permission(self, doctype, role, level=0, read=0, write=0, create=0, submit=0, cancel=0, amend=0, match=''): 
+		# check if exists
+		pid = sql("select name from tabDocPerm where parent=%s and role=%s and permlevel=%s", (doctype, role, level))
+		if pid:
+			d = Document('DocPerm', pid[0][0])
+		else:
+			d = Document('DocPerm')
+			d.parent = doctype
+			d.parenttype = 'DocType'
+			d.parentfield = 'permissions'
+		
+		d.role = role
+		d.read = read
+		d.write = write
+		d.create = create
+		d.submit = submit
+		d.cancel = cancel
+		d.amend = amend
+		d.match = match
+		
+		d.save(new = (not d.name and 1 or 0))
+
+	def delete_permission(self, doctype, role, level):
+		sql("delete from `tabDocPerm` where role = '%s' and parent = '%s' and permlevel = '%s'" % (role, doctype, level))
diff --git a/application_internal/doctype/patch_util/patch_util.txt b/application_internal/doctype/patch_util/patch_util.txt
new file mode 100644
index 0000000..261b1ea
--- /dev/null
+++ b/application_internal/doctype/patch_util/patch_util.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-15 09:56:48', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Patch Util', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-12-24 13:28:08', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/payroll_tips_common/__init__.py b/application_internal/doctype/payroll_tips_common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/payroll_tips_common/__init__.py
diff --git a/application_internal/doctype/payroll_tips_common/payroll_tips_common.js b/application_internal/doctype/payroll_tips_common/payroll_tips_common.js
new file mode 100644
index 0000000..af393dd
--- /dev/null
+++ b/application_internal/doctype/payroll_tips_common/payroll_tips_common.js
@@ -0,0 +1,78 @@
+// Global dictionary of next steps for doctypes
+// ============================================
+pscript.payroll_tip_dict = {'Employee':['Payroll Rule', 'Salary Structure'], 'Salary Structure':['IT Checklist', 'Salary Slip']};
+
+// Set tips depending on conditions
+// ================================
+cur_frm.cscript.get_tips = function(doc, cdt, cdn)
+{
+  
+  var next_step_list = pscript.payroll_tip_dict[cur_frm.doctype];
+  
+  // from is shown in print format
+  if(!cur_frm.editable){
+    cur_frm.set_tip("Click on the <div style='font-weight:bold; display:inline'>Edit</div> button above to edit this " + cur_frm.doctype + ".");
+  }
+  
+  // form is not in print format
+  if(cur_frm.editable){
+    // new doc
+    if(doc.__islocal){
+      if(doc.status=='Cancelled' || doc.amended_from)
+        cur_frm.set_tip("You can now make changes in this " + cur_frm.doctype + " and save it by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+      
+      // doc is completely new
+      else{
+        // For Salary Slip
+        if(cur_frm.doctype=='Salary Slip'){
+          cur_frm.set_tip("To create " + cur_frm.doctype + " please enter all the details and save it by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+          cur_frm.append_tip("To calculate earnings and deductions click on <div style='font-weight:bold; display:inline'>Process Payroll</div> button after saving the form");
+        }
+        // For IT Checklist
+        else if(cur_frm.doctype=='IT Checklist'){
+          cur_frm.set_tip("To create " + cur_frm.doctype + " please enter all the details and click on <div style='font-weight:bold; display:inline'>Done</div> button below to fetch all the details in the remaining tabs.");
+          cur_frm.append_tip("To calculate taxes, please enter the actual amount in all the tables in the remaining tabs and click on <div style='font-weight:bold; display:inline'>Calculate</div> button in the <div style='font-weight:bold; display:inline'>Total Taxable Income</div> tab.");
+        }
+        // For Others
+        else
+          cur_frm.set_tip("To create " + cur_frm.doctype + " please start by entering all the mandatory fields(marked <div style='color:Red; display:inline'> Red</div>).<br><br> You can then save this form by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+      }  
+    }
+    
+    // doc exists
+    else if(!doc.__islocal){
+      // execute when doc is saved
+      if(doc.docstatus==0 && cur_frm.doctype=='Salary Slip'){
+        cur_frm.set_tip("You have saved your " + cur_frm.doctype + ". To calculate earnings and deductions click on <div style='font-weight:bold; display:inline'>Process Payroll</div> button below.");
+        cur_frm.append_tip("You can make this draft permanent by clicking on <div style='font-weight:bold; display:inline'>Submit</div> button above.")
+      }
+      
+      // execute if doc is submitted
+      else if(doc.docstatus==1 && cur_frm.doctype=='Salary Slip'){
+        cur_frm.set_tip("You have submitted this " + cur_frm.doctype + ".");
+        cur_frm.append_tip("(To make changes in this "+ cur_frm.doctype + " click on the <div style='font-weight:bold; display:inline'>Cancel</div> button above.)");
+      }
+     
+      // execute if doc has only save permission
+      else if(doc.docstatus==0 && (cur_frm.doctype=='IT Checklist' || cur_frm.doctype=='Salary Structure' || cur_frm.doctype=='Employee')){
+        cur_frm.set_tip("You have saved this " + cur_frm.doctype + ".");
+               
+        for(var i=0; i<next_step_list.length; i++){
+          if(i==0)  cur_frm.append_tip("To proceed select the Next Steps tab below and click the button to create  " + next_step_list[i] +".");
+          else  cur_frm.append_tip("You can also create a " + next_step_list[i] + " for this " + cur_frm.doctype + ".");
+        }
+      }
+      
+      // execute when doc is amended
+      else if(doc.docstatus==2){
+        cur_frm.set_tip("To make this " + cur_frm.doctype + " editable click on the <div style='font-weight:bold; display:inline'>Amend</div> button above.");
+      }
+    }
+  }
+}
+
+// Executes when doc is edit status of doc is changed
+// ==================================================
+cur_frm.cscript.edit_status_changed = function(doc, cdt, cdn){
+  cur_frm.cscript.get_tips();
+}
\ No newline at end of file
diff --git a/application_internal/doctype/payroll_tips_common/payroll_tips_common.txt b/application_internal/doctype/payroll_tips_common/payroll_tips_common.txt
new file mode 100644
index 0000000..13a8725
--- /dev/null
+++ b/application_internal/doctype/payroll_tips_common/payroll_tips_common.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-28 14:31:18', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Payroll Tips Common', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-03 10:13:58', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/production_tips_common/__init__.py b/application_internal/doctype/production_tips_common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/production_tips_common/__init__.py
diff --git a/application_internal/doctype/production_tips_common/production_tips_common.js b/application_internal/doctype/production_tips_common/production_tips_common.js
new file mode 100644
index 0000000..76ca1ee
--- /dev/null
+++ b/application_internal/doctype/production_tips_common/production_tips_common.js
@@ -0,0 +1,71 @@
+// Global dictionary of next steps for doctypes
+// ============================================
+pscript.tip_prod_dict = {'Production Order':['Material Transfer', 'Backflush']};
+
+
+// Set tips depending on conditions
+// ================================
+cur_frm.cscript.get_tips = function(doc, cdt, cdn){
+  var next_step_list = pscript.tip_prod_dict[cur_frm.doctype] ? pscript.tip_prod_dict[cur_frm.doctype] : 0;
+  
+  if(cur_frm.doctype!='Production Planning Tool'){
+    // new doc
+    if(doc.__islocal){
+      if(doc.status=='Cancelled' || doc.amended_from)
+        cur_frm.set_tip("You can now make changes in this " + cur_frm.doctype + " and save it by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+      else{ 
+        cur_frm.set_tip("To create " + cur_frm.doctype + " please start by entering all the mandatory fields (marked <div style='color:Red; display:inline'> Red</div>).");
+        if(cur_frm.doctype=='Stock Entry') cur_frm.append_tip("If your purpose is Production Order, please go to <div style='font-weight:bold; display:inline'>Items</div> tab and click <div style='font-weight:bold; display:inline'>Get Items</div> to fetch the items.");
+        cur_frm.append_tip("You can then save this form by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+      }
+    }
+    
+    // doc exists
+    else if(!doc.__islocal){
+      // execute when doc is saved
+      if(doc.docstatus==0 && cur_frm.doctype!='Production Planning Tool')
+        cur_frm.set_tip("You have saved your " + cur_frm.doctype + ". You can make this draft permanent by clicking on <div style='font-weight:bold; display:inline'>Submit</div> button above.");
+        
+      // execute if doc is submitted
+      else if(doc.docstatus==1){
+        cur_frm.set_tip("You have submitted this " + cur_frm.doctype + ".");
+        for(var i=0; i<next_step_list.length; i++){
+          if(i==0)  cur_frm.append_tip("To proceed select the <div style='font-weight:bold; display:inline'>Next Steps</div> tab below. To transfer raw materials to Finished Goods Warehouse click on <div style='font-weight:bold; display:inline'>" + next_step_list[i] +"</div>.");
+          else  cur_frm.append_tip("To update the quantity of finished goods and raw materials in their respective warehouses click on <div style='font-weight:bold; display:inline'>" + next_step_list[i] + "</div>.");
+        }
+        cur_frm.append_tip("(To amend this "+ cur_frm.doctype + " click on the <div style='font-weight:bold; display:inline'>Cancel</div> button above.)");
+      }
+      
+      // execute when doc is amended
+      else if(doc.docstatus==2){
+        cur_frm.set_tip("To make this " + cur_frm.doctype + " editable click on the <div style='font-weight:bold; display:inline'>Amend</div> button above.");
+      }
+    }
+  }
+}
+  
+
+// Execute if current doctype is Production Planning Tool
+// ======================================================
+cur_frm.cscript.get_PPT_tips = function(doc, cdt, cdn)
+{
+  cur_frm.set_tip('Welcome to Production Planning Wizard. This helps you to raise production order and see your raw material status as you plan your production.');
+  cur_frm.append_tip("To start fetch all open Production Orders and Sales Orders by clicking on the <div style='font-weight:bold; display:inline'>Get Open Documents</div> button in the <div style='font-weight:bold; display:inline'>Against Document</div> tab below");
+  
+  cur_frm.cscript['Get Open Documents'] = function(doc, cdt, cdn){
+    cur_frm.set_tip("To include the required orders in the Production Plan check mark the <div style='font-weight:bold; display:inline'>Include In Plan</div> cell below.");
+    cur_frm.append_tip("Next you can go to the <div style='font-weight:bold; display:inline'>Items</div> tab and click on <div style='font-weight:bold; display:inline'>Get Items</div> button to fetch the items of the selected orders.");
+  }
+  
+  cur_frm.cscript['Get Items'] = function(doc, cdt, cdn){
+    cur_frm.set_tip("Now to raise a Production Order just click on <div style='font-weight:bold; display:inline'>Raise Production Ordre</div> button below the table.");
+    cur_frm.append_tip("In order to see the Raw Material Report click on <div style='font-weight:bold; display:inline'>Get Raw Material Report</div> button below the table.");
+  }
+}
+
+
+// Executes when doc is edit status of doc is changed
+// ==================================================
+cur_frm.cscript.edit_status_changed = function(doc, cdt, cdn){
+  cur_frm.cscript.get_tips();
+}
\ No newline at end of file
diff --git a/application_internal/doctype/production_tips_common/production_tips_common.txt b/application_internal/doctype/production_tips_common/production_tips_common.txt
new file mode 100644
index 0000000..cb9db2c
--- /dev/null
+++ b/application_internal/doctype/production_tips_common/production_tips_common.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-31 11:03:13', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 37, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Production Tips Common', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/profile_control/__init__.py b/application_internal/doctype/profile_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/profile_control/__init__.py
diff --git a/application_internal/doctype/profile_control/profile_control.py b/application_internal/doctype/profile_control/profile_control.py
new file mode 100644
index 0000000..189d8b1
--- /dev/null
+++ b/application_internal/doctype/profile_control/profile_control.py
@@ -0,0 +1,187 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+    self.last_profile = None
+  
+  # Sync Profile with Gateway
+  # -------------------------
+  def sync_with_gateway(self,pid):
+    p = Document('Profile',pid)
+
+    # login to gateway
+    from webnotes.utils.webservice import FrameworkServer
+    fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
+
+    account_id = sql("select value from tabSingles where doctype='Control Panel' and field='account_id'")[0][0]
+    
+    # call add profile
+    ret = fw.runserverobj('Profile Control','Profile Control','add_profile_gateway',str([p.first_name, p.middle_name, p.last_name, p.email, p.name, account_id]))
+    
+    if ret.get('exc'):
+      msgprint(ret['exc'])
+      raise Exception
+  
+  def get_role_permission(self,role):
+    perm = sql("select distinct t1.`parent`, t1.`read`, t1.`write`, t1.`create`, t1.`submit`,t1.`cancel`,t1.`amend` from `tabDocPerm` t1, `tabDocType` t2 where t1.`role` ='%s' and t1.docstatus !=2 and t1.permlevel = 0 and t1.`read` = 1 and t2.module != 'Recycle Bin' and t1.parent=t2.name "%role)
+    return perm or ''
+  
+  
+  # Check if password is expired
+  # --------------------------------
+  def has_pwd_expired(self):
+    if session['user'] != 'Administrator' and session['user'].lower() != 'demo':
+      last_pwd_date = None
+      try:
+        last_pwd_date = sql("select password_last_updated from tabProfile where name=%s",session['user'])[0][0] or ''
+      except:
+        return 'No'
+      if cstr(last_pwd_date) == '':
+        sql("update tabProfile set password_last_updated = '%s' where name='%s'"% (nowdate(),session['user']))
+        return 'No'
+      else:
+        date_diff = (getdate(nowdate()) - last_pwd_date).days
+        expiry_period = sql("select value from tabSingles where doctype='Control Panel' and field='password_expiry_days'")
+        if expiry_period and cint(expiry_period[0][0]) and cint(expiry_period[0][0]) < date_diff:
+          return 'Yes'
+        return 'No'
+              
+  def reset_password(self,pwd):
+    if sql("select name from tabProfile where password=PASSWORD(%s) and name=%s", (pwd,session['user'])):
+      return 'Password cannot be same as old password'
+    sql("update tabProfile set password=PASSWORD(%s),password_last_updated=%s where name = %s", (pwd,nowdate(),session['user']))
+    return 'ok'
+  
+#-------------------------------------------------------------------------------------------------------
+  #functions for manage user page
+  #-----------Enable/Disable Profile-----------------------------------------------------------------------------------------------    
+  def change_login(self,args):
+    args = eval(args)
+    
+    if cint(args['set_disabled'])==0:
+      sql("update `tabProfile` set enabled=1 where name='%s'"%args['user'])
+    else:
+      sql("update `tabProfile` set enabled=0 where name='%s'"%args['user'])
+    
+    return 'ok'
+
+#------------return role list -------------------------------------------------------------------------------------------------
+  # All roles of Role Master
+  def get_role(self):
+    r_list=sql("select name from `tabRole` where name not in ('Administrator','All','Guest')")
+    if r_list[0][0]:
+      r_list = [x[0] for x in r_list]
+    return r_list
+    
+  # Only user specific role
+  def get_user_role(self,usr):
+    r_list=sql("select role from `tabUserRole` where parent=%s and role not in ('Administrator','All','Guest')",usr)
+    if r_list[0][0]:
+      r_list = [x[0] for x in r_list]
+    else:
+      r_list=[]
+    return r_list
+  
+  # adding new role
+  def add_user_role(self,args):
+    arg=eval(args)
+    sql("delete from `tabUserRole` where parenttype='Profile' and parent ='%s'" % (cstr(arg['user'])))
+    role_list = arg['role_list'].split(',')
+    for r in role_list:
+      pr=Document('UserRole')
+      pr.parent = arg['user']
+      pr.parenttype = 'Profile'
+      pr.role = r
+      pr.parentfield = 'userroles'
+      pr.save(1)
+      
+
+
+  # Add new member
+  # ---------------
+  def add_profile(self,arg):
+    
+    # Check credit balance
+    get_obj('WN ERP Client Control').check_credit_balance()
+    
+    arg=eval(arg)
+    pr=Document('Profile')
+    for d in arg.keys():
+      if d!='role':
+        pr.fields[d] = arg[d]
+   
+    pr.enabled=0
+    pr.user_type='System User'
+    pr.save(1)
+    pr_obj = get_obj('Profile',pr.name)
+    if (pr.name):
+      msg="New member is added"
+      pr_obj.on_update()
+    else:
+      msg="Profile not created"
+    
+    return cstr(msg)
+
+  # to find currently login user 
+  def current_login(self):
+    cl_list=sql("select distinct user from tabSessions")
+    if cl_list:
+      cl_list=[x[0] for x in cl_list]
+    
+    return cl_list
+
+
+  # Remove Profile
+  # ---------------
+  def remove_profile(self, user):
+    # delete profile
+    webnotes.model.delete_doc('Profile',user)
+    
+    # Update WN ERP Client Control
+    sql("update tabSingles set value = value - 1 where field = 'total_users' and doctype = 'WN ERP Client Control'")
+
+    # login to gateway
+    from webnotes.utils.webservice import FrameworkServer
+    fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
+
+    account_id = sql("select value from tabSingles where doctype='Control Panel' and field='account_id'")[0][0]
+
+    # call remove profile
+    ret = fw.runserverobj('Profile Control','Profile Control','remove_app_sub',str([user, account_id, session['user']]))
+    
+    if ret.get('exc'):
+      msgprint(ret['exc'])
+      raise Exception
+
+    return "User Removed Successfully"
+
+
+  # Create Profile
+  # ---------------
+  def create_profile(self, email):
+    if sql("select name from tabProfile where name = %s", email):
+      sql("update tabProfile set docstatus = 0 where name = %s", email)
+    else:
+      pr = Document('Profile')
+      pr.email = email
+      pr.enabled=0
+      pr.user_type='System User'
+      pr.save(1)
diff --git a/application_internal/doctype/profile_control/profile_control.txt b/application_internal/doctype/profile_control/profile_control.txt
new file mode 100644
index 0000000..9a3e409
--- /dev/null
+++ b/application_internal/doctype/profile_control/profile_control.txt
@@ -0,0 +1,55 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2009-05-29 12:19:21',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-11-03 11:03:11',
+		'modified_by': 'Administrator',
+		'module': 'Application Internal',
+		'name': 'Profile Control',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': '<pre style="text-align: left;"></pre>',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 12
+	}
+]
\ No newline at end of file
diff --git a/application_internal/doctype/report_field_detail/__init__.py b/application_internal/doctype/report_field_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/report_field_detail/__init__.py
diff --git a/application_internal/doctype/report_field_detail/report_field_detail.txt b/application_internal/doctype/report_field_detail/report_field_detail.txt
new file mode 100644
index 0000000..8eb40a1
--- /dev/null
+++ b/application_internal/doctype/report_field_detail/report_field_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-29 15:22:09', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'FDD/.########', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Report Field Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-29 15:22:09', 'doctype': 'DocField', 'oldfieldname': 'field_label_fd', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Label', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Report Field Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02245', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:45', 'parenttype': 'DocType', 'fieldname': 'field_label_fd', 'fieldtype': 'Link', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:22:09', 'doctype': 'DocField', 'oldfieldname': 'field_type_fd', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Field Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02246', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:45', 'parenttype': 'DocType', 'fieldname': 'field_type_fd', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-05-29 15:22:09', 'doctype': 'DocField', 'oldfieldname': 'options_fd', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Options', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Field Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02247', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:45', 'parenttype': 'DocType', 'fieldname': 'options_fd', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:22:09', 'doctype': 'DocField', 'oldfieldname': 'table_name_fd', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Table Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Field Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02248', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:45', 'parenttype': 'DocType', 'fieldname': 'table_name_fd', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:22:09', 'doctype': 'DocField', 'oldfieldname': 'field_name_fd', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Field Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02249', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:45', 'parenttype': 'DocType', 'fieldname': 'field_name_fd', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:22:09', 'doctype': 'DocField', 'oldfieldname': 'field_width_fd', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Width', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Report Field Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02250', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-03-31 10:11:45', 'parenttype': 'DocType', 'fieldname': 'field_width_fd', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/report_filter_detail/__init__.py b/application_internal/doctype/report_filter_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/report_filter_detail/__init__.py
diff --git a/application_internal/doctype/report_filter_detail/report_filter_detail.txt b/application_internal/doctype/report_filter_detail/report_filter_detail.txt
new file mode 100644
index 0000000..5732d3d
--- /dev/null
+++ b/application_internal/doctype/report_filter_detail/report_filter_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-29 15:19:57', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'FRD/.########', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Report Filter Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-29 15:19:57', 'doctype': 'DocField', 'oldfieldname': 'field_label_fr', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Label', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Report Filter Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02240', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:12:06', 'parenttype': 'DocType', 'fieldname': 'field_label_fr', 'fieldtype': 'Link', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:19:57', 'doctype': 'DocField', 'oldfieldname': 'field_type_fr', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Filter Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02241', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:12:06', 'parenttype': 'DocType', 'fieldname': 'field_type_fr', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-05-29 15:19:57', 'doctype': 'DocField', 'oldfieldname': 'options_fr', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Options', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Filter Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02242', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:12:06', 'parenttype': 'DocType', 'fieldname': 'options_fr', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:19:57', 'doctype': 'DocField', 'oldfieldname': 'table_name_fr', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Table Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Filter Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02243', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 10:12:06', 'parenttype': 'DocType', 'fieldname': 'table_name_fr', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-29 15:19:57', 'doctype': 'DocField', 'oldfieldname': 'field_name_fr', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Report Filter Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02244', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-03-31 10:12:06', 'parenttype': 'DocType', 'fieldname': 'field_name_fr', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/sms_center/__init__.py b/application_internal/doctype/sms_center/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/sms_center/__init__.py
diff --git a/application_internal/doctype/sms_center/sms_center.js b/application_internal/doctype/sms_center/sms_center.js
new file mode 100644
index 0000000..abc52cf
--- /dev/null
+++ b/application_internal/doctype/sms_center/sms_center.js
@@ -0,0 +1,8 @@
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  if(doc.send_to == 'Customer Group')
+    unhide_field('customer_group_name');
+  else
+    hide_field('customer_group_name');
+}
+
+cur_frm.cscript.send_to = cur_frm.cscript.refresh;
\ No newline at end of file
diff --git a/application_internal/doctype/sms_center/sms_center.py b/application_internal/doctype/sms_center/sms_center.py
new file mode 100644
index 0000000..552e26d
--- /dev/null
+++ b/application_internal/doctype/sms_center/sms_center.py
@@ -0,0 +1,59 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+      
+  def create_receiver_table(self):
+    if self.doc.send_to:
+      self.doc.clear_table(self.doclist, 'receiver_details')
+      rec = ''
+      if self.doc.send_to == 'All Customer':
+        rec = sql("select customer_name, CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(customer_name,'') !='' and ifnull(mobile_no,'')!=''")
+
+      elif self.doc.send_to == 'Customer Group' and self.doc.customer_group_name:
+       
+        rec = sql("select t2.customer_name, CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), t1.mobile_no from `tabContact` t1, `tabCustomer` t2 where t2.name = t1.customer_name and ifnull(t1.mobile_no,'')!='' and t2.customer_group = '%s'"%self.doc.customer_group_name)
+      if not rec:
+        msgprint("Either customer having no contact or customer's contact does not have mobile no")
+        raise Exception 
+
+      for d in rec:
+        ch = addchild(self.doc, 'receiver_details', 'Receiver Detail', 1, self.doclist)
+        ch.customer_name = d[0]
+        ch.receiver_name = d[1]
+        ch.mobile_no = d[2]
+    else:
+      msgprint("Please select 'Send To' field")
+        
+        
+  def send_sms(self):
+    if not self.doc.message:
+      msgprint("Please type the message before sending")
+    elif not getlist(self.doclist, 'receiver_details'):
+      msgprint("Receiver Table is blank.")
+    else:
+      receiver_list = []
+      for d in getlist(self.doclist, 'receiver_details'):
+        if d.mobile_no:
+          receiver_list.append(d.mobile_no)
+      if receiver_list:
+        msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.message))
\ No newline at end of file
diff --git a/application_internal/doctype/sms_center/sms_center.txt b/application_internal/doctype/sms_center/sms_center.txt
new file mode 100644
index 0000000..20ecbda
--- /dev/null
+++ b/application_internal/doctype/sms_center/sms_center.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 16:21:14', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': 0, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 20, 'menu_index': 4, 'docstatus': 0, 'allow_copy': 0, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'SMS Center', 'idx': None, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00225', 'parent': 'SMS Center', 'read': 1, 'create': 1, 'creation': '2009-03-12 16:56:43', 'modified': '2010-08-08 15:03:13', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00226', 'parent': 'SMS Center', 'read': 1, 'create': 0, 'creation': '2009-03-12 16:56:43', 'modified': '2010-08-08 15:03:13', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01352', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Send To', 'width': '', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01349', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': 'send_to', 'fieldtype': 'Select', 'options': '\nAll Customer\nCustomer Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Customer Group Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01351', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': 'customer_group_name', 'fieldtype': 'Select', 'options': 'link:Customer Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Message greater than 160 character will be splitted into multiple mesage', 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01346', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': 'message', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01353', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Create Receiver Table', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01350', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'create_receiver_table', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:23:49', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Send SMS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01354', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'send_sms', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01348', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 17:16:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Receiver Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Center', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01347', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-08 15:03:13', 'parenttype': 'DocType', 'fieldname': 'receiver_details', 'fieldtype': 'Table', 'options': 'Receiver Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/sso_control/__init__.py b/application_internal/doctype/sso_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/sso_control/__init__.py
diff --git a/application_internal/doctype/sso_control/sso_control.py b/application_internal/doctype/sso_control/sso_control.py
new file mode 100644
index 0000000..bfc0e43
--- /dev/null
+++ b/application_internal/doctype/sso_control/sso_control.py
@@ -0,0 +1,30 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def logout_sso(self):
+    import webnotes
+    import webnotes.utils.webservice
+
+    if session['data'].get('login_from'):
+      sso = webnotes.utils.webservice.FrameworkServer(session['data'].get('login_from'), '/', '__system@webnotestech.com', 'password')
+      sso.runserverobj('SSO Control', 'SSO Control', 'logout_user', session['user'])
\ No newline at end of file
diff --git a/application_internal/doctype/sso_control/sso_control.txt b/application_internal/doctype/sso_control/sso_control.txt
new file mode 100644
index 0000000..79c1bf4
--- /dev/null
+++ b/application_internal/doctype/sso_control/sso_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-07 12:13:03', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'SSO Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/tips_common/__init__.py b/application_internal/doctype/tips_common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/tips_common/__init__.py
diff --git a/application_internal/doctype/tips_common/tips_common.js b/application_internal/doctype/tips_common/tips_common.js
new file mode 100644
index 0000000..bf9956c
--- /dev/null
+++ b/application_internal/doctype/tips_common/tips_common.js
@@ -0,0 +1,87 @@
+// Global dictionary of next steps for doctypes
+// ============================================
+pscript.tip_doc_dict = {'Quotation':['Sales Order'], 'Sales Order':['Delivery Note', 'Sales Invoice'], 'Delivery Note':['Sales Invoice'], 'Receivable Voucher':['Bank Voucher'], 'Indent':['Purchase Order'], 'Purchase Order':['Purchase Invoice'], 'Payable Voucher':['Bank Voucher'], 'Purchase Receipt':['Purchase Invoice'], 'Enquiry':['Quotation'], 'Lead':['Enquiry', 'Customer']};
+
+pscript.master_doctype_lst =['Authorization Rule','Bank','Batch','Branch','Brand','Business Letter','Business Letter Template','Business Letter Type','Campaign','City','Company','Contact','Cost Center','Country','Customer','Customer Group','Deduction Type','Department','Designation','Earning Type','Employee','Employment Type','Expense Type','File Group','Fiscal Year','Grade','Holiday List','Industry Type','Item','Item Group','KRA Template','Landed Cost Master','Lead','Leave Type', 'Manage Account', 'Mode of Payment','Order Lost Reason','Other Charges','Period','Price List','Print Heading','Project','Purchase Other Charges','Purpose of Service','Sales BOM','Sales Partner','Sales Person','Serial No','State','Supplier','Supplier Type','TDS Category','Term','Territory','Ticket Category','UOM','Warehouse','Warehouse Type','Workflow Rule','Workstation'];
+
+// Set tips depending on conditions
+// ================================
+cur_frm.cscript.get_tips = function(doc, cdt, cdn){
+  
+  var next_step_list = pscript.tip_doc_dict[cur_frm.doctype];
+  // from is shown in print format
+  
+  
+  if(!cur_frm.editable && cur_frm.doctype!='Enquiry' && pscript.master_doctype_lst.join().indexOf(cur_frm.doctype)<0){
+    cur_frm.set_tip("Click on the <div style='font-weight:bold; display:inline'>Edit</div> button above to edit this " + get_doctype_label(cur_frm.doctype) + ".");
+  }
+  
+  
+  // form is not in print format
+  if(cur_frm.editable){
+    // new doc
+    if(pscript.master_doctype_lst.join().indexOf(cur_frm.doctype)>=0){
+      if(doc.__islocal)
+        cur_frm.set_tip("To create " + get_doctype_label(cur_frm.doctype) + " please start by entering all the mandatory fields (marked <div style='color:Red; display:inline'> Red</div>).<br><br> You can then save this form by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+      else
+        cur_frm.set_tip("You have saved this " + get_doctype_label(cur_frm.doctype) + ".");
+    }
+    else {
+      if(doc.__islocal){
+        if(doc.status=='Cancelled' || doc.amended_from)
+          cur_frm.set_tip("You can now make changes in this " + get_doctype_label(cur_frm.doctype) + " and save it by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+        else 
+          cur_frm.set_tip("To create " + get_doctype_label(cur_frm.doctype) + " please start by entering all the mandatory fields (marked <div style='color:Red; display:inline'> Red</div>).<br><br> You can then save this form by clicking on the <div style='font-weight:bold; display:inline'>Save</div> button in the above toolbar.");
+      }
+      
+      // doc exists
+      else if(!doc.__islocal){
+        // execute when doc is saved
+        //if(doc.docstatus==0 && cur_frm.doctype!='Enquiry' && cur_frm.doctype!='Lead')
+        if(doc.docstatus==0 && cur_frm.doctype!='Lead')
+          cur_frm.set_tip("You have saved your " + get_doctype_label(cur_frm.doctype) + ". You can make this draft permanent by clicking on <div style='font-weight:bold; display:inline'>Submit</div> button above.");
+          
+        // execute if doc has only save permission
+        //else if(doc.docstatus==0 && (cur_frm.doctype=='Enquiry' || cur_frm.doctype=='Lead')){
+        else if(doc.docstatus==0 && (cur_frm.doctype=='Lead')){
+          cur_frm.set_tip("You have saved this " + get_doctype_label(cur_frm.doctype) + ".");
+          for(var i=0; i<next_step_list.length; i++){
+            if(i==0)  cur_frm.append_tip("To proceed select the <div style='font-weight:bold; display:inline'>Next Steps</div> tab below and click the button to create a " + next_step_list[i] +".");
+            else  cur_frm.append_tip("You can also create a " + next_step_list[i] + " against this " + get_doctype_label(cur_frm.doctype) + ".");
+          }
+        }
+        // execute if doc is submitted
+        else if(doc.docstatus==1){
+          cur_frm.set_tip("You have submitted this " + get_doctype_label(cur_frm.doctype) + ".");
+          for(var i=0; i<next_step_list.length; i++){
+            if(i==0)  cur_frm.append_tip("To proceed select the Next Steps tab below and click the button to create a " + next_step_list[i] +".");
+            else  cur_frm.append_tip("You can also create a " + next_step_list[i] + " against this " + get_doctype_label(cur_frm.doctype) + ".");
+          }
+          cur_frm.append_tip("(To amend this "+ get_doctype_label(cur_frm.doctype) + " click on the <div style='font-weight:bold; display:inline'>Cancel</div> button above.)");
+        }
+        
+        // execute when doc is amended
+        else if(doc.docstatus==2){
+          cur_frm.set_tip("To make this " + get_doctype_label(cur_frm.doctype) + " editable click on the <div style='font-weight:bold; display:inline'>Amend</div> button above.");
+        }
+      }
+    }
+  }
+}
+
+// Executes when doc is edit status of doc is changed
+// ==================================================
+cur_frm.cscript.edit_status_changed = function(doc, cdt, cdn){
+  cur_frm.cscript.get_tips();
+}
+
+
+// Executes when module page is loaded
+pscript.show_module_stats = function(parent, module)
+{
+  this.parent = parent;
+  this.module = module;
+  alert(profile.can_read)
+  //msgprint(parent, 1);
+  msgprint(module, 1);
+}
\ No newline at end of file
diff --git a/application_internal/doctype/tips_common/tips_common.txt b/application_internal/doctype/tips_common/tips_common.txt
new file mode 100644
index 0000000..a97073b
--- /dev/null
+++ b/application_internal/doctype/tips_common/tips_common.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-28 10:32:20', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 53, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': '', 'name': 'Tips Common', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/transfer_account/__init__.py b/application_internal/doctype/transfer_account/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/transfer_account/__init__.py
diff --git a/application_internal/doctype/transfer_account/transfer_account.txt b/application_internal/doctype/transfer_account/transfer_account.txt
new file mode 100644
index 0000000..3b14113
--- /dev/null
+++ b/application_internal/doctype/transfer_account/transfer_account.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-04-29 15:01:32', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Transfer Account', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-22 12:42:01', 'doctype': 'DocField', 'oldfieldname': 'app_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'App Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Transfer Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05678', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 14:46:57', 'parenttype': 'DocType', 'fieldname': 'app_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-04-29 15:01:32', 'doctype': 'DocField', 'oldfieldname': 'server', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Server', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Transfer Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01936', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 14:46:57', 'parenttype': 'DocType', 'fieldname': 'server', 'fieldtype': 'Select', 'options': '67.205.111.118\n72.55.168.105\n173.201.16.242\nwww.kfcommunity.com\n67.205.74.201\nwww.webnotesframework.org\ns2.iwebnotes.com\ns4.iwebnotes.com\nold.iwebnotes.com', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-04-29 15:01:32', 'doctype': 'DocField', 'oldfieldname': 'path', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Path', 'width': '50px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Transfer Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01937', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 14:46:57', 'parenttype': 'DocType', 'fieldname': 'path', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-04-29 15:01:32', 'doctype': 'DocField', 'oldfieldname': 'account', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Account', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Transfer Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01938', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-08 14:46:57', 'parenttype': 'DocType', 'fieldname': 'account', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Password', 'creation': '2009-04-29 15:01:32', 'doctype': 'DocField', 'oldfieldname': 'admin_password', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Admin Password', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Transfer Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01939', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-08 14:46:57', 'parenttype': 'DocType', 'fieldname': 'admin_password', 'fieldtype': 'Password', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-04-29 15:01:32', 'doctype': 'DocField', 'oldfieldname': 'transfer', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Transfer', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Transfer Account', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01940', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-08 14:46:57', 'parenttype': 'DocType', 'fieldname': 'transfer', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/transfer_control/__init__.py b/application_internal/doctype/transfer_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/transfer_control/__init__.py
diff --git a/application_internal/doctype/transfer_control/transfer_control.js b/application_internal/doctype/transfer_control/transfer_control.js
new file mode 100644
index 0000000..29b6c33
--- /dev/null
+++ b/application_internal/doctype/transfer_control/transfer_control.js
@@ -0,0 +1,140 @@
+# Note:
+# You must add the DocType to the override_transfer dict, else it will replace everything
+# ---------------------------------------------------------------------------------------
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc, self.doclist = doc, doclist
+    
+    # Over-ride function dict
+    # -----------------------
+    
+    self.override_transfer = {
+      'DocType':'ovr_doctype',
+      'DocType Mapper':'ovr_mapper'
+    }
+
+  def ovr_doctype(self, doclist, ovr, ignore, onupdate):
+    doclist = [Document(fielddata = d) for d in doclist]
+    doc = doclist[0]
+    orig_modified = doc.modified
+    cur_doc = Document('DocType',doc.name)
+    added = 0
+    prevfield = ''
+    prevlabel = ''
+    idx = 0
+        
+    # fields
+    # ------
+    for d in getlist(doclist, 'fields'):
+      fld = ''
+      # if exists
+      if d.fieldname:
+        fld = sql("select name from tabDocField where fieldname=%s and parent=%s", (d.fieldname, d.parent))
+      elif d.label: # for buttons where there is no fieldname
+        fld = sql("select name from tabDocField where label=%s and parent=%s", (d.label, d.parent))
+  
+      if (not fld) and d.label: # must have label
+        if prevfield:
+          idx = sql("select idx from tabDocField where fieldname = %s and parent = %s",(prevfield,d.parent))[0][0]
+        elif prevlabel and not prevfield:
+          idx = sql("select idx from tabDocField where label = %s and parent = %s",(prevlabel,d.parent))[0][0]
+        sql("update tabDocField set idx = idx + 1 where parent=%s and idx > %s", (d.parent, cint(idx)))          
+        
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.idx = cint(idx)+1
+        nd.save(new = 1, ignore_fields = ignore)
+        added += 1
+      if d.fieldname:
+        prevfield = d.fieldname
+        prevlabel = ''
+      elif d.label:
+        prevfield = ''
+        prevlabel = d.label
+        
+    # Print Formats
+    # ------
+    for d in getlist(doclist, 'formats'):
+      fld = ''
+      # if exists
+      if d.format:
+        fld = sql("select name from `tabDocFormat` where format=%s and parent=%s", (d.format, d.parent))
+            
+      if (not fld) and d.format: # must have label
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore)
+        added += 1
+          
+    # code
+    # ----
+    
+    cur_doc.server_code_core = cstr(doc.server_code_core)
+    cur_doc.client_script_core = cstr(doc.client_script_core)
+    
+    cur_doc.save(ignore_fields = ignore)
+
+    if onupdate:
+      so = get_obj('DocType', doc.name, with_children = 1)
+      if hasattr(so, 'on_update'):
+        so.on_update()
+    
+    set(doc,'modified',orig_modified)
+    
+    if in_transaction: sql("COMMIT")
+  
+    return doc.name + (' Upgraded: %s fields added' % added)
+    
+  
+  def ovr_mapper(self, doclist, ovr, ignore, onupdate):
+    doclist = [Document(fielddata = d) for d in doclist]
+    doc = doclist[0]
+    orig_modified = doc.modified
+    cur_doc = Document('DocType Mapper',doc.name)
+    added = 0
+        
+    # Field Mapper Details fields
+    # ------
+    for d in getlist(doclist, 'field_mapper_details'):
+      fld = ''
+      # if exists
+      if d.from_field and d.to_field:
+        fld = sql("select name from `tabField Mapper Detail` where from_field=%s and to_field=%s and parent=%s", (d.from_field, d.to_field, d.parent))
+            
+      if (not fld) and d.from_field and d.to_field: # must have label
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore)
+        added += 1
+        
+    # Table Mapper Details fields
+    # ------
+    for d in getlist(doclist, 'table_mapper_details'):
+      fld = ''
+      # if exists
+      if d.from_table and d.to_table: 
+        fld = sql("select name from `tabTable Mapper Detail` where from_table=%s and to_table = %s and parent=%s", (d.from_table, d.to_table, d.parent))
+            
+      if (not fld) and d.from_table and d.to_table: # must have label
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore)
+        added += 1
+             
+    cur_doc.save(ignore_fields = ignore)
+    
+    if onupdate:
+      so = get_obj('DocType Mapper', doc.name, with_children = 1)
+      if hasattr(so, 'on_update'):
+        so.on_update()
+    
+    set(doc,'modified',orig_modified)
+    
+    if in_transaction: sql("COMMIT")
+    
+    return doc.name + (' Upgraded: %s fields added' % added)
\ No newline at end of file
diff --git a/application_internal/doctype/transfer_control/transfer_control.py b/application_internal/doctype/transfer_control/transfer_control.py
new file mode 100644
index 0000000..3038354
--- /dev/null
+++ b/application_internal/doctype/transfer_control/transfer_control.py
@@ -0,0 +1,249 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+# Note:
+# You must add the DocType to the override_transfer dict, else it will replace everything
+# ---------------------------------------------------------------------------------------
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc, self.doclist = doc, doclist
+    
+    # Over-ride function dict
+    # -----------------------
+    
+    self.override_transfer = {
+      'DocType':'ovr_doctype',
+      'DocType Mapper':'ovr_mapper',
+      'TDS Rate Chart':'ovr_tds'
+    }
+
+  def ovr_doctype(self, doclist, ovr, ignore, onupdate):
+    doclist = [Document(fielddata = d) for d in doclist]
+    doc = doclist[0]
+    orig_modified = doc.modified
+    cur_doc = Document('DocType',doc.name)
+    added = 0
+    prevfield = ''
+    prevlabel = ''
+    idx = 0
+    fld_lst = ''
+        
+    # fields
+    # ------
+    for d in getlist(doclist, 'fields'):
+      fld = ''
+      # if exists
+      if d.fieldname:
+        fld = sql("select name from tabDocField where fieldname=%s and parent=%s", (d.fieldname, d.parent))
+      elif d.label: # for buttons where there is no fieldname
+        fld = sql("select name from tabDocField where label=%s and parent=%s", (d.label, d.parent))
+
+      if (not fld) and d.label: # must have label
+        if prevfield:
+          idx = sql("select idx from tabDocField where fieldname = %s and parent = %s",(prevfield,d.parent))[0][0]
+        elif prevlabel and not prevfield:
+          idx = sql("select idx from tabDocField where label = %s and parent = %s",(prevlabel,d.parent))[0][0]
+        sql("update tabDocField set idx = idx + 1 where parent=%s and idx > %s", (d.parent, cint(idx)))          
+
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.idx = cint(idx)+1
+        nd.save(new = 1, ignore_fields = ignore, check_links = 0)
+        fld_lst += "\n"+'Label : '+cstr(d.label)+'   ---   Fieldtype : '+cstr(d.fieldtype)+'   ---   Fieldname : '+cstr(d.fieldname)+'   ---   Options : '+cstr(d.options)
+        added += 1
+      if d.fieldname:
+        prevfield = d.fieldname
+        prevlabel = ''
+      elif d.label:
+        prevfield = ''
+        prevlabel = d.label
+        
+    # Print Formats
+    # ------
+    for d in getlist(doclist, 'formats'):
+      fld = ''
+      # if exists
+      if d.format:
+        fld = sql("select name from `tabDocFormat` where format=%s and parent=%s", (d.format, d.parent))
+            
+      if (not fld) and d.format: # must have label
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore, check_links = 0)
+        fld_lst = fld_lst + "\n"+'Format : '+cstr(d.format)
+        added += 1
+          
+    # code
+    # ----
+    
+    cur_doc.server_code_core = cstr(doc.server_code_core)
+    cur_doc.client_script_core = cstr(doc.client_script_core)
+    
+    cur_doc.save(ignore_fields = ignore, check_links = 0)
+
+    if version=='v160':
+      so = get_obj('DocType', doc.name, with_children = 1)
+      if hasattr(so, 'on_update'):
+        so.on_update()
+    elif version=='v170':
+      import webnotes.model.doctype
+      try: 
+        webnotes.model.doctype.update_doctype(so.doclist)
+      except: 
+        pass
+    
+    set(doc,'modified',orig_modified)
+    
+    if in_transaction: sql("COMMIT")
+    
+    if added == 0:
+      added_fields = ''
+    else:
+      added_fields =  ' <div style="color : RED">Added Fields :- '+ cstr(fld_lst)+ '</div>'
+      
+    return doc.name + (' Upgraded: %s fields added' % added)+added_fields
+    
+  
+  def ovr_mapper(self, doclist, ovr, ignore, onupdate):
+    doclist = [Document(fielddata = d) for d in doclist]
+    doc = doclist[0]
+    orig_modified = doc.modified
+    cur_doc = Document('DocType Mapper',doc.name)
+    added = 0
+    fld_lst = ''
+        
+    # Field Mapper Details fields
+    # ------
+    for d in getlist(doclist, 'field_mapper_details'):
+      fld = ''
+      # if exists
+      if d.from_field and d.to_field:
+        fld = sql("select name from `tabField Mapper Detail` where from_field=%s and to_field=%s and parent=%s", (d.from_field, d.to_field, d.parent))
+            
+      if (not fld) and d.from_field and d.to_field: # must have label
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore, check_links = 0)
+        fld_lst += "\n"+'From Field : '+cstr(d.from_field)+'   ---   To Field : '+cstr(d.to_field)
+        added += 1
+        
+    # Table Mapper Details fields
+    # ------
+    for d in getlist(doclist, 'table_mapper_details'):
+      fld = ''
+      # if exists
+      if d.from_table and d.to_table: 
+        fld = sql("select name from `tabTable Mapper Detail` where from_table=%s and to_table = %s and parent=%s", (d.from_table, d.to_table, d.parent))
+            
+      if (not fld) and d.from_table and d.to_table: # must have label
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore, check_links = 0)
+        fld_lst += "\n"+'From Table : '+cstr(d.from_table)+'   ---   To Table : '+cstr(d.to_table)
+        added += 1
+             
+    cur_doc.save(ignore_fields = ignore, check_links = 0)
+    
+    if onupdate:
+      so = get_obj('DocType Mapper', doc.name, with_children = 1)
+      if hasattr(so, 'on_update'):
+        so.on_update()
+    
+    set(doc,'modified',orig_modified)
+    
+    if in_transaction: sql("COMMIT")
+    
+    if added == 0:
+      added_fields = ''
+    else:
+      added_fields =  ' <div style="color : RED">Added Fields :- '+ cstr(fld_lst)+ '</div>' 
+    return doc.name + (' Upgraded: %s fields added' % added)+added_fields
+    
+    
+  def ovr_tds(self, doclist, ovr, ignore, onupdate):
+    doclist = [Document(fielddata = d) for d in doclist]
+    doc = doclist[0]
+    orig_modified = doc.modified
+    cur_doc = Document('TDS Rate Chart',doc.name)
+    added = 0
+    fld_lst = ''
+        
+    # TDS RATE CHART DETAIL fields
+    # ------
+    for d in getlist(doclist,'rate_chart_detail'):
+      fld = ''
+      # if exists
+      if d.category and d.slab_from and d.slab_to:
+        fld = sql("select name from `tabTDS Rate Detail` where category=%s and slab_from=%s and slab_to = %s and parent=%s", (d.category, d.slab_from, d.slab_to, d.parent))
+              
+      if (not fld) and d.category and d.slab_from and d.slab_to:
+        # add field
+        nd = Document(fielddata = d.fields)
+        nd.oldfieldname, nd.oldfieldtype = '', ''
+        nd.save(new = 1, ignore_fields = ignore, check_links = 0)
+        fld_lst += "\n"+'Category : '+cstr(d.category)+'   ---   Slab From : '+cstr(d.slab_from)+ '   ---   Slab To : '+cstr(d.slab_to)
+        added += 1
+    
+    cur_doc.save(ignore_fields = ignore)
+    
+    if onupdate:
+      so = get_obj('TDS Rate Chart', doc.name, with_children = 1)
+      if hasattr(so, 'on_update'):
+        so.on_update()
+    
+    set(doc,'modified',orig_modified)
+    
+    if in_transaction: sql("COMMIT")
+    if added == 0:
+      added_fields = ''
+    else:
+      added_fields =  ' <div style="color : RED">Added Fields :- '+ cstr(fld_lst)+ '</div>' 
+    
+    return doc.name + (' Upgraded: %s fields added' % added)+added_fields
+
+  def get_all_modules(self, args):
+    if args == 'Import':
+      from webnotes.utils import module_manager
+      return module_manager.get_modules_from_filesystem()
+    elif args == 'Export':
+      return get_modules_from_table()
+
+   
+  def get_modules_from_table(self):
+    from webnotes import handler
+    out = webnotes.session
+    handler.get_modules()
+    return out['mod_list']
+       
+
+
+  def export_records(self,args):
+    args = eval(args)
+    msgprint(args)
+    from webnotes.utils import module_manager
+    module_manager.export_to_files(args['modules'],args['record_list'])
+ 
+  def import_records(self,modules,doctyp_list,execute_patch,sync_cp):
+    from webnotes.utils import module_manager
+    module_manager.import_from_files(modules,doctyp_list,execute_patch,sync_cp)
\ No newline at end of file
diff --git a/application_internal/doctype/transfer_control/transfer_control.txt b/application_internal/doctype/transfer_control/transfer_control.txt
new file mode 100644
index 0000000..2d971be
--- /dev/null
+++ b/application_internal/doctype/transfer_control/transfer_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-05-28 12:41:41', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 40, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Transfer Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-12 16:41:58', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/transfer_module/__init__.py b/application_internal/doctype/transfer_module/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/transfer_module/__init__.py
diff --git a/application_internal/doctype/transfer_module/transfer_module.txt b/application_internal/doctype/transfer_module/transfer_module.txt
new file mode 100644
index 0000000..3b5155b
--- /dev/null
+++ b/application_internal/doctype/transfer_module/transfer_module.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-04-29 15:02:21', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Transfer Module', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-04-29 15:02:21', 'doctype': 'DocField', 'oldfieldname': 'module', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Module', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Transfer Module', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01941', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 11:10:53', 'parenttype': 'DocType', 'fieldname': 'module', 'fieldtype': 'Link', 'options': 'Module Def', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-04-29 15:02:21', 'doctype': 'DocField', 'oldfieldname': 'transfer', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Transfer', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Transfer Module', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01942', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 11:10:53', 'parenttype': 'DocType', 'fieldname': 'transfer', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/application_internal/doctype/wn_account_control/__init__.py b/application_internal/doctype/wn_account_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/wn_account_control/__init__.py
diff --git a/application_internal/doctype/wn_account_control/wn_account_control.py b/application_internal/doctype/wn_account_control/wn_account_control.py
new file mode 100644
index 0000000..6893df7
--- /dev/null
+++ b/application_internal/doctype/wn_account_control/wn_account_control.py
@@ -0,0 +1,44 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist):
+    self.doc = doc
+    self.doclist = doclist
+
+  def get_users(self):
+    ret = sql("select name from tabProfile where name!='Administrator' and name!='Guest' and enabled=1")
+    return ret
+
+  def remove_users(self,args):
+    args = eval(args)
+    #for user in args['app_user_list']:
+      #sql("update tabProfile set enabled=0 where email=%s",(user))
+
+  def create_users_profile(self,args):
+    args = eval(args)
+    for email_id in args['user_email_ids']:
+      if sql("select email from tabProfile where email=%s",(email_id)):
+        p = Document('Profile',email_id)
+        p.enabled = 1
+        p.save()
+      else:  
+        p = Document('Profile')
+        p.email = email_id
+        p.save(1)
\ No newline at end of file
diff --git a/application_internal/doctype/wn_account_control/wn_account_control.txt b/application_internal/doctype/wn_account_control/wn_account_control.txt
new file mode 100644
index 0000000..73a187c
--- /dev/null
+++ b/application_internal/doctype/wn_account_control/wn_account_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-03-18 11:09:04', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'WN Account Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/application_internal/doctype/wn_erp_client_control/__init__.py b/application_internal/doctype/wn_erp_client_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application_internal/doctype/wn_erp_client_control/__init__.py
diff --git a/application_internal/doctype/wn_erp_client_control/wn_erp_client_control.py b/application_internal/doctype/wn_erp_client_control/wn_erp_client_control.py
new file mode 100644
index 0000000..288f305
--- /dev/null
+++ b/application_internal/doctype/wn_erp_client_control/wn_erp_client_control.py
@@ -0,0 +1,141 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc, self.doclist = doc, doclist
+
+
+  # Check End of Trial Period
+  # -------------------------
+  def trial_payment_reminders(self):
+    if cint(self.doc.is_trial_account)==1:
+      # Trial Period Expiry
+      trial_end_date = add_days(self.doc.account_start_date, 30)
+      days = date_diff(trial_end_date, nowdate())
+      # check if trial period has expired
+      if days < 10 and days >= 0 and has_common(['System Manager'],webnotes.user.get_roles()):
+        return "Your Trial Period expires on '%s'. Please buy credits online using Manage Account." % (formatdate(trial_end_date))
+      
+      # trial period has already expired
+      elif days < 0 and days >= -6:
+        extended_days = 7 + days
+        return "Your Trial Period has expired on %s. However, your account will be live for %s days. Please contact your System Manager to buy credits." % (formatdate(trial_end_date),cstr(extended_days))
+      elif not has_common(['Administrator'],webnotes.user.get_roles()) and days < -6:
+        return "Stopped"
+    
+    # Account is not a trial account
+    else:
+      return self.account_expiry_reminder()
+      
+
+  # Account Expiry Reminder  
+  # -----------------------
+  def account_expiry_reminder(self):
+    import webnotes.utils
+    from datetime import datetime
+    # Payment Reminder in case of not enough balance
+    cr_reqd = cint(self.doc.total_users)
+    days_left = cint(self.calc_days())
+    # check if account balance is sufficient
+    if cint(self.doc.credit_balance)<(cr_reqd):
+      
+      # Difference between last payment date and current date
+      if self.doc.last_deduction_date: last_payment = date_diff(nowdate(),self.doc.last_deduction_date)
+      else: last_payment = -1
+
+      # 7 days extension
+      remaining_days = days_left - 24
+      if last_payment > 30 or last_payment == -1:
+        if remaining_days < 8 and remaining_days >= 1:
+          return "Your account will be de-activated in " + cstr(remaining_days) + " days. Please contact your System Manager to buy credits."
+        elif remaining_days==0:
+          return "Your account will be disabled from tomorrow. Please contact your System Manager to buy credits."
+        elif not has_common(['Administrator'],webnotes.user.get_roles()):
+          return "Stopped"
+
+      # check if user account is extended for seven days
+      if cint(self.doc.is_trial_account)==0:
+        if days_left < 10 and days_left >= 0:
+          return "You have only %s Credits in your account. Buy credits before %s." % (cint(self.doc.credit_balance),formatdate(self.next_bill_sdate))
+
+
+
+  # Calculate days between current date and billing cycle end date
+  # --------------------------------------------------------------
+  def calc_days(self):
+    if self.doc.billing_cycle_date:
+      next_bill_month = cint(nowdate().split('-')[1])
+      if cint(nowdate().split('-')[2]) > cint(self.doc.billing_cycle_date.split('-')[2]):
+        next_bill_month = cint(nowdate().split('-')[1]) + 1
+      next_bill_year = nowdate().split('-')[0]
+      if next_bill_month > 12:
+        next_bill_month = next_bill_month % 12
+        next_bill_year += 1
+      self.next_bill_sdate = cstr(next_bill_year)+'-'+cstr(next_bill_month)+'-'+(self.calc_next_day(next_bill_year,next_bill_month))
+      #msgprint("next_bill_month :::" + self.next_bill_sdate)
+      return date_diff(self.next_bill_sdate, nowdate())
+
+
+  # Calculate next billing date day
+  # --------------------------------
+  def calc_next_day(self, next_year, next_month):
+    bill_cycle_day = cstr(self.doc.billing_cycle_date).split('-')[2]
+    if cint(next_month) == 2 and next_year%4==0 and (next_year%100!=0 or next_year%400==0) and cint(bill_cycle_day) > 28:
+      bill_cycle_day = '28'
+    elif cint(bill_cycle_day) == 31 and cint(next_month) in (4,6,9,11):
+      bill_cycle_day = '30'
+    return bill_cycle_day
+
+
+  # Update acc credits and balance (making payment from gateway)
+  # -------------------------------------------------------------
+  def update_acc_bal(self,args):
+    args = eval(args)
+    self.doc.credit_balance = cint(self.doc.credit_balance) + cint(args.get('net_cr'))
+    self.doc.total_users = cint(self.doc.total_users) + cint(args.get('total_users'))
+    if cint(self.doc.is_trial_account) == 1:
+      if not self.doc.account_start_date:
+        self.doc.account_start_date = nowdate()
+      self.doc.is_trial_account = 0
+      self.doc.billing_cycle_date = nowdate()
+      self.doc.last_deduction_date = nowdate()
+    self.doc.save()
+
+
+  # Check Credit Balance
+  # ---------------------
+  def check_credit_balance(self):
+    if cint(self.doc.is_trial_account) == 0:
+      if cint(self.doc.credit_balance) < 1:
+        msgprint("You do not have enough credits to add new user. Please buy credits.")
+        raise Exception
+      else:
+        self.doc.credit_balance = cint(self.doc.credit_balance) - 1
+        msgprint("Your one credit is consumed. Balance Credits : %s" % (self.doc.credit_balance))
+    self.doc.total_users = cint(self.doc.total_users) + 1
+    self.doc.save()
+
+
+  # Monthly Deduction
+  # ------------------
+  def monthly_deduction(self, cr_ded):
+    self.doc.credit_balance = cint(self.doc.credit_balance) - cint(cr_ded)
+    self.doc.last_deduction_date = nowdate()
+    self.doc.save()
\ No newline at end of file
diff --git a/application_internal/doctype/wn_erp_client_control/wn_erp_client_control.txt b/application_internal/doctype/wn_erp_client_control/wn_erp_client_control.txt
new file mode 100644
index 0000000..ac155c9
--- /dev/null
+++ b/application_internal/doctype/wn_erp_client_control/wn_erp_client_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-02 16:26:28', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 140, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'WN ERP Client Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00756', 'parent': 'WN ERP Client Control', 'read': 1, 'create': 1, 'creation': '2010-04-02 16:26:28', 'modified': '2010-09-06 10:47:10', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM01003', 'parent': 'WN ERP Client Control', 'read': 1, 'create': None, 'creation': '2010-05-19 13:59:52', 'modified': '2010-09-06 10:47:10', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-02 16:26:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Account Start Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'WN ERP Client Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04619', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-06 10:47:10', 'parenttype': 'DocType', 'fieldname': 'account_start_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-05-14 10:50:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Billing Cycle Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'WN ERP Client Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05025', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-06 10:47:10', 'parenttype': 'DocType', 'fieldname': 'billing_cycle_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-02 16:26:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Total Users', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'WN ERP Client Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04620', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-06 10:47:10', 'parenttype': 'DocType', 'fieldname': 'total_users', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-05-13 11:34:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Credit Balance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'WN ERP Client Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05021', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-06 10:47:10', 'parenttype': 'DocType', 'fieldname': 'credit_balance', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-02 16:26:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Is Trial Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'WN ERP Client Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04623', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-06 10:47:10', 'parenttype': 'DocType', 'fieldname': 'is_trial_account', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-05-19 13:59:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Last Credit Deduction Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'WN ERP Client Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05029', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-06 10:47:10', 'parenttype': 'DocType', 'fieldname': 'last_deduction_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/Module Def/CRM/CRM.txt b/crm/Module Def/CRM/CRM.txt
new file mode 100644
index 0000000..815a95c
--- /dev/null
+++ b/crm/Module Def/CRM/CRM.txt
@@ -0,0 +1,694 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 17:31:24',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': 'Print Format, Sales Order\nPrint Format, Quotation Format\nPrint Format, Delivery Note Format',
+		'file_list': 'crm.gif,FileData/00208',
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-12-09 17:04:58',
+		'modified': '2011-02-24 17:36:51',
+		'modified_by': 'Administrator',
+		'module_desc': 'Manage you sales team, with your leads, customers, quotes, orders etc.',
+		'module_icon': 'Selling.gif',
+		'module_label': 'Selling',
+		'module_name': 'CRM',
+		'module_page': None,
+		'module_seq': 4,
+		'name': 'CRM',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:24',
+		'description': 'Database of potential customers you need to keep in touch with',
+		'display_name': 'Lead',
+		'doc_name': 'Lead',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month',
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00067',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:24',
+		'description': 'Your Customer Database',
+		'display_name': 'Customer',
+		'doc_name': 'Customer',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'customer_group\ncountry',
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00068',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:24',
+		'description': 'Specific requirements from a Lead / Customer',
+		'display_name': 'Enquiry',
+		'doc_name': 'Enquiry',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany',
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00069',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:24',
+		'description': 'Offers you have made to your customers',
+		'display_name': 'Quotation',
+		'doc_name': 'Quotation',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany',
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00070',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:24',
+		'description': 'Database of confirmed Sale Orders from your Customers',
+		'display_name': 'Sales Order',
+		'doc_name': 'Sales Order',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany',
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00071',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:24',
+		'description': None,
+		'display_name': 'Sales Dashboard',
+		'doc_name': 'Sales Dashboard',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00072',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Reports',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00309',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Territory, Item Group wise GP',
+		'doc_name': 'Delivery Note',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00311',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Itemwise Delivery Details',
+		'doc_name': 'Delivery Note Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00313',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Personwise Transaction Summary',
+		'doc_name': 'Sales Person',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 12,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00314',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Persons Target Variance (Item Group wise)',
+		'doc_name': 'Target Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 14,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00316',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Territories Target Variance (Item Group wise)',
+		'doc_name': 'Target Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 15,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00315',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Territories Target Variance (Item Group wise)',
+		'doc_name': 'Target Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 15,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00317',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Order Pending Items',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 16,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00318',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Orderwise Booking & Delivery Summary',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 17,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00319',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Orderwise Pending Qty To Deliver',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 18,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00320',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Orderwise Pending Packing Item Summary',
+		'doc_name': 'Delivery Note Packing Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 19,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00321',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Orderwise Pending Amount To Bill',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 20,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00312',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Sales Orderwise Pending Amount To Bill',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 20,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00322',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Delivered Items to be Install',
+		'doc_name': 'Delivery Note Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 21,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00310',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Delivered Items to be Install',
+		'doc_name': 'Delivery Note Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 21,
+		'modified': '2011-03-01 13:53:34',
+		'modified_by': 'Administrator',
+		'name': 'MDI00323',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Itemwise Price List',
+		'doc_name': 'Ref Rate Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 22,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00324',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': None,
+		'display_name': 'Follow-up Report',
+		'doc_name': 'Follow up',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 23,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00325',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': 'Ledger details of your debtors',
+		'display_name': "Debtor's Ledger",
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 24,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00326',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': 'Customer Category',
+		'display_name': 'Customer Group',
+		'doc_name': 'Customer Group',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\ndescription',
+		'hide': None,
+		'icon': None,
+		'idx': 25,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00327',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': 'Sales person details',
+		'display_name': 'Sales Person',
+		'doc_name': 'Sales Person',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id',
+		'hide': None,
+		'icon': None,
+		'idx': 26,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00328',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': 'Item master',
+		'display_name': 'Item',
+		'doc_name': 'Item',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'name\nitem_group\ndescription',
+		'hide': None,
+		'icon': None,
+		'idx': 27,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00329',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': 'Sales partner details',
+		'display_name': 'Sales Partner',
+		'doc_name': 'Sales Partner',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\npartner_type\nmobile\nemail\nterritory',
+		'hide': None,
+		'icon': None,
+		'idx': 28,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00330',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-01 13:53:34',
+		'description': 'Business campaigns',
+		'display_name': 'Campaign',
+		'doc_name': 'Campaign',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\ncampaign_name\ndescription',
+		'hide': None,
+		'icon': None,
+		'idx': 29,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00331',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 17:31:24',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-11-30 17:31:24',
+		'modified_by': 'Administrator',
+		'name': 'MDR00008',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-11-30 17:31:24',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-11-30 17:31:24',
+		'modified_by': 'Administrator',
+		'name': 'MDR00009',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Manager'
+	},
+	{
+		'creation': '2010-11-30 17:31:24',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2010-11-30 17:31:24',
+		'modified_by': 'Administrator',
+		'name': 'MDR00010',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales User'
+	},
+	{
+		'creation': '2010-11-30 17:31:24',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2010-11-30 17:31:24',
+		'modified_by': 'Administrator',
+		'name': 'MDR00011',
+		'owner': 'Administrator',
+		'parent': 'CRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Master Manager'
+	}
+]
\ No newline at end of file
diff --git a/crm/__init__.py b/crm/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/__init__.py
diff --git a/crm/doctype/__init__.py b/crm/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/__init__.py
diff --git a/crm/doctype/campaign/__init__.py b/crm/doctype/campaign/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/campaign/__init__.py
diff --git a/crm/doctype/campaign/campaign.js b/crm/doctype/campaign/campaign.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/crm/doctype/campaign/campaign.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/crm/doctype/campaign/campaign.txt b/crm/doctype/campaign/campaign.txt
new file mode 100644
index 0000000..7d2817d
--- /dev/null
+++ b/crm/doctype/campaign/campaign.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-24 14:43:37', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 7, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:campaign_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Campaign', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00944', 'parent': 'Campaign', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:09:28', 'modified': '2010-09-20 09:04:15', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00945', 'parent': 'Campaign', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:09:28', 'modified': '2010-09-20 09:04:15', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00957', 'parent': 'Campaign', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:11:41', 'modified': '2010-09-20 09:04:15', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00977', 'parent': 'Campaign', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:14:01', 'modified': '2010-09-20 09:04:15', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00978', 'parent': 'Campaign', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:14:01', 'modified': '2010-09-20 09:04:15', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 5, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00522', 'parent': 'Campaign', 'read': 1, 'create': 1, 'creation': '2009-11-24 14:43:37', 'modified': '2010-09-20 09:04:15', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Campaign', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04830', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:15', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-11-24 14:43:37', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Campaign', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Campaign', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03402', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:15', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-24 14:43:37', 'doctype': 'DocField', 'oldfieldname': 'campaign_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Campaign Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Campaign', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03403', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:15', 'parenttype': 'DocType', 'fieldname': 'campaign_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-11-24 14:43:37', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Campaign', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03404', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:15', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/customer/__init__.py b/crm/doctype/customer/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/customer/__init__.py
diff --git a/crm/doctype/customer/customer.js b/crm/doctype/customer/customer.js
new file mode 100644
index 0000000..23d007b
--- /dev/null
+++ b/crm/doctype/customer/customer.js
@@ -0,0 +1,211 @@
+$import(Contact Control)
+
+/* ********************************* onload ********************************************* */
+
+cur_frm.cscript.onload = function(doc,dt,dn){
+	// history doctypes and scripts
+	cur_frm.history_dict = {
+		'Quotation' : 'cur_frm.cscript.make_qtn_list(this.body, this.doc)',
+		'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)',
+		'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)',
+		'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)'
+	}
+	// make address, contact, shipping, history list body
+	cur_frm.cscript.make_hl_body();
+  	//cur_frm.cscript.make_sl_body();  	
+}
+
+cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');
+cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
+
+/* ********************************* refresh ********************************************* */
+
+cur_frm.cscript.refresh = function(doc,dt,dn) {
+	if(sys_defaults.cust_master_name == 'Customer Name')
+		hide_field('naming_series');
+	else
+		unhide_field('naming_series');
+
+	if(doc.__islocal){		
+		hide_field(['Address HTML','Contact HTML']);
+		//cur_frm.cscript.set_hl_msg(doc);
+ 		//cur_frm.cscript.set_sl_msg(doc);
+	}else{
+		unhide_field(['Address HTML','Contact HTML']);
+		// make lists
+		cur_frm.cscript.make_address(doc,dt,dn);
+		cur_frm.cscript.make_contact(doc,dt,dn);
+		cur_frm.cscript.make_history(doc,dt,dn);
+		//cur_frm.cscript.make_shipping_address(doc,dt,dn);
+	}
+}
+
+cur_frm.cscript.make_address = function() {
+	if(!cur_frm.address_list) {
+		cur_frm.address_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Address HTML'].wrapper,
+			page_length: 2,
+			new_doctype: "Address",
+			new_doc_onload: function(dn) {
+				ndoc = locals["Address"][dn];
+				ndoc.customer = cur_frm.doc.name;
+				ndoc.customer_name = cur_frm.doc.customer_name;
+				ndoc.address_type = 'Office';				
+			},
+			new_doc_onsave: function(dn) {				
+				cur_frm.address_list.run()				
+			},
+			get_query: function() {
+				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
+			},
+			as_dict: 1,
+			no_results_message: 'No addresses created',
+			render_row: function(wrapper, data) {
+				$(wrapper).css('padding','5px 0px');
+				var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
+				link.dn = data.name
+				
+				$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));				
+				$a(wrapper,'div','',{marginTop:'5px', color:'#555'}, 
+					(data.address_line1 ? data.address_line1 + '<br />' : '') + 
+					(data.address_line2 ? data.address_line2 + '<br />' : '') + 
+					(data.city ? data.city + '<br />' : '') + 
+					(data.state ? data.state + ', ' : '') + 
+					(data.country ? data.country  + '<br />' : '') + 
+					(data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') + 
+					(data.phone ? 'Phone: ' + data.phone + '<br />' : '') + 
+					(data.fax ? 'Fax: ' + data.fax + '<br />' : '') + 
+					(data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
+			}
+		});
+	}
+	cur_frm.address_list.run();
+}
+
+cur_frm.cscript.make_contact = function() {
+	if(!cur_frm.contact_list) {
+		cur_frm.contact_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
+			page_length: 2,
+			new_doctype: "Contact",
+			new_doc_onload: function(dn) {
+				ndoc = locals["Contact"][dn];
+				ndoc.customer = cur_frm.doc.name;
+				ndoc.customer_name = cur_frm.doc.customer_name;
+				if(cur_frm.doc.customer_type == 'Individual') {
+					ndoc.first_name = cur_frm.doc.customer_name;
+				}
+			},
+			new_doc_onsave: function(dn) {				
+				cur_frm.contact_list.run()
+			},
+			get_query: function() {
+				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
+			},
+			as_dict: 1,
+			no_results_message: 'No contacts created',
+			render_row: function(wrapper, data) {
+				$(wrapper).css('padding', '5px 0px');
+				var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
+				link.dn = data.name
+
+				$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
+				$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
+			}
+		});
+	}
+	cur_frm.contact_list.run();
+
+}
+
+/* ********************************* client triggers ************************************** */
+
+// ---------------
+// customer group
+// ---------------
+cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
+	return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY	`tabCustomer Group`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.CGHelp = function(doc,dt,dn){
+	var call_back = function(){
+		var sb_obj = new SalesBrowser();				
+		sb_obj.set_val('Customer Group');
+	}
+	loadpage('Sales Browser',call_back);
+}
+
+// -----
+// lead
+// -----
+cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){
+	return 'SELECT `tabLead`.`name` FROM `tabLead` WHERE `tabLead`.`status`!="Converted" AND `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';	
+}
+
+/* ********************************* transaction history ************************************** */
+
+// --------------------
+// make quotation list
+// --------------------
+cur_frm.cscript.make_qtn_list = function(parent,doc){
+
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
+	lst.colnames = ['Sr.','Id','Status','Quotation Date','Contact Person','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Data','Currency'];
+	lst.coloptions = ['','Quotation','','','',''];
+
+	var q = repl("select name,status,transaction_date, contact_person, grand_total from tabQuotation where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
+	var q_max = repl("select count(name) from tabQuotation where customer='%(cust)s'", {'cust':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Quotation','Quotation');
+}
+
+// -------------
+// make so list
+// -------------
+cur_frm.cscript.make_so_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','30%','25%'];
+	lst.colnames = ['Sr.','Id','Status','Sales Order Date','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency'];
+	lst.coloptions = ['','Sales Order','','',''];
+
+	var q = repl("select name,status,transaction_date, grand_total from `tabSales Order` where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
+	var q_max = repl("select count(name) from `tabSales Order` where customer='%(cust)s'", {'cust':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Order','Sales Order');
+}
+
+// -------------
+// make dn list
+// -------------
+cur_frm.cscript.make_dn_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
+	lst.colnames = ['Sr.','Id','Status','Delivery Note Date','Territory','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
+	lst.coloptions = ['','Delivery Note','','','Territory',''];
+
+	var q = repl("select name,status,transaction_date,territory,grand_total from `tabDelivery Note` where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
+	var q_max = repl("select count(name) from `tabDelivery Note` where customer='%(cust)s'", {'cust':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Delivery Note','Delivery Note');
+}
+
+// -------------
+// make si list
+// -------------
+cur_frm.cscript.make_si_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
+	lst.colnames = ['Sr.','Id','Posting Date','Due Date','Debit To','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
+	lst.coloptions = ['','Receivable Voucher','','','Account',''];
+
+
+	var q = repl("select name,posting_date,due_date,debit_to,grand_total from `tabReceivable Voucher` where customer='%(cust)s' order by posting_date desc", {'cust':doc.name});
+	var q_max = repl("select count(name) from `tabReceivable Voucher` where customer='%(cust)s'", {'cust':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');
+}
diff --git a/crm/doctype/customer/customer.py b/crm/doctype/customer/customer.py
new file mode 100644
index 0000000..d480a6c
--- /dev/null
+++ b/crm/doctype/customer/customer.py
@@ -0,0 +1,220 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cstr, date_diff, flt, formatdate, get_defaults, getdate, has_common, now, nowdate, replace_newlines, sendmail, set_default, user_format, validate_email_add
+from webnotes.model.doc import Document, make_autoname
+from webnotes.model.code import get_obj
+from webnotes import msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+# ******************************************************* autoname ***********************************************************
+  def autoname(self):
+    cust_master_name = get_defaults().get('cust_master_name')
+    if cust_master_name == 'Customer Name':
+   
+      # filter out bad characters in name
+      cust = self.doc.customer_name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
+
+      supp = sql("select name from `tabSupplier` where name = %s", (cust))
+      supp = supp and supp[0][0] or ''
+      if supp:
+        msgprint("You already have a Supplier with same name")
+        raise Exception
+      else:
+        self.doc.name = cust
+        
+    else:
+      self.doc.name = make_autoname(self.doc.naming_series+'.#####')       
+
+
+# ******************************************************* triggers ***********************************************************
+  # ----------------
+  # get company abbr
+  # -----------------
+  def get_company_abbr(self):
+    return get_value('Company', self.doc.company, 'abbr')
+
+  # -----------------------------------------------------------------------------------------------------
+  # get parent account(i.e receivables group from company where default account head need to be created)
+  # -----------------------------------------------------------------------------------------------------
+  def get_receivables_group(self):
+    g = sql("select receivables_group from tabCompany where name=%s", self.doc.company)
+    g = g and g[0][0] or '' 
+    if not g:
+      msgprint("Update Company master, assign a default group for Receivables")
+      raise Exception
+    return g
+  
+# ******************************************************* validate *********************************************************
+  # ----------------
+  # validate values
+  # ----------------
+  def validate_values(self):
+    # Master name by naming series -> Series field mandatory
+    if get_defaults().get('cust_master_name') == 'Naming Series' and not self.doc.naming_series:
+      msgprint("Series is Mandatory.")
+      raise Exception
+
+  # ---------
+  # validate
+  # ---------
+  def validate(self):
+    self.validate_values()
+
+# ******************************************************* on update *********************************************************
+  # ------------------------
+  # create customer address
+  # ------------------------
+  def create_customer_address(self):
+    addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
+    address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
+
+    if self.doc.phone_1:
+      address_line = address_line + "\n" + "Phone: " + cstr(self.doc.phone_1)
+    if self.doc.email_id:
+      address_line = address_line + "\n" + "E-mail: " + cstr(self.doc.email_id)
+    set(self.doc,'address', address_line)
+    
+    telephone = "(O): " + cstr(self.doc.phone_1) +"\n"+ cstr(self.doc.phone_2) + "\n" + "(M): " +  "\n" + "(fax): " + cstr(self.doc.fax_1)
+    set(self.doc,'telephone',telephone)
+
+
+  # ------------------------------------
+  # create primary contact for customer
+  # ------------------------------------
+  def create_p_contact(self,nm,phn_no,email_id,mob_no,fax,cont_addr):
+    c1 = Document('Contact')
+    c1.first_name = nm
+    c1.contact_name = nm
+    c1.contact_no = phn_no
+    c1.email_id = email_id
+    c1.mobile_no = mob_no
+    c1.fax = fax
+    c1.contact_address = cont_addr
+    c1.is_primary_contact = 'Yes'
+    c1.is_customer =1
+    c1.customer = self.doc.name
+    c1.customer_name = self.doc.customer_name
+    c1.customer_address = self.doc.address
+    c1.customer_group = self.doc.customer_group
+    c1.save(1)
+
+
+  # ------------------------
+  # create customer contact
+  # ------------------------
+  def create_customer_contact(self):
+    contact = sql("select distinct name from `tabContact` where customer_name=%s", (self.doc.customer_name))
+    contact = contact and contact[0][0] or ''
+    if not contact:
+      # create primary contact for individual customer 
+      if self.doc.customer_type == 'Individual':
+        self.create_p_contact(self.doc.customer_name,self.doc.phone_1,self.doc.email_id,'',self.doc.fax_1,self.doc.address)
+    
+      # create primary contact for lead
+      elif self.doc.lead_name:
+        c_detail = sql("select lead_name, company_name, contact_no, mobile_no, email_id, fax, address from `tabLead` where name =%s", self.doc.lead_name, as_dict=1)
+        self.create_p_contact(c_detail and c_detail[0]['lead_name'] or '', c_detail and c_detail[0]['contact_no'] or '', c_detail and c_detail[0]['email_id'] or '', c_detail and c_detail[0]['mobile_no'] or '', c_detail and c_detail[0]['fax'] or '', c_detail and c_detail[0]['address'] or '')
+
+
+  # -------------------
+  # update lead status
+  # -------------------
+  def update_lead_status(self):
+    if self.doc.lead_name:
+      sql("update `tabLead` set status='Converted' where name = %s", self.doc.lead_name)
+
+
+  # -------------------------------------------------------------------------
+  # create accont head - in tree under receivables_group of selected company
+  # -------------------------------------------------------------------------
+  def create_account_head(self):
+    if self.doc.company :
+      abbr = self.get_company_abbr()  
+      if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
+        parent_account = self.get_receivables_group()
+        arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Customer','master_name':self.doc.name,'address':self.doc.address}
+        # create
+        ac = get_obj('GL Control').add_ac(cstr(arg))
+        msgprint("Account Head created for "+ac)
+    else :
+      msgprint("Please Select Company under which you want to create account head")
+
+
+  # ----------------------------------------
+  # update credit days and limit in account
+  # ----------------------------------------
+  def update_credit_days_limit(self):
+    sql("update tabAccount set credit_days = '%s', credit_limit = '%s' where name = '%s'" % (self.doc.credit_days, self.doc.credit_limit, self.doc.name + " - " + self.get_company_abbr()))
+
+
+  #create address and contact from lead
+  def create_lead_address_contact(self):
+    if self.doc.lead_name:
+      details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, contact_no, mobile_no, fax, email_id from `tabLead` where name = '%s'" %(self.doc.lead_name), as_dict = 1)      
+      d = Document('Address') 
+      d.address_line1 = details[0]['address_line1'] 
+      d.address_line2 = details[0]['address_line2']  
+      d.city = details[0]['city']  
+      d.country = details[0]['country']  
+      d.pincode = details[0]['pincode']
+      d.state = details[0]['state']  
+      d.fax = details[0]['fax']  
+      d.email_id = details[0]['email_id']  		
+      d.phone = details[0]['contact_no']  
+      d.customer = self.doc.name
+      d.customer_name = self.doc.customer_name
+      d.is_primary_address = 1
+      d.address_type = 'Office'
+      try:
+        d.save(1)
+      except NameError, e:
+        pass
+        
+      c = Document('Contact') 
+      c.first_name = details[0]['lead_name'] 
+      c.email_id = details[0]['email_id']
+      c.phone = details[0]['contact_no']
+      c.phone = details[0]['contact_no']  
+      c.customer = self.doc.name
+      c.customer_name = self.doc.customer_name
+      c.is_primary_contact = 1
+      try:
+        c.save(1)
+      except NameError, e:
+        pass  
+
+  # ----------
+  # on update
+  # ----------
+  def on_update(self):
+    # create customer addr
+    #self.create_customer_address()
+    # create customer contact
+    #self.create_customer_contact()
+    # update lead status
+    self.update_lead_status()
+    # create account head
+    self.create_account_head()
+    # update credit days and limit in account
+    self.update_credit_days_limit()
+    #create address and contact from lead    
+    self.create_lead_address_contact()
+
+  
+# ******************************************************* on trash *********************************************************
+  def on_trash(self):
+    if self.doc.lead_name:
+      sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
diff --git a/crm/doctype/customer/customer.txt b/crm/doctype/customer/customer.txt
new file mode 100644
index 0000000..fb7b120
--- /dev/null
+++ b/crm/doctype/customer/customer.txt
@@ -0,0 +1,1205 @@
+[
+	{
+		'_last_update': '1306307673',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': 0,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:56',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-26 17:31:31',
+		'modified_by': 'Guest',
+		'module': 'CRM',
+		'name': 'Customer',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'customer_name,customer_group,country,territory',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': "eval:'%(customer_name)s'=='%(name)s' ? ' ' : '%(customer_name)s'",
+		'tag_fields': 'customer_group,customer_type',
+		'use_template': None,
+		'version': 431
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:56',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-10 17:41:08',
+		'modified_by': 'Administrator',
+		'name': 'PERM00150',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:56',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-10 17:41:08',
+		'modified_by': 'Administrator',
+		'name': 'PERM00151',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:56',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-10 17:41:08',
+		'modified_by': 'Administrator',
+		'name': 'PERM00152',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:56',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-05-10 17:41:08',
+		'modified_by': 'Administrator',
+		'name': 'PERM00153',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:56',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-05-10 17:41:08',
+		'modified_by': 'Administrator',
+		'name': 'PERM00154',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:56',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-05-10 17:41:08',
+		'modified_by': 'Administrator',
+		'name': 'PERM00155',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04814',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Customer Name',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00830',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Customer Type',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL03770',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_type',
+		'oldfieldtype': 'Select',
+		'options': '\nCompany\nIndividual',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-22 11:41:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': '000000554',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'CUST',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': 'Fetch lead which will be converted into customer.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_name',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Lead Ref',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00835',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'lead_name',
+		'oldfieldtype': 'Link',
+		'options': 'Lead',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04815',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': '<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Customer Group',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00831',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_group',
+		'oldfieldtype': 'Link',
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00833',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Address & Contacts',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04816',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Address Desc',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04817',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<em>Addresses will appear only when you save the customer</em>',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Address HTML',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04818',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04819',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Contact Desc',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04820',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<em>Contact Details will appear only when you save the customer</em>',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Contact HTML',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04821',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04822',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': 'To create an Account Head under a different company, then set the company and click the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00855',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': "Your Customer's TAX registration numbers (if applicable) or any general information",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_details',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Customer Details',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00856',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_details',
+		'oldfieldtype': 'Code',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04823',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-27 15:24:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_days',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Credit Days',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04075',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'credit_days',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-27 15:24:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_limit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Credit Limit',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04076',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'credit_limit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-25 17:52:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'website',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Website',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': '000000572',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Sales Team',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04824',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:32:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_sales_partner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Default Sales Partner',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04134',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'default_sales_partner',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Partner',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:32:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_commission_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Default Commission Rate',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04135',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'default_commission_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:32:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_team',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Sales Team Details',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04136',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_team',
+		'oldfieldtype': 'Table',
+		'options': 'Sales Team',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Transaction History',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04825',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:51',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'History HTML',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL04826',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-27 18:28:51',
+		'modified_by': 'Guest',
+		'name': 'FL00827',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/enquiry/__init__.py b/crm/doctype/enquiry/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/enquiry/__init__.py
diff --git a/crm/doctype/enquiry/enquiry.comp.js b/crm/doctype/enquiry/enquiry.comp.js
new file mode 100644
index 0000000..fc4baa4
--- /dev/null
+++ b/crm/doctype/enquiry/enquiry.comp.js
@@ -0,0 +1,38 @@
+
+$import(SMS Control)
+cur_frm.cscript.refresh=function(doc,cdt,cdn){if(!doc.docstatus){hide_field(['Update Follow up']);hide_field(['email_id1','cc_to','subject','message','Attachment Html','Create New File','enquiry_attachment_detail','Send Email']);}
+else{unhide_field(['Update Follow up']);unhide_field(['email_id1','cc_to','subject','message','Attachment Html','Create New File','enquiry_attachment_detail','Send Email']);}
+cur_frm.clear_custom_buttons();if(doc.docstatus==1){cur_frm.add_custom_button('Create Quotation',cur_frm.cscript['Create Quotation']);cur_frm.add_custom_button('Enquiry Lost',cur_frm.cscript['Declare Enquiry Lost']);cur_frm.add_custom_button('Send SMS',cur_frm.cscript['Send SMS']);}}
+cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.enquiry_from)hide_field(['customer','customer_address','contact_person','customer_name','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);if(!doc.status)set_multiple(cdt,cdn,{status:'Draft'});if(!doc.date)doc.transaction_date=date.obj_to_str(new Date());if(!doc.company&&sys_defaults.company)set_multiple(cdt,cdn,{company:sys_defaults.company});if(!doc.fiscal_year&&sys_defaults.fiscal_year)set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});if(doc.enquiry_from){if(doc.enquiry_from=='Customer'){hide_field(['lead','lead_name']);}
+else if(doc.enquiry_from=='Lead'){hide_field(['customer','customer_address','contact_person','customer_name','contact_display','customer_group']);}}
+if(doc.enquiry_from=='Lead'&&doc.lead){cur_frm.cscript.lead(doc,cdt,cdn);}
+cur_frm.cscript.set_fetch();}
+cur_frm.cscript.set_fetch=function(){cur_frm.add_fetch('item_code','item_name','item_name');cur_frm.add_fetch('item_code','stock_uom','uom');cur_frm.add_fetch('item_code','description','description');cur_frm.add_fetch('item_code','item_group','item_group');cur_frm.add_fetch('item_code','brand','brand');}
+cur_frm.cscript.enquiry_from=function(doc,cdt,cdn){cur_frm.cscript.lead_cust_show(doc,cdt,cdn);}
+cur_frm.cscript.lead_cust_show=function(doc,cdt,cdn){if(doc.enquiry_from=='Lead'){unhide_field(['lead']);hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}
+else if(doc.enquiry_from=='Customer'){unhide_field(['customer']);hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}}
+cur_frm.cscript.customer=function(doc,dt,dn){if(doc.customer)get_server_fields('get_default_customer_address',JSON.stringify({customer:doc.customer}),'',doc,dt,dn,1);if(doc.customer)unhide_field(['customer_name','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);}
+cur_frm.cscript.customer_address=cur_frm.cscript.contact_person=function(doc,dt,dn){if(doc.customer)get_server_fields('get_customer_address',JSON.stringify({customer:doc.customer,address:doc.customer_address,contact:doc.contact_person}),'',doc,dt,dn,1);}
+cur_frm.fields_dict.customer_address.on_new=function(dn){locals['Address'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Address'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
+cur_frm.fields_dict.contact_person.on_new=function(dn){locals['Contact'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Contact'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
+cur_frm.fields_dict['customer_address'].get_query=function(doc,cdt,cdn){return'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
+cur_frm.fields_dict['contact_person'].get_query=function(doc,cdt,cdn){return'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
+cur_frm.fields_dict['lead'].get_query=function(doc,cdt,cdn){return'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s"  ORDER BY  `tabLead`.`name` ASC LIMIT 50';}
+cur_frm.cscript.lead=function(doc,cdt,cdn){if(doc.lead)get_server_fields('get_lead_details',doc.lead,'',doc,cdt,cdn,1);if(doc.lead)unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);}
+cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query=function(doc,cdt,cdn){if(doc.enquiry_type=='Maintenance')
+return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';else
+return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';}
+cur_frm.cscript.item_code=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.item_code){get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);}}
+cur_frm.cscript['Create New File']=function(doc){var fl=LocalDB.create('File');fl=locals['File'][fl];loaddoc('File',fl.name);}
+cur_frm.cscript['Update Follow up']=function(doc,cdt,cdn){$c_obj(make_doclist(doc.doctype,doc.name),'update_follow_up','',function(r,rt){refresh_field('follow_up');doc.__unsaved=0;cur_frm.refresh_header();});}
+cur_frm.cscript['Create Quotation']=function(){n=createLocal("Quotation");$c('dt_map',args={'docs':compress_doclist([locals["Quotation"][n]]),'from_doctype':'Enquiry','to_doctype':'Quotation','from_docname':cur_frm.docname,'from_to_list':"[['Enquiry', 'Quotation'],['Enquiry Detail','Quotation Detail']]"},function(r,rt){loaddoc("Quotation",n);});}
+cur_frm.cscript['Declare Enquiry Lost']=function(){var e_lost_dialog;set_e_lost_dialog=function(){e_lost_dialog=new Dialog(400,150,'Add Enquiry Lost Reason');e_lost_dialog.make_body([['HTML','Message','<div class="comment">Please add enquiry lost reason</div>'],['Text','Enquiry Lost Reason'],['HTML','Response','<div class = "comment" id="update_enquiry_dialog_response"></div>'],['HTML','Add Reason','<div></div>']]);var add_reason_btn1=$a($i(e_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn1.innerHTML='Add';add_reason_btn1.onclick=function(){e_lost_dialog.add();}
+var add_reason_btn2=$a($i(e_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn2.innerHTML='Cancel';$y(add_reason_btn2,{marginLeft:'4px'});add_reason_btn2.onclick=function(){e_lost_dialog.hide();}
+e_lost_dialog.onshow=function(){e_lost_dialog.widgets['Enquiry Lost Reason'].value='';$i('update_enquiry_dialog_response').innerHTML='';}
+e_lost_dialog.add=function(){$i('update_enquiry_dialog_response').innerHTML='Processing...';var arg=strip(e_lost_dialog.widgets['Enquiry Lost Reason'].value);var call_back=function(r,rt){if(r.message=='true'){$i('update_enquiry_dialog_response').innerHTML='Done';e_lost_dialog.hide();}}
+if(arg){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);}
+else{msgprint("Please add enquiry lost reason");}}}
+if(!e_lost_dialog){set_e_lost_dialog();}
+e_lost_dialog.show();}
+cur_frm.fields_dict['territory'].get_query=function(doc,cdt,cdn){return'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';}
+cur_frm.cscript.validate=function(doc,cdt,cdn){}
\ No newline at end of file
diff --git a/crm/doctype/enquiry/enquiry.js b/crm/doctype/enquiry/enquiry.js
new file mode 100644
index 0000000..a8c8ea2
--- /dev/null
+++ b/crm/doctype/enquiry/enquiry.js
@@ -0,0 +1,334 @@
+$import(SMS Control)
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn){
+
+  //cur_frm.cscript.get_tips(doc, cdt, cdn);
+
+  if(!doc.docstatus){
+    hide_field(['Update Follow up']);
+    hide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
+  }
+  else{
+    unhide_field(['Update Follow up']);
+    unhide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
+  }
+
+  
+  cur_frm.clear_custom_buttons();
+  if(doc.docstatus == 1) {
+    cur_frm.add_custom_button('Create Quotation', cur_frm.cscript['Create Quotation']);
+    cur_frm.add_custom_button('Enquiry Lost', cur_frm.cscript['Declare Enquiry Lost']);
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+  }
+
+  //cur_frm.cscript.clear_values(doc,cdt,cdn);
+}
+
+// ONLOAD
+// ===============================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+
+  if(!doc.enquiry_from) hide_field(['customer', 'customer_address', 'contact_person', 'customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+  if(!doc.date) doc.transaction_date = date.obj_to_str(new Date());
+  if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
+  if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});    
+  
+  if(doc.enquiry_from) {
+    if(doc.enquiry_from == 'Customer') {
+      hide_field(['lead', 'lead_name']);
+    }
+    else if (doc.enquiry_from == 'Lead') {
+      hide_field(['customer', 'customer_address', 'contact_person', 'customer_name', 'contact_display', 'customer_group']);
+    }
+  } 
+  
+  if(doc.enquiry_from == 'Lead' && doc.lead) {
+    cur_frm.cscript.lead(doc,cdt,cdn);
+  } 
+
+  // setup fetch
+  cur_frm.cscript.set_fetch();
+}
+
+
+// fetch
+// ===============================================================
+cur_frm.cscript.set_fetch = function() {
+
+  // item
+  cur_frm.add_fetch('item_code', 'item_name', 'item_name');
+  cur_frm.add_fetch('item_code', 'stock_uom', 'uom');
+  cur_frm.add_fetch('item_code', 'description', 'description');
+  cur_frm.add_fetch('item_code', 'item_group', 'item_group');
+  cur_frm.add_fetch('item_code', 'brand', 'brand');
+
+  // customer
+
+}
+
+// hide - unhide fields on basis of enquiry_from lead or customer
+cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
+  cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
+}
+
+// hide - unhide fields based on lead or customer
+cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
+  if(doc.enquiry_from == 'Lead'){
+    unhide_field(['lead']);
+    hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+    doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
+  }
+  else if(doc.enquiry_from == 'Customer'){    
+    unhide_field(['customer']);
+    hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);    
+    doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
+  }
+}
+
+// customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  if(doc.customer) get_server_fields('get_default_customer_address', JSON.stringify({customer: doc.customer}),'', doc, dt, dn, 1);
+  if(doc.customer) unhide_field(['customer_name','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+// lead
+cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
+  return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s"  ORDER BY  `tabLead`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.lead = function(doc, cdt, cdn) {
+  if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
+  if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);  
+}
+
+
+//item getquery
+//=======================================
+cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
+  if (doc.enquiry_type == 'Maintenance')
+    return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+  else 
+    return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+}
+  
+ //Fetch Item Details
+//====================================================================================================================
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);
+  }
+}
+
+/*
+ //Fetch Customer Details
+//======================================================================================================================
+cur_frm.cscript.customer = function(doc, cdt, cdn){
+  if (doc.customer) {
+    get_server_fields('get_cust_address',doc.customer,'',doc,cdt,cdn,1);
+  }
+}
+*/
+
+/*
+//=======================================================================================================================
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+}
+*/
+
+/*
+//=======================================================================================================================
+cur_frm.cscript.contact_person = function(doc, cdt, cdn){
+  if (doc.contact_person) {
+    arg = {};
+    arg.contact_person = doc.contact_person;
+    arg.customer = doc.customer;
+    get_server_fields('get_contact_details',docstring(arg),'',doc,cdt,cdn,1);
+  }
+}
+*/
+
+/*
+// hide - unhide fields based on lead or customer..
+//=======================================================================================================================
+cur_frm.cscript.clear_values = function(doc,cdt,cdn) {
+  if(doc.enquiry_from == 'Lead') {
+    doc.customer = doc.customer_name = doc.contact_person = doc.customer_group = "";
+  }
+  else if(doc.enquiry_from == 'Customer') {
+    doc.lead =  doc.lead_name = "";
+  }
+  refresh_many(['lead','lead_name','customer','customer_name','contact_person','customer_group']);
+}
+*/
+
+/*
+//================ hide - unhide fields on basis of enquiry from either lead or customer =============================== 
+cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
+  cur_frm.cscript.clear_values(doc,cdt,cdn);
+   doc.address = doc.territory = doc.contact_no = doc.email_id = "";
+   refresh_many(['territory','address','contact_no','email_id']);
+}
+*/
+
+/*
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+  tn = createLocal('Contact');
+  locals['Contact'][tn].is_customer = 1;
+  if(doc.customer) locals['Contact'][tn].customer = doc.customer;
+  loaddoc('Contact', tn);
+}
+*/
+
+//=======================================================================================================================
+cur_frm.cscript['Create New File'] = function(doc){
+  var fl = LocalDB.create('File');
+  fl = locals['File'][fl];
+  loaddoc('File', fl.name);
+}
+
+//update follow up
+//=================================================================================
+cur_frm.cscript['Update Follow up'] = function(doc,cdt,cdn){
+
+  $c_obj(make_doclist(doc.doctype, doc.name),'update_follow_up','',function(r, rt){
+    refresh_field('follow_up');
+    doc.__unsaved = 0;
+    cur_frm.refresh_header();
+  });
+}
+
+ // Create New Quotation
+// =======================================================================================================================
+cur_frm.cscript['Create Quotation'] = function(){
+  n = createLocal("Quotation");
+  $c('dt_map', args={
+	  'docs':compress_doclist([locals["Quotation"][n]]),
+	  'from_doctype':'Enquiry',
+	  'to_doctype':'Quotation',
+	  'from_docname':cur_frm.docname,
+    'from_to_list':"[['Enquiry', 'Quotation'],['Enquiry Detail','Quotation Detail']]"
+  }
+  , function(r,rt) {
+    loaddoc("Quotation", n);
+    }
+  );
+}
+
+
+// declare enquiry  lost
+//-------------------------
+cur_frm.cscript['Declare Enquiry Lost'] = function(){
+  var e_lost_dialog;
+
+  set_e_lost_dialog = function(){
+    e_lost_dialog = new Dialog(400,150,'Add Enquiry Lost Reason');
+    e_lost_dialog.make_body([
+      ['HTML', 'Message', '<div class="comment">Please add enquiry lost reason</div>'],
+      ['Text', 'Enquiry Lost Reason'],
+      ['HTML', 'Response', '<div class = "comment" id="update_enquiry_dialog_response"></div>'],
+      ['HTML', 'Add Reason', '<div></div>']
+    ]);
+    
+    var add_reason_btn1 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
+    add_reason_btn1.innerHTML = 'Add';
+    add_reason_btn1.onclick = function(){ e_lost_dialog.add(); }
+    
+    var add_reason_btn2 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
+    add_reason_btn2.innerHTML = 'Cancel';
+    $y(add_reason_btn2,{marginLeft:'4px'});
+    add_reason_btn2.onclick = function(){ e_lost_dialog.hide();}
+    
+    e_lost_dialog.onshow = function() {
+      e_lost_dialog.widgets['Enquiry Lost Reason'].value = '';
+      $i('update_enquiry_dialog_response').innerHTML = '';
+    }
+    
+    e_lost_dialog.add = function() {
+      // sending...
+      $i('update_enquiry_dialog_response').innerHTML = 'Processing...';
+      var arg =  strip(e_lost_dialog.widgets['Enquiry Lost Reason'].value);
+      var call_back = function(r,rt) { 
+        if(r.message == 'true'){
+          $i('update_enquiry_dialog_response').innerHTML = 'Done';
+          e_lost_dialog.hide();
+        }
+      }
+      if(arg) {
+        $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);
+      }
+      else{
+        msgprint("Please add enquiry lost reason");
+      }
+      
+    }
+  }  
+  
+  if(!e_lost_dialog){
+    set_e_lost_dialog();
+  }  
+  e_lost_dialog.show();
+}
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';}
+
+/*
+//===================== Enquiry From validation - either customer or lead is mandatory =====================================
+cur_frm.cscript.enq_frm_validate = function(doc,cdt,cdn){
+  
+  if(doc.enquiry_from == 'Lead'){
+    if(!doc.lead){
+      alert("Lead is mandatory.");  
+      validated = false; 
+    }
+  }
+  else if(doc.enquiry_from == 'Customer'){
+      if(!doc.customer){
+      alert("Customer is mandatory.");
+      validated = false;
+    }
+    else if(!doc.contact_person){
+      alert("Contact Person is mandatory.");
+      validated = false;
+    }
+    else if(!doc.customer_group){
+      alert("Customer Group is mandatory.");
+      validated = false;
+    }
+  } 
+}
+*/
+
+//===================validation function ==============================================================================
+
+cur_frm.cscript.validate = function(doc,cdt,cdn){
+  //cur_frm.cscript.enq_frm_validate(doc,cdt,cdn);
+}
diff --git a/crm/doctype/enquiry/enquiry.py b/crm/doctype/enquiry/enquiry.py
new file mode 100644
index 0000000..61bc4ec
--- /dev/null
+++ b/crm/doctype/enquiry/enquiry.py
@@ -0,0 +1,335 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.fname = 'enq_details'
+    self.tname = 'Enquiry Detail'
+
+  # Autoname
+  # ====================================================================================================================
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.####')
+
+  #--------Get customer address-------
+  # ====================================================================================================================
+  def get_cust_address(self,name):
+    details = sql("select customer_name, address, territory, customer_group from `tabCustomer` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+    if details:
+      ret = {
+        'customer_name':  details and details[0]['customer_name'] or '',
+        'address'  :  details and details[0]['address'] or '',
+        'territory'       :  details and details[0]['territory'] or '',
+        'customer_group'    :  details and details[0]['customer_group'] or ''
+      }
+      # ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
+
+      contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
+
+      
+      ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
+      ret['contact_no']     = contact_det and contact_det[0]['contact_no'] or ''
+      ret['email_id']       = contact_det and contact_det[0]['email_id'] or ''
+    
+      return cstr(ret)
+    else:
+      msgprint("Customer : %s does not exist in system." % (name))
+      raise Exception
+    
+
+  # ====================================================================================================================    
+  def get_contact_details(self, arg):
+    arg = eval(arg)
+    contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s'" %(arg['contact_person'],arg['customer']), as_dict = 1)
+    ret = {
+      'contact_no' : contact and contact[0]['contact_no'] or '',
+      'email_id' : contact and contact[0]['email_id'] or ''
+    }
+    return str(ret)   
+    
+  # ====================================================================================================================
+  def on_update(self):
+    # Add to calendar
+    #if self.doc.contact_date and self.doc.last_contact_date != self.doc.contact_date:
+    if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
+      if self.doc.contact_by:
+        self.add_calendar_event()
+      set(self.doc, 'contact_date_ref',self.doc.contact_date)
+    set(self.doc, 'status', 'Draft')
+  
+  # Add to Calendar
+  # ====================================================================================================================
+  def add_calendar_event(self):
+    desc=''
+    user_lst =[]
+    if self.doc.customer:
+      if self.doc.contact_person:
+        desc = 'Contact '+cstr(self.doc.contact_person)
+      else:
+        desc = 'Contact customer '+cstr(self.doc.customer)
+    elif self.doc.lead:
+      if self.doc.lead_name:
+        desc = 'Contact '+cstr(self.doc.lead_name)
+      else:
+        desc = 'Contact lead '+cstr(self.doc.lead)
+    desc = desc+ '. By : ' + cstr(self.doc.contact_by)
+    
+    if self.doc.to_discuss:
+      desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
+    
+    ev = Document('Event')
+    ev.description = desc
+    ev.event_date = self.doc.contact_date
+    ev.event_hour = '10:00'
+    ev.event_type = 'Private'
+    ev.ref_type = 'Enquiry'
+    ev.ref_name = self.doc.name
+    ev.save(1)
+    
+    user_lst.append(self.doc.owner)
+    
+    chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
+    if chk:
+      user_lst.append(chk[0][0])
+    
+    for d in user_lst:
+      ch = addchild(ev, 'event_individuals', 'Event User', 0)
+      ch.person = d
+      ch.save(1)
+    
+    #user_list = ['Sales Manager', 'Sales User']
+    #for d in user_list:
+    #  ch = addchild(ev, 'event_individuals', 'Event User', 0)
+    #  ch.person = d
+    #  ch.save()
+
+  #--------------Validation For Last Contact Date-----------------
+  # ====================================================================================================================
+  def set_last_contact_date(self):
+    #if not self.doc.contact_date_ref:
+      #self.doc.contact_date_ref=self.doc.contact_date
+      #self.doc.last_contact_date=self.doc.contact_date_ref
+    if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
+      if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
+        self.doc.last_contact_date=self.doc.contact_date_ref
+      else:
+        msgprint("Contact Date Cannot be before Last Contact Date")
+        raise Exception
+      #set(self.doc, 'contact_date_ref',self.doc.contact_date)
+  
+  # check if item present in item table
+  # ====================================================================================================================
+  def validate_item_details(self):
+    if not getlist(self.doclist, 'enquiry_details'):
+      msgprint("Please select items for which enquiry needs to be made")
+      raise Exception
+  
+  #check if enquiry date in the range of fiscal year selected
+  #=====================================================
+  def validate_fiscal_year(self):
+    fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
+    ysd=fy and fy[0][0] or ""
+    yed=add_days(str(ysd),365)
+    if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed):
+      msgprint("Enquiry Date is not within the Fiscal Year selected")
+      raise Exception    
+  
+  def validate(self):
+    self.validate_fiscal_year()
+    self.set_last_contact_date()
+    self.validate_item_details()
+    
+  # On Submit Functions
+  # ====================================================================================================================
+  def on_submit(self):
+    set(self.doc, 'status', 'Submitted')
+    
+  # ====================================================================================================================  
+  def on_cancel(self):
+    chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
+    if chk:
+      msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus can not be cancelled.")
+      raise Exception
+    else:
+      set(self.doc, 'status', 'Cancelled')
+
+    get_obj('Feed Control').make_feed(self.doc, 'cancelled')
+    
+  # declare as enquiry lost
+  #---------------------------
+  def declare_enquiry_lost(self,arg):
+    chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
+    if chk:
+      msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus 'Enquiry Lost' can not be declared against it.")
+      raise Exception
+    else:
+      set(self.doc, 'status', 'Enquiry Lost')
+      set(self.doc, 'order_lost_reason', arg)
+      return cstr('true')
+    
+  # ====================================================================================================================  
+  def update_follow_up(self):
+    
+    sql("delete from `tabFollow up` where parent = '%s'"%self.doc.name);
+    for d in getlist(self.doclist, 'follow_up'):    
+      d.save()
+    self.doc.save()
+    
+    
+  # On Send Email
+  # ====================================================================================================================
+  #def send_emails(self,email,sender,subject,message):
+  #  if email:
+  #    sendmail(email,sender,subject=subject or 'Enquiry',parts=[['text/plain',message or self.get_enq_summary()]])
+
+  # Prepare HTML Table and Enter Enquiry Details in it, which will be added in enq summary
+  # ====================================================================================================================
+  def quote_table(self):
+    if getlist(self.doclist,'enq_details'):
+      header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM']
+      item_tbl = '''<table style="width:90%%; border:1px solid #AAA; border-collapse:collapse"><tr>'''
+      for i in header_lbl:
+        item_header = '''<td style="width=20%%; border:1px solid #AAA; border-collapse:collapse;"><b>%s</b></td>''' % i
+        item_tbl += item_header
+      item_tbl += '''</tr>'''
+      
+      for d in getlist(self.doclist,'enq_details'):
+        item_det = '''
+          <tr><td style="width:20%%; border:1px solid #AAA; border-collpase:collapse">%s</td>
+          <td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
+          <td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
+          <td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
+          <td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td></tr>
+        ''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom)
+        item_tbl += item_det
+      item_tbl += '''</table>'''
+      return item_tbl
+      
+  # Prepare HTML Page containing summary of Enquiry, which will be sent as message in E-mail
+  # ====================================================================================================================
+  def get_enq_summary(self):
+
+    t = """
+        <html><head></head>
+        <body>
+          <div style="border:1px solid #AAA; padding:20px; width:100%%">
+            <div style="text-align:center;font-size:14px"><b>Request For Quotation</b><br></div>
+            <div style="text-align:center;font-size:12px"> %(from_company)s</div>
+            <div style="text-align:center; font-size:10px"> %(company_address)s</div>
+            <div style="border-bottom:1px solid #AAA; padding:10px"></div> 
+            
+            <div style="padding-top:10px"><b>Quotation Details</b></div>
+            <div><table style="width:100%%">
+            <tr><td style="width:40%%">Enquiry No:</td> <td style="width:60%%"> %(name)s</td></tr>
+            <tr><td style="width:40%%">Opening Date:</td> <td style="width:60%%"> %(transaction_date)s</td></tr>
+            <tr><td style="width:40%%">Expected By Date:</td> <td style="width:60%%"> %(expected_date)s</td></tr>
+            </table>
+            </div>
+            
+            <div style="padding-top:10px"><b>Terms and Conditions</b></div>
+            <div> %(terms_and_conditions)s</div>
+            
+            <div style="padding-top:10px"><b>Contact Details</b></div>
+            <div><table style="width:100%%">
+            <tr><td style="width=40%%">Contact Person:</td><td style="width:60%%"> %(contact_person)s</td></tr>
+            <tr><td style="width=40%%">Contact No:</td><td style="width:60%%"> %(contact_no)s</td></tr>
+            <tr><td style="width=40%%">Email:</td><td style="width:60%%"> %(email)s</td></tr>
+            </table></div>
+            """ % (self.doc.fields)
+    
+    t += """<br><div><b>Quotation Items</b><br></div><div style="width:100%%">%s</div>
+            <br>
+To login into the system, use link : <div><a href='http://67.205.111.118/v160/login.html' target='_blank'>http://67.205.111.118/v160/login.html</a></div><br><br>
+            </div>
+          </body>
+          </html>
+          """ % (self.quote_table())
+    return t
+      
+  #-----------------Email-------------------------------------------- 
+  # ====================================================================================================================
+  def send_emails(self, email=[], subject='', message=''):
+    if email:
+      sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user'])
+      if sender_email and sender_email[0][0]:
+        attach_list=[]
+        for at in getlist(self.doclist,'enquiry_attachment_detail'):
+          if at.select_file:
+            attach_list.append(at.select_file)
+        cc_list=[]
+        if self.doc.cc_to:
+          for cl in (self.doc.cc_to.split(',')):
+            if not validate_email_add(cl.strip(' ')):
+              msgprint('error:%s is not a valid email id' % cl.strip(' '))
+              raise Exception
+            cc_list.append(cl.strip(' ')) 
+            sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list)           
+        sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list)
+        #sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
+        msgprint("Mail has been sent")
+        self.add_in_follow_up(message,'Email')
+      else:
+        msgprint("Please enter your mail id in Profile")
+        raise Exception
+  
+  #-------------------------Checking Sent Mails Details----------------------------------------------
+  # ====================================================================================================================
+  def sent_mail(self):
+    if not self.doc.subject or not self.doc.message:
+      msgprint("Please enter subject & message in their respective fields.")
+    elif not self.doc.email_id1:
+      msgprint("Recipient not specified. Please add email id in 'Send To'.")
+      raise Exception
+    else :
+      if not validate_email_add(self.doc.email_id1.strip(' ')):
+        msgprint('error:%s is not a valid email id' % self.doc.email_id1)
+      else:
+        self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
+
+  #---------------------- Add details in follow up table----------------
+  # ====================================================================================================================
+  def add_in_follow_up(self,message,type):
+    import datetime
+    child = addchild( self.doc, 'follow_up', 'Follow up', 1, self.doclist)
+    child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
+    child.notes = message
+    child.follow_up_type = type
+    child.save()
+
+  #-------------------SMS----------------------------------------------
+  # ====================================================================================================================
+  def send_sms(self):
+    if not self.doc.sms_message:
+      msgprint("Please enter message in SMS Section ")
+      raise Exception
+    elif not getlist(self.doclist, 'enquiry_sms_detail'):
+      msgprint("Please mention mobile no. to which sms needs to be sent")
+      raise Exception
+    else:
+      receiver_list = []
+      for d in getlist(self.doclist,'enquiry_sms_detail'):
+        if d.other_mobile_no:
+          receiver_list.append(d.other_mobile_no)
+    
+    if receiver_list:
+      msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
+      self.add_in_follow_up(self.doc.sms_message,'SMS')
diff --git a/crm/doctype/enquiry/enquiry.txt b/crm/doctype/enquiry/enquiry.txt
new file mode 100644
index 0000000..26a5587
--- /dev/null
+++ b/crm/doctype/enquiry/enquiry.txt
@@ -0,0 +1,1529 @@
+[
+	{
+		'_last_update': '1305205067',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-12 18:27:46',
+		'modified_by': 'Guest',
+		'module': 'CRM',
+		'name': 'Enquiry',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status,transaction_date,customer,lead,enquiry_type,territory,company',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 586
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:00',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-09-29 11:08:48',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00219',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:00',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-09-29 11:08:48',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00220',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:00',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-09-29 11:08:48',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00221',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:00',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-09-29 11:08:48',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00222',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:00',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-09-29 11:08:48',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00223',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:00',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-09-29 11:08:48',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00224',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter customer enquiry for which you might raise a quotation in future',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05166',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': 'ENQ',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01222',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'ENQUIRY\nENQ',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'enquiry_from',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Enquiry From',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01224',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'enquiry_from',
+		'oldfieldtype': 'Select',
+		'options': '\nLead\nCustomer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01225',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL05158',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01229',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:02',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL03786',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Lead',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01226',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'lead',
+		'oldfieldtype': 'Link',
+		'options': 'Lead',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_name',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01227',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'lead_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': 0,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL05159',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL05160',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Contact Mobile No',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL05161',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:44',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL05162',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05167',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Enquiry Date',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01232',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'enquiry_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Enquiry Type',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01233',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'enquiry_type',
+		'oldfieldtype': 'Select',
+		'options': 'Sales\nMaintenance',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Status',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01223',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nQuotation Sent\nOrder Confirmed\nEnquiry Lost\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01234',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01235',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To Manage Territory, click here</a>',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01230',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': 'eval:doc.enquiry_from=="Customer"',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 0,
+		'label': 'Customer Group',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01245',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'customer_group',
+		'oldfieldtype': 'Link',
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': 0,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05168',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': "Items which do not exist in Item master can also be entered on customer's request",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'enquiry_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Enquiry Details',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01237',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'enquiry_details',
+		'oldfieldtype': 'Table',
+		'options': 'Enquiry Detail',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': 'Filing in Additional Information about the Enquiry will help you analyze your data better.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05169',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05170',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01242',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01243',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'source',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Source',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01240',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'source',
+		'oldfieldtype': 'Select',
+		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter name of campaign if source of enquiry is campaign',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'campaign',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Campaign',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01241',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'campaign',
+		'oldfieldtype': 'Link',
+		'options': 'Campaign',
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'order_lost_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Order Lost Reason',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01248',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'order_lost_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05171',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your sales person who will contact the customer in future',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_by',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': 1,
+		'label': 'Next Contact By',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01250',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_by',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Person',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '75px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your sales person will get a reminder on this date to contact the customer',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Next Contact Date',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01251',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': 'Date on which the lead was last contacted',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'last_contact_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Last Contact Date',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01252',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'last_contact_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_discuss',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'To Discuss',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01254',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'to_discuss',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:45',
+		'default': None,
+		'depends_on': None,
+		'description': 'Keep a track of communication related to this enquiry which will help for future reference.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Communication History',
+		'modified': '2011-05-25 12:44:45',
+		'modified_by': 'Guest',
+		'name': 'FL05172',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'follow_up',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Follow Up',
+		'modified': '2011-05-25 12:44:44',
+		'modified_by': 'Guest',
+		'name': 'FL01256',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'follow_up',
+		'oldfieldtype': 'Table',
+		'options': 'Follow up',
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Enquiry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/enquiry_attachment_detail/__init__.py b/crm/doctype/enquiry_attachment_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/enquiry_attachment_detail/__init__.py
diff --git a/crm/doctype/enquiry_attachment_detail/enquiry_attachment_detail.txt b/crm/doctype/enquiry_attachment_detail/enquiry_attachment_detail.txt
new file mode 100644
index 0000000..c50339e
--- /dev/null
+++ b/crm/doctype/enquiry_attachment_detail/enquiry_attachment_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-11 11:38:27', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'dhanalekshmi@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Enquiry Attachment Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00530', 'parent': 'Enquiry Attachment Detail', 'read': None, 'create': None, 'creation': '2009-12-11 11:38:27', 'modified': '2010-08-08 11:11:22', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': '', 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'permlevel': None, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-12-11 11:38:27', 'doctype': 'DocField', 'oldfieldname': 'select_file', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Select File For Attachment', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Attachment Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03493', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 11:11:22', 'parenttype': 'DocType', 'fieldname': 'select_file', 'fieldtype': 'Link', 'options': 'File', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/enquiry_detail/__init__.py b/crm/doctype/enquiry_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/enquiry_detail/__init__.py
diff --git a/crm/doctype/enquiry_detail/enquiry_detail.txt b/crm/doctype/enquiry_detail/enquiry_detail.txt
new file mode 100644
index 0000000..01e61ed
--- /dev/null
+++ b/crm/doctype/enquiry_detail/enquiry_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-10-08 14:19:27', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 59, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Enquiry Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-11-24 16:20:41', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03405', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-24 16:20:41', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03406', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-18 14:38:27', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03527', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-06 15:43:58', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03546', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-11-24 16:20:41', 'doctype': 'DocField', 'oldfieldname': 'uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03408', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-23 17:01:00', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04892', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-23 17:01:00', 'doctype': 'DocField', 'oldfieldname': 'brand', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Brand', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04893', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'brand', 'fieldtype': 'Link', 'options': 'Brand', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-05-04 11:20:50', 'doctype': 'DocField', 'oldfieldname': 'basic_rate', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Basic Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Enquiry Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04970', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-01 14:51:49', 'parenttype': 'DocType', 'fieldname': 'basic_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/enquiry_sms_detail/__init__.py b/crm/doctype/enquiry_sms_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/enquiry_sms_detail/__init__.py
diff --git a/crm/doctype/enquiry_sms_detail/enquiry_sms_detail.txt b/crm/doctype/enquiry_sms_detail/enquiry_sms_detail.txt
new file mode 100644
index 0000000..84d0907
--- /dev/null
+++ b/crm/doctype/enquiry_sms_detail/enquiry_sms_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-11 11:45:55', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'dhanalekshmi@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Enquiry SMS Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-11 11:45:55', 'doctype': 'DocField', 'oldfieldname': 'other_mobile_no', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Mobile No', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Enquiry SMS Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03494', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 11:13:11', 'parenttype': 'DocType', 'fieldname': 'other_mobile_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/follow_up/__init__.py b/crm/doctype/follow_up/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/follow_up/__init__.py
diff --git a/crm/doctype/follow_up/follow_up.txt b/crm/doctype/follow_up/follow_up.txt
new file mode 100644
index 0000000..71766bb
--- /dev/null
+++ b/crm/doctype/follow_up/follow_up.txt
@@ -0,0 +1,197 @@
+[
+	{
+		'_last_update': '1303109476',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:02',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-09 15:40:46',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'Follow up',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 9
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:02',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Date',
+		'modified': '2011-05-09 15:40:46',
+		'modified_by': 'Administrator',
+		'name': 'FL01361',
+		'no_copy': None,
+		'oldfieldname': 'date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Follow up',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:02',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'notes',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Notes',
+		'modified': '2011-05-09 15:40:46',
+		'modified_by': 'Administrator',
+		'name': 'FL01362',
+		'no_copy': None,
+		'oldfieldname': 'notes',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Follow up',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:02',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'follow_up_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Follow up type',
+		'modified': '2011-05-09 15:40:46',
+		'modified_by': 'Administrator',
+		'name': 'FL01363',
+		'no_copy': None,
+		'oldfieldname': 'follow_up_type',
+		'oldfieldtype': 'Select',
+		'options': '\nPhone\nEmail\nSMS\nVisit\nOther',
+		'owner': 'Administrator',
+		'parent': 'Follow up',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-12-14 10:32:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'follow_up_by',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Follow up by',
+		'modified': '2011-05-09 15:40:46',
+		'modified_by': 'Administrator',
+		'name': 'FL04147',
+		'no_copy': None,
+		'oldfieldname': 'follow_up_by',
+		'oldfieldtype': 'Link',
+		'options': 'Profile',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Follow up',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/industry_type/__init__.py b/crm/doctype/industry_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/industry_type/__init__.py
diff --git a/crm/doctype/industry_type/industry_type.js b/crm/doctype/industry_type/industry_type.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/crm/doctype/industry_type/industry_type.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/crm/doctype/industry_type/industry_type.txt b/crm/doctype/industry_type/industry_type.txt
new file mode 100644
index 0000000..f7f4245
--- /dev/null
+++ b/crm/doctype/industry_type/industry_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-04 12:28:02', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:industry', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Industry Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00998', 'parent': 'Industry Type', 'read': 1, 'create': 1, 'creation': '2010-05-04 12:28:02', 'modified': '2010-09-20 09:41:52', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00999', 'parent': 'Industry Type', 'read': 1, 'create': None, 'creation': '2010-05-04 12:31:05', 'modified': '2010-09-20 09:41:52', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01000', 'parent': 'Industry Type', 'read': 1, 'create': 1, 'creation': '2010-05-04 12:31:05', 'modified': '2010-09-20 09:41:52', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-04 12:28:02', 'doctype': 'DocField', 'oldfieldname': 'industry', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Industry', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Industry Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04976', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:41:52', 'parenttype': 'DocType', 'fieldname': 'industry', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/installation_note/__init__.py b/crm/doctype/installation_note/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/installation_note/__init__.py
diff --git a/crm/doctype/installation_note/installation_note.js b/crm/doctype/installation_note/installation_note.js
new file mode 100644
index 0000000..3fe7998
--- /dev/null
+++ b/crm/doctype/installation_note/installation_note.js
@@ -0,0 +1,69 @@
+cur_frm.cscript.tname = "Installed Item Details";
+cur_frm.cscript.fname = "installed_item_details";
+
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
+  if(doc.__islocal){
+    set_multiple(dt,dn,{inst_date:get_today()});
+    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);        
+  }
+  if (doc.customer) {
+     unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+  }   
+}
+
+cur_frm.fields_dict['delivery_note_no'].get_query = function(doc) {
+  doc = locals[this.doctype][this.docname];
+  var cond = '';
+  if(doc.customer) {
+    cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND';
+  }
+  return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name  FROM `tabDelivery Note`, `tabDelivery Note Detail` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 100 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+}
+
+
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+  var callback = function(r,rt) { 
+	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	  cur_frm.refresh();
+  }
+  get_server_fields('pull_delivery_note_details','','',doc, dt, dn,1,callback);
+}
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
diff --git a/crm/doctype/installation_note/installation_note.py b/crm/doctype/installation_note/installation_note.py
new file mode 100644
index 0000000..011785e
--- /dev/null
+++ b/crm/doctype/installation_note/installation_note.py
@@ -0,0 +1,209 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.tname = 'Installed Item Details'
+    self.fname = 'installed_item_details'
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+  
+  #fetch customer details
+  #=================================
+  #def get_customer_details(self):
+  #  det = sql("select t1.customer_name, t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = '%s' and t1.name=t2.customer and t2.is_primary_contact = 'Yes'"%self.doc.customer, as_dict=1)
+    
+  #  ret = {
+  #    'customer_name':  det and det[0]['customer_name'] or '',
+  #    'address'  :  det and det[0]['address'] or '',
+  #    'territory':  det and det[0]['territory'] or '',
+  #    'contact_person' : det and det[0]['contact_name'] or ''
+  #  }
+
+  #  return str(ret)
+  
+  #fetch delivery note details
+  #====================================
+  def pull_delivery_note_details(self):
+    self.validate_prev_docname()
+    self.doclist = get_obj('DocType Mapper', 'Delivery Note-Installation Note').dt_map('Delivery Note', 'Installation Note', self.doc.delivery_note_no, self.doc, self.doclist, "[['Delivery Note', 'Installation Note'],['Delivery Note Detail', 'Installed Item Details']]")
+  
+  # Validates that Delivery Note is not pulled twice 
+  #============================================
+  def validate_prev_docname(self):
+    for d in getlist(self.doclist, 'installed_item_details'): 
+      if self.doc.delivery_note_no == d.prevdoc_docname:
+        msgprint(cstr(self.doc.delivery_note_no) + " delivery note details have already been pulled. ")
+        raise Exception, "Validation Error. "
+  
+  #Fiscal Year Validation
+  #================================
+  def validate_fiscal_year(self):
+    get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.inst_date,'Installation Date')
+  
+  #  Validate Mandatory 
+  #===============================
+  def validate_mandatory(self):
+    # Amendment Date
+    if self.doc.amended_from and not self.doc.amendment_date:
+      msgprint("Please Enter Amendment Date")
+      raise Exception, "Validation Error. "
+  
+  # Validate values with reference document
+  #----------------------------------------
+  def validate_reference_value(self):
+    get_obj('DocType Mapper', 'Delivery Note-Installation Note', with_children = 1).validate_reference_value(self, self.doc.name)
+  
+  #check if serial no added
+  #-----------------------------
+  def is_serial_no_added(self,item_code,serial_no):
+    ar_required = sql("select has_serial_no from tabItem where name = '%s'" % item_code)
+    ar_required = ar_required and ar_required[0][0] or ''
+    if ar_required == 'Yes' and not serial_no:
+      msgprint("Serial No is mandatory for item: "+ item_code)
+      raise Exception
+    elif ar_required != 'Yes' and cstr(serial_no).strip():
+      msgprint("If serial no required, please select 'Yes' in 'Has Serial No' in Item :"+item_code)
+      raise Exception
+  
+  #check if serial no exist in system
+  #-------------------------------------
+  def is_serial_no_exist(self, item_code, serial_no):
+    for x in serial_no:
+      chk = sql("select name from `tabSerial No` where name =%s", x)
+      if not chk:
+        msgprint("Serial No "+x+" does not exist in the system")
+        raise Exception
+  
+  #check if serial no already installed
+  #------------------------------------------
+  def is_serial_no_installed(self,cur_s_no,item_code):
+    for x in cur_s_no:
+      status = sql("select status from `tabSerial No` where name = %s", x)
+      status = status and status[0][0] or ''
+      
+      if status == 'Installed':
+        msgprint("Item "+item_code+" with serial no. "+x+" already installed")
+        raise Exception, "Validation Error."
+  
+  #get list of serial no from previous_doc
+  #----------------------------------------------
+  def get_prevdoc_serial_no(self, prevdoc_detail_docname, prevdoc_docname):
+    from material_management.doctype.stock_ledger.stock_ledger import get_sr_no_list
+	
+    res = sql("select serial_no from `tabDelivery Note Detail` where name = '%s' and parent ='%s'" % (prevdoc_detail_docname, prevdoc_docname))
+    return get_sr_no_list(res[0][0])
+    
+  #check if all serial nos from current record exist in resp delivery note
+  #---------------------------------------------------------------------------------
+  def is_serial_no_match(self, cur_s_no, prevdoc_s_no, prevdoc_docname):
+    for x in cur_s_no:
+      if not(x in prevdoc_s_no):
+        msgprint("Serial No. "+x+" not present in the Delivery Note "+prevdoc_docname, raise_exception = 1)
+        raise Exception, "Validation Error."
+  
+  #validate serial number
+  #----------------------------------------
+  def validate_serial_no(self):
+    cur_s_no, prevdoc_s_no, sr_list = [], [], []
+    from material_management.doctype.stock_ledger.stock_ledger import get_sr_no_list
+    
+    for d in getlist(self.doclist, 'installed_item_details'):
+      self.is_serial_no_added(d.item_code, d.serial_no)
+      
+      if d.serial_no:
+
+        sr_list = get_sr_no_list(d.serial_no, d.qty)
+        self.is_serial_no_exist(d.item_code, sr_list)
+        
+        prevdoc_s_no = self.get_prevdoc_serial_no(d.prevdoc_detail_docname, d.prevdoc_docname)
+        if prevdoc_s_no:
+          self.is_serial_no_match(sr_list, prevdoc_s_no, d.prevdoc_docname)
+        
+        self.is_serial_no_installed(sr_list, d.item_code)
+    return sr_list
+  
+  #validate installation date
+  #-------------------------------
+  def validate_installation_date(self):
+    for d in getlist(self.doclist, 'installed_item_details'):
+      if d.prevdoc_docname:
+        d_date = sql("select posting_date from `tabDelivery Note` where name=%s", d.prevdoc_docname)
+        d_date = d_date and d_date[0][0] or ''
+        
+        if d_date > getdate(self.doc.inst_date):
+          msgprint("Installation Date can not be before Delivery Date "+cstr(d_date)+" for item "+d.item_code)
+          raise Exception
+  
+  def validate(self):
+    self.validate_fiscal_year()
+    self.validate_installation_date()
+    self.check_item_table()
+    sales_com_obj = get_obj(dt = 'Sales Common')
+    sales_com_obj.check_active_sales_items(self)
+    sales_com_obj.get_prevdoc_date(self)
+    self.validate_mandatory()
+    self.validate_reference_value()
+  
+  def check_item_table(self):
+    if not(getlist(self.doclist, 'installed_item_details')):
+      msgprint("Please fetch items from Delivery Note selected")
+      raise Exception
+  
+  def on_update(self):
+    set(self.doc, 'status', 'Draft')
+  
+  def on_submit(self):
+    valid_lst = []
+    valid_lst = self.validate_serial_no()
+    
+    get_obj("Sales Common").update_prevdoc_detail(1,self)
+    
+    for x in valid_lst:
+      wp = sql("select warranty_period from `tabSerial No` where name = '%s'"% x)
+      wp = wp and wp[0][0] or 0
+      if wp:
+        sql("update `tabSerial No` set maintenance_status = 'Under Warranty' where name = '%s'" % x)
+      
+      sql("update `tabSerial No` set status = 'Installed' where name = '%s'" % x)
+    
+    set(self.doc, 'status', 'Submitted')
+
+  
+  def on_cancel(self):
+    cur_s_no = []
+    sales_com_obj = get_obj(dt = 'Sales Common')
+    sales_com_obj.update_prevdoc_detail(0,self)
+    
+    for d in getlist(self.doclist, 'installed_item_details'):
+      if d.serial_no:
+        #get current list of serial no
+        cur_serial_no = d.serial_no.replace(' ', '')
+        cur_s_no = cur_serial_no.split(',')
+    
+    for x in cur_s_no:
+      sql("update `tabSerial No` set status = 'Delivered' where name = '%s'" % x)
+      
+    set(self.doc, 'status', 'Cancelled')
diff --git a/crm/doctype/installation_note/installation_note.txt b/crm/doctype/installation_note/installation_note.txt
new file mode 100644
index 0000000..4b4fc41
--- /dev/null
+++ b/crm/doctype/installation_note/installation_note.txt
@@ -0,0 +1,1205 @@
+[
+	{
+		'_last_update': '1305630270',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'IN/.####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 16:34:30',
+		'modified_by': 'Guest',
+		'module': 'CRM',
+		'name': 'Installation Note',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'At %(customer_name)s on %(inst_date)s',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 96
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00265',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00266',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00267',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00268',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00269',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00270',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Installation Note',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05181',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05182',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-12 15:19:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:44:47',
+		'modified_by': 'Guest',
+		'name': 'FL03978',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': '\nIN',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:02',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL03787',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05174',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01525',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01523',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05175',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05176',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05177',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05178',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01526',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Customer Group',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05179',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05183',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'inst_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Installation Date',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01533',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'inst_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'inst_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Installation Time',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01534',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'inst_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Status',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01532',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': 'Draft\nSubmitted\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01535',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Select',
+		'options': 'link:Company',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01536',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01529',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01530',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01537',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01538',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Item Details',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL05184',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Delivery Note No',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01527',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'delivery_note_no',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2010-09-17 12:05:21',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'FL01528',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'pull_delivery_note_details',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-19 14:05:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': '000002566',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'pull_delivery_note_details',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'installed_item_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Installed Item Details',
+		'modified': '2011-05-25 12:44:48',
+		'modified_by': 'Guest',
+		'name': 'FL01540',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'installed_item_details',
+		'oldfieldtype': 'Table',
+		'options': 'Installed Item Details',
+		'owner': 'Administrator',
+		'parent': 'Installation Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/installed_item_details/__init__.py b/crm/doctype/installed_item_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/installed_item_details/__init__.py
diff --git a/crm/doctype/installed_item_details/installed_item_details.txt b/crm/doctype/installed_item_details/installed_item_details.txt
new file mode 100644
index 0000000..ea67565
--- /dev/null
+++ b/crm/doctype/installed_item_details/installed_item_details.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-30 07:28:32', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 24, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'IID/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Installed Item Details', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-30 07:28:32', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Installed Item Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05484', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-06-30 07:28:32', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Installed Item Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05485', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-06-30 12:51:00', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 0, 'modified_by': 'Administrator', 'label': 'Delivery Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'Installed Item Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05502', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-30 07:28:32', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Installed Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Installed Item Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05487', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-06-30 07:28:32', 'doctype': 'DocField', 'oldfieldname': 'serial_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Serial No', 'width': '180px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Installed Item Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05488', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'serial_no', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-06-30 07:28:32', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_detail_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Against Document Detail No', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Installed Item Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05489', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-06-30 12:35:29', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Against Document No', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Installed Item Details', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05499', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-06-30 12:35:29', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_doctype', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Document Type', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Installed Item Details', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05500', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-07-07 11:00:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/lead/__init__.py b/crm/doctype/lead/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/lead/__init__.py
diff --git a/crm/doctype/lead/lead.comp.js b/crm/doctype/lead/lead.comp.js
new file mode 100644
index 0000000..e960c44
--- /dev/null
+++ b/crm/doctype/lead/lead.comp.js
@@ -0,0 +1,18 @@
+
+$import(SMS Control)
+cur_frm.cscript.onload=function(doc,cdt,cdn){if(user=='Guest'){hide_field(['status','naming_series','order_lost_reason','customer','rating','fax','website','territory','TerritoryHelp','address_line1','address_line2','city','state','country','pincode','address','lead_owner','market_segment','industry','campaign_name','interested_in','company','fiscal_year','contact_by','contact_date','last_contact_date','contact_date_ref','to_discuss','More Info','follow_up','Communication History','cc_to','subject','message','Attachment Html','Create New File','lead_attachment_detail','Send Email','Email','Create Customer','Create Enquiry','Next Steps','transaction_date','type','source']);doc.source='Website';}
+if(!doc.status)set_multiple(dt,dn,{status:'Open'});if(!doc.date){doc.date=date.obj_to_str(new Date());}
+if(user=='Guest')doc.naming_series='WebLead';cur_frm.add_fetch('customer','customer_name','company_name');}
+cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons()
+if(!doc.__islocal&&!in_list(['Converted','Lead Lost'],doc.status)){cur_frm.add_custom_button('Create Customer',cur_frm.cscript['Create Customer']);cur_frm.add_custom_button('Create Enquiry',cur_frm.cscript['Create Enquiry']);cur_frm.add_custom_button('Send SMS',cur_frm.cscript['Send SMS']);}}
+cur_frm.cscript.status=function(doc,cdt,cdn){cur_frm.cscript.refresh(doc,cdt,cdn);}
+cur_frm.cscript.TerritoryHelp=function(doc,dt,dn){var call_back=function(){var sb_obj=new SalesBrowser();sb_obj.set_val('Territory');}
+loadpage('Sales Browser',call_back);}
+cur_frm.cscript['Create New File']=function(doc){new_doc("File");}
+cur_frm.cscript.item_code=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.item_code){get_server_fields('get_item_detail',d.item_code,'lead_item_detail',doc,cdt,cdn,1);}}
+cur_frm.cscript['Create Customer']=function(){var doc=cur_frm.doc;$c('runserverobj',args={'method':'check_status','docs':compress_doclist([doc])},function(r,rt){if(r.message=='Converted'){msgprint("This lead is already converted to customer");}
+else{n=createLocal("Customer");$c('dt_map',args={'docs':compress_doclist([locals["Customer"][n]]),'from_doctype':'Lead','to_doctype':'Customer','from_docname':doc.name,'from_to_list':"[['Lead', 'Customer']]"},function(r,rt){loaddoc("Customer",n);});}});}
+cur_frm.cscript['Send Email']=function(doc,cdt,cdn){if(doc.__islocal!=1){$c_obj(make_doclist(doc.doctype,doc.name),'send_mail','',function(r,rt){});}else{msgprint("Please save lead first before sending email")}}
+cur_frm.cscript['Create Enquiry']=function(){var doc=cur_frm.doc;$c('runserverobj',args={'method':'check_status','docs':compress_doclist([doc])},function(r,rt){if(r.message=='Converted'){msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");}
+else{n=createLocal("Enquiry");$c('dt_map',args={'docs':compress_doclist([locals["Enquiry"][n]]),'from_doctype':'Lead','to_doctype':'Enquiry','from_docname':doc.name,'from_to_list':"[['Lead', 'Enquiry']]"},function(r,rt){loaddoc("Enquiry",n);});}});}
+cur_frm.fields_dict['territory'].get_query=function(doc,cdt,cdn){return'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';}
\ No newline at end of file
diff --git a/crm/doctype/lead/lead.js b/crm/doctype/lead/lead.js
new file mode 100644
index 0000000..888c030
--- /dev/null
+++ b/crm/doctype/lead/lead.js
@@ -0,0 +1,147 @@
+// Module CRM
+
+$import(SMS Control)
+
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  if(user =='Guest'){
+    hide_field(['status', 'naming_series', 'order_lost_reason', 'customer', 'rating', 'fax', 'website', 'territory', 'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state', 'country', 'pincode', 'address', 'lead_owner', 'market_segment', 'industry', 'campaign_name', 'interested_in', 'company', 'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date', 'contact_date_ref', 'to_discuss', 'More Info', 'follow_up', 'Communication History', 'cc_to', 'subject', 'message', 'Attachment Html', 'Create New File', 'lead_attachment_detail', 'Send Email', 'Email', 'Create Customer', 'Create Enquiry', 'Next Steps', 'transaction_date', 'type', 'source']);
+    doc.source = 'Website';
+  }
+  if(!doc.status) set_multiple(dt,dn,{status:'Open'});
+
+  if (!doc.date){ 
+    doc.date = date.obj_to_str(new Date());
+  }
+  // set naming series
+  if(user=='Guest') doc.naming_series = 'WebLead';
+  
+  cur_frm.add_fetch('customer', 'customer_name', 'company_name');	
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  // custom buttons
+  //---------------
+  cur_frm.clear_custom_buttons()
+  if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
+    cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
+    cur_frm.add_custom_button('Create Enquiry', cur_frm.cscript['Create Enquiry']);
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+  }
+}
+
+
+// Client Side Triggers
+// ===========================================================
+// ************ Status ******************
+cur_frm.cscript.status = function(doc, cdt, cdn){
+  cur_frm.cscript.refresh(doc, cdt, cdn);
+}
+
+/*
+// *********** Country ******************
+// This will show states belonging to country
+cur_frm.cscript.country = function(doc, cdt, cdn) {
+  var mydoc=doc;
+  $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
+    function(r,rt){
+      if(r.message) {
+        var doc = locals[mydoc.doctype][mydoc.name];
+        doc.state = '';
+        get_field(doc.doctype, 'state' , doc.name).options = r.message;
+        refresh_field('state');
+      }
+    }
+  );
+}
+*/
+
+cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
+  var call_back = function(){
+    var sb_obj = new SalesBrowser();        
+    sb_obj.set_val('Territory');
+  }
+
+  loadpage('Sales Browser',call_back);
+}
+
+// Create New File
+// ===============================================================
+cur_frm.cscript['Create New File'] = function(doc){
+  new_doc("File");
+}
+
+//Trigger in Item Table
+//===================================
+cur_frm.cscript.item_code=function(doc,cdt,cdn){
+  var d = locals[cdt][cdn];
+  if (d.item_code) { get_server_fields('get_item_detail',d.item_code,'lead_item_detail',doc,cdt,cdn,1);}
+}
+
+// Create New Customer
+// ===============================================================
+cur_frm.cscript['Create Customer'] = function(){
+  var doc = cur_frm.doc;
+  $c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
+    function(r,rt){
+      if(r.message == 'Converted'){
+        msgprint("This lead is already converted to customer");
+      }
+      else{
+        n = createLocal("Customer");
+        $c('dt_map', args={
+          'docs':compress_doclist([locals["Customer"][n]]),
+          'from_doctype':'Lead',
+          'to_doctype':'Customer',
+          'from_docname':doc.name,
+          'from_to_list':"[['Lead', 'Customer']]"
+        }, 
+        function(r,rt) {
+          loaddoc("Customer", n);
+        }
+        );
+      }
+    }
+  );
+}
+
+// send email
+// ===============================================================
+cur_frm.cscript['Send Email'] = function(doc,cdt,cdn){
+  if(doc.__islocal != 1){
+    $c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
+  }else{
+    msgprint("Please save lead first before sending email")
+  }
+}
+
+// Create New Enquiry
+// ===============================================================
+cur_frm.cscript['Create Enquiry'] = function(){
+  var doc = cur_frm.doc;
+  $c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
+    function(r,rt){
+      if(r.message == 'Converted'){
+        msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
+      }
+      else{
+        n = createLocal("Enquiry");
+        $c('dt_map', args={
+          'docs':compress_doclist([locals["Enquiry"][n]]),
+          'from_doctype':'Lead',
+          'to_doctype':'Enquiry',
+          'from_docname':doc.name,
+          'from_to_list':"[['Lead', 'Enquiry']]"
+        }
+        , function(r,rt) {
+            loaddoc("Enquiry", n);
+          }
+        );
+      }
+    }
+  );
+}
+
+//get query select Territory
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
diff --git a/crm/doctype/lead/lead.py b/crm/doctype/lead/lead.py
new file mode 100644
index 0000000..1bf8c8d
--- /dev/null
+++ b/crm/doctype/lead/lead.py
@@ -0,0 +1,212 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+  
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+  
+  #check status of lead
+  #------------------------
+  def check_status(self):
+    chk = sql("select status from `tabLead` where name=%s", self.doc.name)
+    chk = chk and chk[0][0] or ''
+    return cstr(chk)
+
+  # Gets states belonging cto country selected
+  # =====================================================================
+  #def check_state(self):
+  #  return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
+  
+  # Get item detail (will be removed later)
+  #=======================================
+  def get_item_detail(self,item_code):
+    it=sql("select item_name,brand,item_group,description,stock_uom from `tabItem` where name='%s'"%item_code)
+    if it:
+      ret = {
+      'item_name'  : it and it[0][0] or '',
+      'brand'      : it and it[0][1] or '',
+      'item_group' : it and it[0][2] or '',
+      'description': it and it[0][3] or '',
+      'uom' : it and it[0][4] or ''
+      }
+      return cstr(ret)
+  
+  def validate(self):
+    import string
+    # Get Address
+    # ======================================================================
+    #if (self.doc.address_line1) or (self.doc.address_line2) or (self.doc.city) or (self.doc.state) or (self.doc.country) or (self.doc.pincode):
+    #  address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
+    #  comp_address=''
+    #  for d in address:
+    #    if self.doc.fields[d]:
+    #      comp_address += self.doc.fields[d] + "\n"
+    #  if self.doc.website:
+    #    comp_address += "Website : "+ self.doc.website
+    #  self.doc.address = comp_address
+    
+    if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
+      msgprint("Please Enter Order Lost Reason")
+      raise Exception  
+    
+    if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
+      msgprint("Please specify campaign name")
+      raise Exception
+    
+    if self.doc.email_id:
+      if not validate_email_add(self.doc.email_id):
+        msgprint('Please enter valid email id.')
+        raise Exception
+    
+    if not self.doc.naming_series:
+      if session['user'] == 'Guest':
+        so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
+        #so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
+        if so:
+          sr = so[0][0].split("\n")
+          set(self.doc, 'naming_series', sr[0])
+      else:
+        msgprint("Please specify naming series")
+        raise Exception  
+  
+  def on_update(self):
+    # Add to calendar
+    # ========================================================================
+    if self.doc.contact_by:
+      self.add_calendar_event()
+    
+    if session['user'] == 'Guest':
+      if self.doc.email_id:
+        self.send_email_notification()
+    
+    if not self.doc.naming_series:
+      if session['user'] == 'Guest':
+        #so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
+        so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
+        if so:
+          sr = so[0][0].split("\n")
+          set(self.doc, 'naming_series', sr[0])
+      else:
+        msgprint("Please specify naming series")
+        raise Exception
+  
+  def send_email_notification(self):
+    if not validate_email_add(self.doc.email_id.strip(' ')):
+      msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
+      raise Exception
+    else:
+      subject = 'Thank you for interest in erpnext'
+       
+      sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
+      #sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
+      msgprint("Mail Sent")
+  
+  def get_notification_msg(self):
+    t = """
+<html>
+<body>
+Dear %s,<br><br>
+
+Thank you for contacting us.<br><br>
+
+You have left following message for us,<br>
+%s
+<br><br>
+
+You will receive reply on this shortly.<br><br>
+
+Cheers!
+</body>
+</html>
+""" % (self.doc.lead_name, self.doc.remark)
+
+    return t
+
+  # Add to Calendar
+  # ===========================================================================
+  def add_calendar_event(self):
+    # delete any earlier event by this lead
+    sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name)
+  
+    in_calendar_of = self.doc.lead_owner
+    
+    # get profile (id) if exists for contact_by
+    email_id = webnotes.conn.get_value('Sales Person', self.doc.contact_by, 'email_id')
+    if webnotes.conn.exists('Profile', email_id):
+      in_calendar_of = email_id
+    
+    ev = Document('Event')
+    ev.owner = in_calendar_of
+    ev.description = 'Contact ' + cstr(self.doc.lead_name) + '.By : ' + cstr(self.doc.contact_by) + '.To Discuss : ' + cstr(self.doc.to_discuss)
+    ev.event_date = self.doc.contact_date
+    ev.event_hour = '10:00'
+    ev.event_type = 'Private'
+    ev.ref_type = 'Lead'
+    ev.ref_name = self.doc.name
+    ev.save(1)
+
+
+#-----------------Email-------------------------------------------- 
+  def send_emails(self, email=[], subject='', message=''):
+    if email:
+      sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]])
+      msgprint("Mail Sent")
+      self.add_in_follow_up(message,'Email')
+
+#-------------------------Checking Sent Mails Details----------------------------------------------        
+  def send_mail(self):
+    if not self.doc.subject or not self.doc.message:
+      msgprint("Please enter subject & message in their respective fields.")
+    elif not self.doc.email_id:
+      msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.")
+      raise Exception
+    else :
+     self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
+
+#---------------------- Add details in follow up table----------------
+  def add_in_follow_up(self,message,type):
+    import datetime
+    child = addchild( self.doc, 'follow_up', 'Follow up', 1, self.doclist)
+    child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
+    child.notes = message
+    child.follow_up_type = type
+    child.save()
+
+#-------------------SMS----------------------------------------------
+  def send_sms(self):
+    if not self.doc.sms_message or not self.doc.mobile_no:
+      msgprint("Please enter mobile number in Basic Info Section and message in SMS Section ")
+      raise Exception
+    else:
+      receiver_list = []
+      if self.doc.mobile_no:
+        receiver_list.append(self.doc.mobile_no)
+      for d in getlist(self.doclist,'lead_sms_detail'):
+        if d.other_mobile_no:
+          receiver_list.append(d.other_mobile_no)
+    
+    if receiver_list:
+      msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
+      self.add_in_follow_up(self.doc.sms_message,'SMS')
diff --git a/crm/doctype/lead/lead.txt b/crm/doctype/lead/lead.txt
new file mode 100644
index 0000000..6c77978
--- /dev/null
+++ b/crm/doctype/lead/lead.txt
@@ -0,0 +1,1840 @@
+[
+	{
+		'_last_update': '1305009922',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-10 12:15:21',
+		'modified_by': 'Guest',
+		'module': 'CRM',
+		'name': 'Lead',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'lead_name,lead_owner,status',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(lead_name)s from %(company_name)s | To Discuss: %(to_discuss)s',
+		'tag_fields': 'status,source',
+		'use_template': None,
+		'version': 394
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00314',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00315',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00316',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00317',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00318',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00319',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-10-07 12:49:37',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2010-10-19 11:33:05',
+		'modified_by': 'ashwini@webnotestech.com',
+		'name': 'PERM00707',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Guest',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05191',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05192',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Contact Name',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01766',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'lead_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'source',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Source',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01768',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'source',
+		'oldfieldtype': 'Select',
+		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWebsite",
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': "eval:doc.source == 'Existing Customer'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'From Customer',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01769',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': "eval:doc.source == 'Campaign'",
+		'description': 'Enter campaign name if the source of lead is campaign.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'campaign_name',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Campaign Name',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01793',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'campaign_name',
+		'oldfieldtype': 'Link',
+		'options': 'Campaign',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'Name of organization from where lead has come',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Company Name',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01770',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': 'LEAD',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01763',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'LEAD\nLEAD/10-11/\nLEAD/MUMBAI/\nLEAD/AGENT1/\nLEAD/AGENT2/',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': 'Open',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01764',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nOpen\nAttempted to Contact\nContact in Future\nContacted\nInterested\nNot interested\nLead Lost\nConverted',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 1,
+		'label': 'Lead Date',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01767',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05193',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Lead Type',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01771',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'type',
+		'oldfieldtype': 'Select',
+		'options': '\nClient\nChannel Partner\nConsultant',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-07 12:51:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'request_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Request Type',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL03976',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'request_type',
+		'oldfieldtype': 'Select',
+		'options': '\nProduct Enquiry\nRequest for Information\nSuggestions\nOther',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'Probability of lead converting to customer',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rating',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Rating',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01772',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rating',
+		'oldfieldtype': 'Select',
+		'options': '\nHot\nWarm\nCold',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remark',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Remark',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01773',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'remark',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': "eval:doc.status == 'Lead Lost'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'order_lost_reason',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Lost Reason',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01765',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'order_lost_reason',
+		'oldfieldtype': 'Link',
+		'options': 'Order Lost Reason',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-19 13:01:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL04091',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Contact Info',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05194',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'phone',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Phone',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL05187',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mobile_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Mobile No.',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01776',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'mobile_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Email Id',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01777',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'email_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fax',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Fax',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01778',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fax',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'website',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Website',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01779',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'website',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01780',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05195',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_line1',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Address Line 1',
+		'modified': '2011-05-25 12:44:50',
+		'modified_by': 'Guest',
+		'name': 'FL01782',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'address_line1',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_line2',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Address Line 2',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01783',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'address_line2',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'city',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'City',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01784',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'city',
+		'oldfieldtype': 'Select',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'country',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Country',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01785',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'country',
+		'oldfieldtype': 'Select',
+		'options': 'link:Country',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'state',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'State',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01786',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'state',
+		'oldfieldtype': 'Select',
+		'options': 'link:State',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pincode',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Pin Code',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01787',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'pincode',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05196',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01795',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': '__user',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_owner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': 1,
+		'label': 'Lead Owner',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01790',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'lead_owner',
+		'oldfieldtype': 'Link',
+		'options': 'Profile',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'market_segment',
+		'fieldtype': 'Select',
+		'hidden': 0,
+		'icon': None,
+		'idx': 35,
+		'in_filter': 1,
+		'label': 'Market Segment',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01791',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'market_segment',
+		'oldfieldtype': 'Select',
+		'options': '\nLower Income\nMiddle Income\nUpper Income',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'industry',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Industry',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01792',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'industry',
+		'oldfieldtype': 'Link',
+		'options': 'Industry Type',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your products or facilities in which the lead is interested',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'interested_in',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Interested In',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01794',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'interested_in',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 38,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01796',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05197',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your sales person who will contact the lead in future',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_by',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 40,
+		'in_filter': 1,
+		'label': 'Next Contact By',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01798',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_by',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Person',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your sales person will get a reminder on this date to contact the lead',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': 1,
+		'label': 'Next Contact Date',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01799',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'contact_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': 'Date on which the lead was last contacted',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'last_contact_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Last Contact Date',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05190',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'last_contact_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_discuss',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'To Discuss',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01802',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'to_discuss',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:51',
+		'default': None,
+		'depends_on': None,
+		'description': 'Keep a track of communication with this lead which will help for future reference.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Communication History',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL05198',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'follow_up',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Follow up',
+		'modified': '2011-05-25 12:44:51',
+		'modified_by': 'Guest',
+		'name': 'FL01804',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'follow_up',
+		'oldfieldtype': 'Table',
+		'options': 'Follow up',
+		'owner': 'Administrator',
+		'parent': 'Lead',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/lead_attachment_detail/__init__.py b/crm/doctype/lead_attachment_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/lead_attachment_detail/__init__.py
diff --git a/crm/doctype/lead_attachment_detail/lead_attachment_detail.txt b/crm/doctype/lead_attachment_detail/lead_attachment_detail.txt
new file mode 100644
index 0000000..85f086c
--- /dev/null
+++ b/crm/doctype/lead_attachment_detail/lead_attachment_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-10-06 12:12:21', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Lead Attachment Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-10-06 12:12:21', 'doctype': 'DocField', 'oldfieldname': 'select_file', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select File For Attachment', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Lead Attachment Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03137', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-10-06 12:35:51', 'parenttype': 'DocType', 'fieldname': 'select_file', 'fieldtype': 'Link', 'options': 'File', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/lead_item_detail/__init__.py b/crm/doctype/lead_item_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/lead_item_detail/__init__.py
diff --git a/crm/doctype/lead_item_detail/lead_item_detail.txt b/crm/doctype/lead_item_detail/lead_item_detail.txt
new file mode 100644
index 0000000..2f83a9f
--- /dev/null
+++ b/crm/doctype/lead_item_detail/lead_item_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-30 15:38:55', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'swarnalata@webnotestech.com', 'document_type': None, 'name': 'Lead Item Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-30 15:38:55', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Item Code', 'width': '200px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01565', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-19 11:15:06', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02098', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-07-08 11:17:32', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02551', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-07-08 11:17:32', 'doctype': 'DocField', 'oldfieldname': 'brand', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Brand', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02552', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'brand', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-30 15:38:55', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Description', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01566', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 15:38:55', 'doctype': 'DocField', 'oldfieldname': 'uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01567', 'idx': 6, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-30 15:38:55', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 0, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Qty', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01568', 'idx': 7, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-30 15:38:55', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Rate', 'width': '100px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01569', 'idx': 8, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Read Only', 'creation': '2009-03-30 15:38:55', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'swarnalata@webnotestech.com', 'label': 'Amount', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Lead Item Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01570', 'idx': 9, 'default': None, 'colour': None, 'modified': '2009-10-09 15:32:48', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Read Only', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/lead_sms_detail/__init__.py b/crm/doctype/lead_sms_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/lead_sms_detail/__init__.py
diff --git a/crm/doctype/lead_sms_detail/lead_sms_detail.txt b/crm/doctype/lead_sms_detail/lead_sms_detail.txt
new file mode 100644
index 0000000..aeb93cb
--- /dev/null
+++ b/crm/doctype/lead_sms_detail/lead_sms_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-10-06 12:10:26', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Lead SMS Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-10-06 12:10:26', 'doctype': 'DocField', 'oldfieldname': 'other_mobile_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Mobile No', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Lead SMS Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03136', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-10-06 17:26:45', 'parenttype': 'DocType', 'fieldname': 'other_mobile_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/plot_control/__init__.py b/crm/doctype/plot_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/plot_control/__init__.py
diff --git a/crm/doctype/plot_control/plot_control.py b/crm/doctype/plot_control/plot_control.py
new file mode 100644
index 0000000..d403053
--- /dev/null
+++ b/crm/doctype/plot_control/plot_control.py
@@ -0,0 +1,229 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist = []):
+    self.doc ,self.doclist = doc, doclist
+
+  #============================get monthly sales====================================================  
+  def get_monthwise_amount(self,lst):
+    lst = lst.split(',')
+    if not lst[1]:
+      ret = convert_to_lists(sql("SELECT SUM(grand_total) AMOUNT,CASE MONTH(due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME FROM `tabReceivable Voucher` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY MONTH(due_date) ORDER BY MONTH(due_date)"%lst[0]))
+    else:
+      ret = convert_to_lists(sql("select sum(t2.amount) AMOUNT ,CASE MONTH(t1.due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME from `tabReceivable Voucher` t1,`tabRV Detail` t2 WHERE t1.name = t2.parent and t1.docstatus = 1 and t2.item_group = '%s' AND t1.fiscal_year = '%s' GROUP BY MONTH(t1.due_date) ORDER BY MONTH(t1.due_date)"%(lst[1],lst[0])))
+    
+    m =cint(sql("select month('%s')"%(get_defaults()['year_start_date']))[0][0])
+
+    lst1 = [[1,'JAN'],[2 ,'FEB'], [3,'MAR'],[4,'APR'],[5,'MAY'],[6,'JUN'],[7,'JUL'],[8,'AUG'],[9,'SEP'],[10,'OCT'],[11,'NOV'],[12,'DEC']]
+    lst2=[]
+    k=1
+
+    for i in range(1,13):
+      for j in lst1:
+        if j[0]==m:
+          lst2.append([k,j[1]])
+      m +=1
+      if m==13: m=1
+      k +=1
+    return {'msg_data':ret,'x_axis':lst2}
+
+  #===============================get weekly sales=================================================
+  def get_weekwise_amount(self,lst):
+   
+    lst = lst.split(',')
+    
+    cases = self.get_week_cases(lst[0],lst[1])
+          
+    if not lst[2]:
+      query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+ cases +"END Weekly FROM `tabReceivable Voucher` WHERE MONTH(due_date) = %d AND docstatus = 1 AND fiscal_year = '%s' GROUP BY Weekly  ORDER BY Weekly"
+      
+      ret = convert_to_lists(sql(query%(cint(lst[0]),lst[1])))
+    
+    else:
+          
+      query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly FROM `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE MONTH(t1.due_date) = %d AND t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly  ORDER BY Weekly"
+      
+      ret =convert_to_lists(sql(query%(cint(lst[0]),lst[1],lst[2])))
+ 
+    return ret and ret or ''
+  #================================================================================
+  def get_week_cases(self,m1,fy):
+    d1 = self.make_date("%s,%s"%(cstr(m1),fy))
+     
+    w = sql("select week('%s'),week(last_day('%s'))"%(d1,d1))
+    w1 = cint(w[0][0]) 
+    w2 = cint(w[0][1])
+   
+    w3 = []
+    str1 = " "
+    for i in range(1,7):
+      if(w1 <= w2):
+        w3.append(w1)
+        str1 += "WHEN "+ cstr(w1) +" THEN 'Week"+cstr(i) +"' "
+        w1 += 1
+    
+    return str1
+      
+  #===============================get yearly weekwise sales=================================================
+  def get_year_weekwise_amount(self,lst):
+    
+    lst = lst.split(',')
+    yr_st = get_defaults()['year_start_date']
+    
+    fy = lst[0]
+    m1 = cint(yr_st.split('-')[1])
+
+    cases = ' '
+    for i in range(1,13):
+      cases += self.get_week_cases(m1,fy)
+      m1 +=1
+      if(m1 == 13): m1 = 1 
+    
+    if not lst[1]:
+      query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+cases+"END Weekly, month(due_date) month FROM `tabReceivable Voucher` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY `month`,weekly ORDER BY `month`,weekly"
+      ret = convert_to_lists(sql(query%lst[0]))
+    
+    else:
+    
+      query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly, month(due_date) month FROM `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly  ORDER BY Weekly"
+      ret = convert_to_lists(sql(query%(lst[0],lst[1])))
+      
+    
+    return ret and ret or ''
+  
+
+  #====================================make yearly weekwise dates================================================
+  def yr_wk_dates(self,fy):
+    
+    from datetime import date
+    yr_st = get_defaults()['year_start_date']
+    yr_en = get_defaults()['year_end_date']
+    
+    fy = fy.split('-')
+    y1 = yr_st.split('-')
+    date1 = date(cint(fy[0]),cint(y1[1]),cint(y1[2]))
+    
+    y2 = yr_en.split('-')
+    date2 = date(cint(fy[1]),cint(y2[1]),cint(y2[2]))
+    
+    
+
+    date_lst = [[1,self.get_months(cint(y1[1]))]]
+    m1=cint(y1[1])+1
+    x_axis_lst = [[1,'Week1',cint(y1[1])]]
+    
+    from datetime import date, timedelta
+    d =dt= date1
+
+    week=k=1
+    for i in range(0,53): 
+
+      if dt <= date2:
+        
+        if(d.weekday()>3):
+          d = d+timedelta(7-d.weekday())
+        else:
+          d = d - timedelta(d.weekday())
+        dlt = timedelta(days = (week-1)*7)
+        dt = d + dlt + timedelta(days=6)
+        
+        m2 = cint(sql("Select month('%s')"%dt)[0][0])
+        
+        if(m1 == m2):
+          date_lst.append([i+2,self.get_months(m2)])
+          x_axis_lst.append([i+2,'Week1',m2])
+          k=1
+          m1 += 1 
+          if(m1==13): m1 =1
+        else:
+          date_lst.append([i+2,' '])
+          x_axis_lst.append([i+2,'Week%d'%k,m2])
+        week += 1
+        k +=1
+        
+               
+    return [date_lst,x_axis_lst]
+  #===================================================================================
+
+  def get_months(self,m):
+    m_lst = {1:'JAN',2:'FEB',3:'MAR',4:'APR',5:'MAY',6:'JUN',7:'JUL',8:'AUG',9:'SEP',10:'OCT',11:'NOV',12:'DEC'}
+    return m_lst[m]
+
+  
+    
+  def get_weekdates(self,lst):
+    from datetime import date, timedelta
+  
+    d = dt = self.make_date(lst)
+    date_lst = [[1,cstr(d.strftime("%d/%m/%y"))]]
+    week=flag =1
+    j=1
+    last_day = sql("select last_day('%s')"%d)[0][0]
+    lst_m = cint(lst.split(',')[0])
+    for i in range(2,8):
+      f=0
+      if(dt < last_day):
+        #if(d.weekday()>4):
+        #d = d+timedelta(7-d.weekday()) 
+        #else:
+        d = d - timedelta(d.weekday()-1)
+        dlt = timedelta(days = (week-1)*7)
+        dt = d + dlt + timedelta(days=6)
+        
+        if(cint(sql("select month('%s')"%dt)[0][0]) == lst_m and dt!=last_day):
+          for k in date_lst:      
+            if(cstr(dt.strftime("%d/%m/%y")) == k[1]):
+              f = 1
+          if f == 0:   
+            date_lst.append([i,cstr(dt.strftime("%d/%m/%y"))])
+          
+        elif(dt==last_day and flag ==1):
+          date_lst.append([i,cstr(last_day.strftime("%d/%m/%y"))])
+          flag = 0
+      
+        elif(flag == 1):
+          date_lst.append([i,cstr(last_day.strftime("%d/%m/%y"))])
+        week += 1
+       
+    return date_lst and date_lst or ''
+        
+          
+  def make_date(self,lst):
+    
+    from datetime import date, timedelta
+    lst = lst.split(',')
+    year = lst[1].split('-')
+    if(len(lst[0])==1):  month = '0'+lst[0]
+    else: month = lst[0]
+    if(1<=cint(month)<=3): year = year[1]    
+    elif(4<=cint(month)<=12): year = year[0]
+    
+    d = date(cint(year),cint(month),1)
+    
+    return d 
+    
+  def get_item_groups(self):
+    ret = convert_to_lists(sql("select name from `tabItem Group` where docstatus != 2 and is_group = 'No'"))
+    #ret = convert_to_lists(sql("select item_group from `tabItem` where is_sales_item='Yes' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now()) and item_group !=''"))
+    return ret and ret or ''
+    
+  def get_fiscal_year(self):
+    ret = convert_to_lists(sql("select name from `tabFiscal Year` where docstatus =0"))
+    return ret and ret or ''
\ No newline at end of file
diff --git a/crm/doctype/plot_control/plot_control.txt b/crm/doctype/plot_control/plot_control.txt
new file mode 100644
index 0000000..cab7968
--- /dev/null
+++ b/crm/doctype/plot_control/plot_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-17 10:36:31', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 215, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Plot Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/crm/doctype/quotation/__init__.py b/crm/doctype/quotation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/quotation/__init__.py
diff --git a/crm/doctype/quotation/quotation.comp.js b/crm/doctype/quotation/quotation.comp.js
new file mode 100644
index 0000000..2808e49
--- /dev/null
+++ b/crm/doctype/quotation/quotation.comp.js
@@ -0,0 +1,40 @@
+
+cur_frm.cscript.tname="Quotation Detail";cur_frm.cscript.fname="quotation_details";cur_frm.cscript.other_fname="other_charges";cur_frm.cscript.sales_team_fname="sales_team";$import(Sales Common)
+$import(Other Charges)
+$import(SMS Control)
+cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.quotation_to)hide_field(['customer','customer_address','contact_person','customer_name','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);if(!doc.price_list_name)set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});if(!doc.status)set_multiple(cdt,cdn,{status:'Draft'});if(!doc.transaction_date)set_multiple(cdt,cdn,{transaction_date:get_today()});if(!doc.conversion_rate)set_multiple(cdt,cdn,{conversion_rate:'1.00'});if(!doc.currency&&sys_defaults.currency)set_multiple(cdt,cdn,{currency:sys_defaults.currency});if(!doc.company&&sys_defaults.company)set_multiple(cdt,cdn,{company:sys_defaults.company});if(!doc.fiscal_year&&sys_defaults.fiscal_year)set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});if(doc.__islocal&&!getchildren('RV Tax Detail',doc.name,'other_charges',doc.doctype).length)cur_frm.cscript.load_taxes(doc,cdt,cdn);if(doc.__islocal==1){cur_frm.cscript.price_list_name(doc,cdt,cdn);}
+if(doc.quotation_to){if(doc.quotation_to=='Customer'){hide_field(['lead','lead_name']);}
+else if(doc.quotation_to=='Lead'){hide_field(['customer','customer_address','contact_person','customer_name','contact_display','customer_group']);}}}
+cur_frm.cscript.lead_cust_show=function(doc,cdt,cdn){if(doc.quotation_to=='Lead'){unhide_field(['lead']);hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}
+else if(doc.quotation_to=='Customer'){unhide_field(['customer']);hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}}
+cur_frm.cscript.quotation_to=function(doc,cdt,cdn){cur_frm.cscript.lead_cust_show(doc,cdt,cdn);}
+cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons();if(doc.docstatus==1&&doc.status!='Order Lost'){cur_frm.add_custom_button('Make Sales Order',cur_frm.cscript['Make Sales Order']);cur_frm.add_custom_button('Set as Lost',cur_frm.cscript['Declare Order Lost']);cur_frm.add_custom_button('Send SMS',cur_frm.cscript['Send SMS']);}
+if(!doc.docstatus)hide_field(['Update Follow up']);else unhide_field(['Update Follow up']);}
+cur_frm.cscript.customer=function(doc,dt,dn){if(doc.customer)get_server_fields('get_default_customer_address',JSON.stringify({customer:doc.customer}),'',doc,dt,dn,1);if(doc.customer)unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);}
+cur_frm.cscript.customer_address=cur_frm.cscript.contact_person=function(doc,dt,dn){if(doc.customer)get_server_fields('get_customer_address',JSON.stringify({customer:doc.customer,address:doc.customer_address,contact:doc.contact_person}),'',doc,dt,dn,1);}
+cur_frm.fields_dict.customer_address.on_new=function(dn){locals['Address'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Address'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
+cur_frm.fields_dict.contact_person.on_new=function(dn){locals['Contact'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Contact'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
+cur_frm.fields_dict['customer_address'].get_query=function(doc,cdt,cdn){return'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
+cur_frm.fields_dict['contact_person'].get_query=function(doc,cdt,cdn){return'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
+cur_frm.fields_dict['lead'].get_query=function(doc,cdt,cdn){return'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s"  ORDER BY  `tabLead`.`name` ASC LIMIT 50';}
+cur_frm.cscript.lead=function(doc,cdt,cdn){if(doc.lead)get_server_fields('get_lead_details',doc.lead,'',doc,cdt,cdn,1);if(doc.lead)unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);}
+cur_frm.fields_dict['enq_no'].get_query=function(doc,cdt,cdn){var cond='';var cond1='';if(doc.order_type)cond='ifnull(`tabEnquiry`.enquiry_type, "") = "'+doc.order_type+'" AND';if(doc.customer)cond1='`tabEnquiry`.customer = "'+doc.customer+'" AND';else if(doc.lead)cond1='`tabEnquiry`.lead = "'+doc.lead+'" AND';return repl('SELECT `tabEnquiry`.`name` FROM `tabEnquiry` WHERE `tabEnquiry`.`docstatus` = 1 AND `tabEnquiry`.status = "Submitted" AND %(cond)s %(cond1)s `tabEnquiry`.`name` LIKE "%s" ORDER BY `tabEnquiry`.`name` ASC LIMIT 50',{cond:cond,cond1:cond1});}
+cur_frm.cscript['Make Sales Order']=function(){var doc=cur_frm.doc;if(doc.docstatus==1){var n=createLocal("Sales Order");$c('dt_map',args={'docs':compress_doclist([locals["Sales Order"][n]]),'from_doctype':'Quotation','to_doctype':'Sales Order','from_docname':doc.name,'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"},function(r,rt){loaddoc("Sales Order",n);});}}
+cur_frm.cscript['Pull Enquiry Detail']=function(doc,cdt,cdn){var callback=function(r,rt){if(r.message){doc.quotation_to=r.message;if(doc.quotation_to=='Lead'){unhide_field(['lead','lead_name','address_display','contact_mobile','contact_email','territory']);}
+else if(doc.quotation_to=='Customer'){unhide_field(['customer','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);}
+refresh_many(['quotation_details','quotation_to','customer','customer_address','contact_person','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','order_type']);}}
+$c_obj(make_doclist(doc.doctype,doc.name),'pull_enq_details','',callback);}
+cur_frm.cscript['Update Follow up']=function(doc){$c_obj(make_doclist(doc.doctype,doc.name),'update_followup_details','',function(r,rt){refresh_field('follow_up');doc.__unsaved=0;cur_frm.refresh_header();});}
+cur_frm.cscript['Declare Order Lost']=function(){var qtn_lost_dialog;set_qtn_lost_dialog=function(doc,cdt,cdn){qtn_lost_dialog=new Dialog(400,400,'Add Quotation Lost Reason');qtn_lost_dialog.make_body([['HTML','Message','<div class="comment">Please add quotation lost reason</div>'],['Text','Quotation Lost Reason'],['HTML','Response','<div class = "comment" id="update_quotation_dialog_response"></div>'],['HTML','Add Reason','<div></div>']]);var add_reason_btn1=$a($i(qtn_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn1.innerHTML='Add';add_reason_btn1.onclick=function(){qtn_lost_dialog.add();}
+var add_reason_btn2=$a($i(qtn_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn2.innerHTML='Cancel';$y(add_reason_btn2,{marginLeft:'4px'});add_reason_btn2.onclick=function(){qtn_lost_dialog.hide();}
+qtn_lost_dialog.onshow=function(){qtn_lost_dialog.widgets['Quotation Lost Reason'].value='';$i('update_quotation_dialog_response').innerHTML='';}
+qtn_lost_dialog.add=function(){$i('update_quotation_dialog_response').innerHTML='Processing...';var arg=strip(qtn_lost_dialog.widgets['Quotation Lost Reason'].value);var call_back=function(r,rt){if(r.message=='true'){$i('update_quotation_dialog_response').innerHTML='Done';qtn_lost_dialog.hide();}}
+if(arg)$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_order_lost',arg,call_back);else msgprint("Please add Quotation lost reason");}}
+if(!qtn_lost_dialog){set_qtn_lost_dialog(doc,cdt,cdn);}
+qtn_lost_dialog.show();}
+cur_frm.cscript['Get Report']=function(doc,cdt,cdn){var callback=function(report){report.set_filter('Sales Order Detail','Quotation No.',doc.name)
+report.dt.run();}
+loadreport('Sales Order Detail','Itemwise Sales Details',callback);}
+cur_frm.cscript.quot_to_validate=function(doc,cdt,cdn){if(doc.quotation_to=='Lead'){if(!doc.lead){alert("Lead is mandatory.");validated=false;}}
+else if(doc.quotation_to=='Customer'){if(!doc.customer){alert("Customer is mandatory.");validated=false;}}}
+cur_frm.cscript.validate=function(doc,cdt,cdn){cur_frm.cscript.quot_to_validate(doc,cdt,cdn);}
\ No newline at end of file
diff --git a/crm/doctype/quotation/quotation.js b/crm/doctype/quotation/quotation.js
new file mode 100644
index 0000000..bdf6781
--- /dev/null
+++ b/crm/doctype/quotation/quotation.js
@@ -0,0 +1,309 @@
+// Module CRM
+cur_frm.cscript.tname = "Quotation Detail";
+cur_frm.cscript.fname = "quotation_details";
+cur_frm.cscript.other_fname = "other_charges";
+cur_frm.cscript.sales_team_fname = "sales_team";
+
+// =====================================================================================
+$import(Sales Common)
+$import(Other Charges)
+$import(SMS Control)
+
+// ONLOAD
+// ===================================================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {  
+  if(!doc.quotation_to) hide_field(['customer','customer_address','contact_person','customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
+  if(!doc.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+  if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+  if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1.00'});
+  if(!doc.currency && sys_defaults.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
+  //if(!doc.price_list_name && sys_defaults.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
+  if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
+  if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
+
+  // load default charges
+  if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) cur_frm.cscript.load_taxes(doc, cdt, cdn);
+
+  if(doc.__islocal==1){  cur_frm.cscript.price_list_name(doc, cdt, cdn);}
+  
+  if(doc.quotation_to) {
+    if(doc.quotation_to == 'Customer') {
+      hide_field(['lead', 'lead_name']);
+    }
+    else if (doc.quotation_to == 'Lead') {
+      hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
+    }
+  }
+}
+
+// hide - unhide fields based on lead or customer..
+// =======================================================================================================================
+cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
+  if(doc.quotation_to == 'Lead'){
+    unhide_field(['lead']);
+    hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+    doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
+  }
+  else if(doc.quotation_to == 'Customer'){    
+    unhide_field(['customer']);
+    hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);    
+    doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
+  }
+  //refresh_many(['lead','customer']);
+}
+
+
+
+//================ hide - unhide fields on basis of quotation to either lead or customer =============================== 
+cur_frm.cscript.quotation_to = function(doc,cdt,cdn){
+  cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
+  //doc.customer_address = doc.territory = doc.contact_no = doc.email_id = "";
+  //refresh_many(['territory','customer_address','contact_no','email_id']);
+  //doc.address_display = doc.contact_display = "";
+  //refresh_many(['address_display','contact_display']);
+}
+
+
+// REFRESH
+// ===================================================================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+
+  cur_frm.clear_custom_buttons();
+
+  if(doc.docstatus == 1 && doc.status!='Order Lost') {
+    cur_frm.add_custom_button('Make Sales Order', cur_frm.cscript['Make Sales Order']);
+    cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+  }
+  
+  if (!doc.docstatus) hide_field(['Update Follow up']);
+  else unhide_field(['Update Follow up']);
+  //cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
+}
+
+// ============== Lead and its Details ============================
+
+/*
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+  tn = createLocal('Contact');
+  locals['Contact'][tn].is_customer = 1;
+  if(doc.customer) locals['Contact'][tn].customer = doc.customer;
+  loaddoc('Contact', tn);
+}
+*/
+
+
+// DOCTYPE TRIGGERS
+// ====================================================================================
+
+/*
+// ***************** Get Contact Person based on customer selected *****************
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabContact`.contact_name, `tabContact`.email_id FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.docstatus != 2 AND `tabContact`.customer = "'+ doc.customer +'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+}
+*/
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;  
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;  
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+//lead
+cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
+  return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s"  ORDER BY  `tabLead`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.lead = function(doc, cdt, cdn) {
+  if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
+  if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);  
+}
+
+
+// =====================================================================================
+cur_frm.fields_dict['enq_no'].get_query = function(doc,cdt,cdn){
+  var cond='';
+  var cond1='';
+  if(doc.order_type) cond = 'ifnull(`tabEnquiry`.enquiry_type, "") = "'+doc.order_type+'" AND';
+  if(doc.customer) cond1 = '`tabEnquiry`.customer = "'+doc.customer+'" AND';
+  else if(doc.lead) cond1 = '`tabEnquiry`.lead = "'+doc.lead+'" AND';
+
+  return repl('SELECT `tabEnquiry`.`name` FROM `tabEnquiry` WHERE `tabEnquiry`.`docstatus` = 1 AND `tabEnquiry`.status = "Submitted" AND %(cond)s %(cond1)s `tabEnquiry`.`name` LIKE "%s" ORDER BY `tabEnquiry`.`name` ASC LIMIT 50', {cond:cond, cond1:cond1});
+}
+
+// Make Sales Order
+// =====================================================================================
+cur_frm.cscript['Make Sales Order'] = function() {
+  var doc = cur_frm.doc;
+
+  if (doc.docstatus == 1) { 
+    var n = createLocal("Sales Order");
+    $c('dt_map', args={
+      'docs':compress_doclist([locals["Sales Order"][n]]),
+      'from_doctype':'Quotation',
+      'to_doctype':'Sales Order',
+      'from_docname':doc.name,
+      'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"
+    }, function(r,rt) {
+      loaddoc("Sales Order", n);
+    });
+  }
+}
+
+//pull enquiry details
+cur_frm.cscript['Pull Enquiry Detail'] = function(doc,cdt,cdn){
+
+  var callback = function(r,rt){
+    if(r.message){
+      doc.quotation_to = r.message;
+      
+		  if(doc.quotation_to == 'Lead') {
+  			  unhide_field(['lead','lead_name','address_display','contact_mobile','contact_email','territory']);			  
+		  }
+		  else if(doc.quotation_to == 'Customer') {
+			  unhide_field(['customer','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+		  }
+		  refresh_many(['quotation_details','quotation_to','customer','customer_address','contact_person','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','order_type']);
+    }
+  }   
+  
+  $c_obj(make_doclist(doc.doctype, doc.name),'pull_enq_details','',callback);
+
+}
+
+//update follow up
+//=================================================================================
+cur_frm.cscript['Update Follow up'] = function(doc){
+
+  $c_obj(make_doclist(doc.doctype, doc.name),'update_followup_details','',function(r, rt){
+    refresh_field('follow_up');
+    doc.__unsaved = 0;
+    cur_frm.refresh_header();
+  });
+}
+
+
+// declare order lost
+//-------------------------
+cur_frm.cscript['Declare Order Lost'] = function(){
+  var qtn_lost_dialog;
+  
+  set_qtn_lost_dialog = function(doc,cdt,cdn){
+    qtn_lost_dialog = new Dialog(400,400,'Add Quotation Lost Reason');
+    qtn_lost_dialog.make_body([
+      ['HTML', 'Message', '<div class="comment">Please add quotation lost reason</div>'],
+      ['Text', 'Quotation Lost Reason'],
+      ['HTML', 'Response', '<div class = "comment" id="update_quotation_dialog_response"></div>'],
+      ['HTML', 'Add Reason', '<div></div>']
+    ]);
+    
+    var add_reason_btn1 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
+    add_reason_btn1.innerHTML = 'Add';
+    add_reason_btn1.onclick = function(){ qtn_lost_dialog.add(); }
+    
+    var add_reason_btn2 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
+    add_reason_btn2.innerHTML = 'Cancel';
+    $y(add_reason_btn2,{marginLeft:'4px'});
+    add_reason_btn2.onclick = function(){ qtn_lost_dialog.hide();}
+    
+    qtn_lost_dialog.onshow = function() {
+      qtn_lost_dialog.widgets['Quotation Lost Reason'].value = '';
+      $i('update_quotation_dialog_response').innerHTML = '';
+    }
+    
+    qtn_lost_dialog.add = function() {
+      // sending...
+      $i('update_quotation_dialog_response').innerHTML = 'Processing...';
+      var arg =  strip(qtn_lost_dialog.widgets['Quotation Lost Reason'].value);
+      var call_back = function(r,rt) { 
+        if(r.message == 'true'){
+          $i('update_quotation_dialog_response').innerHTML = 'Done';
+          qtn_lost_dialog.hide();
+        }
+      }
+      if(arg) $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_order_lost',arg,call_back);
+      else msgprint("Please add Quotation lost reason");
+    }
+  }  
+  
+  if(!qtn_lost_dialog){
+    set_qtn_lost_dialog(doc,cdt,cdn);
+  }  
+  qtn_lost_dialog.show();
+}
+
+
+// GET REPORT
+// ========================================================================================
+cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
+  var callback = function(report){
+  report.set_filter('Sales Order Detail', 'Quotation No.',doc.name)
+  report.dt.run();
+ }
+ loadreport('Sales Order Detail','Itemwise Sales Details', callback);
+}
+
+
+
+
+/*
+//get query select Territory
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';}
+*/
+
+//===================== Quotation to validation - either customer or lead mandatory ====================
+cur_frm.cscript.quot_to_validate = function(doc,cdt,cdn){
+  
+  if(doc.quotation_to == 'Lead'){
+  
+    if(!doc.lead){
+      alert("Lead is mandatory.");  
+      validated = false; 
+    }
+  }
+  else if(doc.quotation_to == 'Customer'){
+   
+    if(!doc.customer){
+      alert("Customer is mandatory.");
+      validated = false;
+    }
+    
+  }
+ 
+}
+
+//===================validation function =================================
+
+cur_frm.cscript.validate = function(doc,cdt,cdn){
+  cur_frm.cscript.quot_to_validate(doc,cdt,cdn);
+}
diff --git a/crm/doctype/quotation/quotation.py b/crm/doctype/quotation/quotation.py
new file mode 100644
index 0000000..caa0430
--- /dev/null
+++ b/crm/doctype/quotation/quotation.py
@@ -0,0 +1,362 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, load_json
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.tname = 'Quotation Detail'
+    self.fname = 'quotation_details'
+    
+    # Notification objects
+    self.notify_obj = get_obj('Notification Control')
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+
+# DOCTYPE TRIGGER FUNCTIONS
+# ==============================================================================    
+ 
+  # Pull Enquiry Details
+  # --------------------
+  def pull_enq_details(self):
+    self.doc.clear_table(self.doclist, 'quotation_details')
+    get_obj('DocType Mapper', 'Enquiry-Quotation').dt_map('Enquiry', 'Quotation', self.doc.enq_no, self.doc, self.doclist, "[['Enquiry', 'Quotation'],['Enquiry Detail', 'Quotation Detail']]")
+
+    self.get_adj_percent()
+
+    return cstr(self.doc.quotation_to)
+    
+  # Get Customer Details
+  # --------------------
+  #def get_customer_details(self):
+  #  return cstr(get_obj('Sales Common').get_customer_details(self))
+
+  # Get contact person details based on customer selected
+  # ------------------------------------------------------
+  def get_contact_details(self):
+    return cstr(get_obj('Sales Common').get_contact_details(self,0))
+  
+  # Clear Quotation Details
+  # -----------------------
+  def clear_quotation_details(self):
+    self.doc.clear_table(self.doclist, 'quotation_details')  
+  
+    
+# QUOTATION DETAILS TRIGGER FUNCTIONS
+# ================================================================================    
+
+  # Get Item Details
+  # -----------------
+  def get_item_details(self, item_code):
+    return get_obj('Sales Common').get_item_details(item_code, self)
+  
+  # Re-calculates Basic Rate & amount based on Price List Selected
+  # --------------------------------------------------------------
+  def get_adj_percent(self, arg=''):
+    get_obj('Sales Common').get_adj_percent(self)
+    
+
+# OTHER CHARGES TRIGGER FUNCTIONS
+# ====================================================================================
+  
+  # Get Tax rate if account type is TAX
+  # -----------------------------------
+  def get_rate(self,arg):
+    return get_obj('Sales Common').get_rate(arg)
+
+  # Load Default Charges
+  # ----------------------------------------------------------
+  def load_default_taxes(self):
+    return get_obj('Sales Common').load_default_taxes(self)
+
+  # Pull details from other charges master (Get Other Charges)
+  # ----------------------------------------------------------
+  def get_other_charges(self):
+    return get_obj('Sales Common').get_other_charges(self)
+  
+  # Get Lead Details along with its details
+  # ==============================================================
+  def get_lead_details1(self, name):    
+    details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)   
+    ret = {
+      'lead_name' : details and details[0]['lead_name'] or '',
+      'address_display' : (details and details[0]['address_line1']
+				     + (details[0]['address_line2'] and '\n' + details[0]['address_line2'] or '') + '\n' 
+				     + details[0]['city'] 
+				     + (details[0]['pincode'] and ', ' + details[0]['pincode'] or '') + '\n' 
+				     + (details[0]['state'] and details[0]['state']+', ' or '') 
+				     + details[0]['country'] + '\nTel: ' + details[0]['contact_no'] + '\n' or '-'),
+      'territory' : details and details[0]['territory'] or '',
+      'contact_mobile' : details and details[0]['mobile_no'] or '-',
+      'contact_email' : details and details[0]['email_id'] or '-'      
+    }
+    return cstr(ret)
+
+     
+# GET TERMS AND CONDITIONS
+# ====================================================================================
+  def get_tc_details(self):
+    return get_obj('Sales Common').get_tc_details(self)
+
+    
+# VALIDATE
+# ==============================================================================================
+  
+  # Amendment date is necessary if document is amended
+  # --------------------------------------------------
+  def validate_mandatory(self):
+    if self.doc.amended_from and not self.doc.amendment_date:
+      msgprint("Please Enter Amendment Date")
+      raise Exception
+
+  # Fiscal Year Validation
+  # ----------------------
+  def validate_fiscal_year(self):
+    get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Quotation Date')
+  
+  # Does not allow same item code to be entered twice
+  # -------------------------------------------------
+  def validate_for_items(self):
+    check_list=[]
+    chk_dupl_itm = []
+    for d in getlist(self.doclist,'quotation_details'):
+      ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
+      if ch and ch[0][0]=='Yes':
+        if cstr(d.item_code) in check_list:
+	  msgprint("Item %s has been entered twice." % d.item_code)
+	  raise Exception
+	else:
+	  check_list.append(cstr(d.item_code))
+      
+      if ch and ch[0][0]=='No':
+        f = [cstr(d.item_code),cstr(d.description)]
+	if f in chk_dupl_itm:
+	  msgprint("Item %s has been entered twice." % d.item_code)
+	  raise Exception
+	else:
+	  chk_dupl_itm.append(f)
+
+
+  #do not allow sales item in maintenance quotation and service item in sales quotation
+  #-----------------------------------------------------------------------------------------------
+  def validate_order_type(self):
+    if self.doc.order_type == 'Maintenance':
+      for d in getlist(self.doclist, 'quotation_details'):
+        is_service_item = sql("select is_service_item from `tabItem` where name=%s", d.item_code)
+        is_service_item = is_service_item and is_service_item[0][0] or 'No'
+        
+        if is_service_item == 'No':
+          msgprint("You can not select non service item "+d.item_code+" in Maintenance Quotation")
+          raise Exception
+    else:
+      for d in getlist(self.doclist, 'quotation_details'):
+        is_sales_item = sql("select is_sales_item from `tabItem` where name=%s", d.item_code)
+        is_sales_item = is_sales_item and is_sales_item[0][0] or 'No'
+        
+        if is_sales_item == 'No':
+          msgprint("You can not select non sales item "+d.item_code+" in Sales Quotation")
+          raise Exception
+  
+  #--------------Validation For Last Contact Date-----------------
+  # ====================================================================================================================
+  def set_last_contact_date(self):
+    #if not self.doc.contact_date_ref:
+      #self.doc.contact_date_ref=self.doc.contact_date
+      #self.doc.last_contact_date=self.doc.contact_date_ref
+    if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
+      if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
+        self.doc.last_contact_date=self.doc.contact_date_ref
+      else:
+        msgprint("Contact Date Cannot be before Last Contact Date")
+        raise Exception
+      #set(self.doc, 'contact_date_ref',self.doc.contact_date)
+  
+
+  # Validate
+  # --------
+  def validate(self):
+    self.validate_fiscal_year()
+    self.validate_mandatory()
+    self.set_last_contact_date()
+    self.validate_order_type()
+    self.validate_for_items()
+    sales_com_obj = get_obj('Sales Common')
+    sales_com_obj.check_active_sales_items(self)
+    sales_com_obj.validate_max_discount(self,'quotation_details') #verify whether rate is not greater than max_discount
+    sales_com_obj.check_conversion_rate(self)
+    
+    # Get total in words
+    self.doc.in_words = sales_com_obj.get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
+    self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
+
+  def on_update(self):
+    # Add to calendar
+    #if self.doc.contact_date and self.doc.last_contact_date != self.doc.contact_date:
+    if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
+      if self.doc.contact_by:
+        self.add_calendar_event()
+      set(self.doc, 'contact_date_ref',self.doc.contact_date)
+    
+    # Set Quotation Status
+    set(self.doc, 'status', 'Draft')
+
+    # subject for follow
+    self.doc.subject = '[%(status)s] To %(customer)s worth %(currency)s %(grand_total)s' % self.doc.fields
+
+  
+  # Add to Calendar
+  # ====================================================================================================================
+  def add_calendar_event(self):
+    desc=''
+    user_lst =[]
+    if self.doc.customer:
+      if self.doc.contact_person:
+        desc = 'Contact '+cstr(self.doc.contact_person)
+      else:
+        desc = 'Contact customer '+cstr(self.doc.customer)
+    elif self.doc.lead:
+      if self.doc.lead_name:
+        desc = 'Contact '+cstr(self.doc.lead_name)
+      else:
+        desc = 'Contact lead '+cstr(self.doc.lead)
+    desc = desc+ '.By : ' + cstr(self.doc.contact_by)
+    
+    if self.doc.to_discuss:
+      desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
+    
+    ev = Document('Event')
+    ev.description = desc
+    ev.event_date = self.doc.contact_date
+    ev.event_hour = '10:00'
+    ev.event_type = 'Private'
+    ev.ref_type = 'Enquiry'
+    ev.ref_name = self.doc.name
+    ev.save(1)
+    
+    user_lst.append(self.doc.owner)
+    
+    chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
+    if chk:
+      user_lst.append(chk[0][0])
+    
+    for d in user_lst:
+      ch = addchild(ev, 'event_individuals', 'Event User', 0)
+      ch.person = d
+      ch.save(1)
+  
+  #update enquiry
+  #------------------
+  def update_enquiry(self, flag):
+    prevdoc=''
+    for d in getlist(self.doclist, 'quotation_details'):
+      if d.prevdoc_docname:
+        prevdoc = d.prevdoc_docname
+    
+    if prevdoc:
+      if flag == 'submit': #on submit
+        sql("update `tabEnquiry` set status = 'Quotation Sent' where name = %s", prevdoc)
+      elif flag == 'cancel': #on cancel
+        sql("update `tabEnquiry` set status = 'Open' where name = %s", prevdoc)
+      elif flag == 'order lost': #order lost
+        sql("update `tabEnquiry` set status = 'Enquiry Lost' where name=%s", prevdoc)
+      elif flag == 'order confirm': #order confirm
+        sql("update `tabEnquiry` set status='Order Confirmed' where name=%s", prevdoc)
+  
+  # declare as order lost
+  #-------------------------
+  def declare_order_lost(self,arg):
+    chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and t2.prevdoc_docname = %s",self.doc.name)
+    if chk:
+      msgprint("Sales Order No. "+cstr(chk[0][0])+" is submitted against this Quotation. Thus 'Order Lost' can not be declared against it.")
+      raise Exception
+    else:
+      set(self.doc, 'status', 'Order Lost')
+      set(self.doc, 'order_lost_reason', arg)
+      self.update_enquiry('order lost')
+      return cstr('true')
+  
+  #check if value entered in item table
+  #--------------------------------------
+  def check_item_table(self):
+    if not getlist(self.doclist, 'quotation_details'):
+      msgprint("Please enter item details")
+      raise Exception
+    
+  # ON SUBMIT
+  # =========================================================================
+  def on_submit(self):
+    self.check_item_table()
+    if not self.doc.amended_from:
+      set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been sent')
+    else:
+      set(self.doc, 'message', 'Quotation has been amended. New Quotation no:'+self.doc.name)
+    
+    # Check for Approving Authority
+    get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
+
+    # Set Quotation Status
+    set(self.doc, 'status', 'Submitted')
+    
+    #update enquiry status
+    self.update_enquiry('submit')
+    
+    # on submit notification
+    self.notify_obj.notify_contact('Quotation', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.contact_person)
+    
+# ON CANCEL
+# ==========================================================================
+  def on_cancel(self):
+    set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been cancelled')
+    
+    #update enquiry status
+    self.update_enquiry('cancel')
+    
+    set(self.doc,'status','Cancelled')
+    
+  
+# SEND SMS
+# =============================================================================
+  def send_sms(self):
+    if not self.doc.customer_mobile_no:
+      msgprint("Please enter customer mobile no")
+    elif not self.doc.message:
+      msgprint("Please enter the message you want to send")
+    else:
+      msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.contact_mobile,], self.doc.message))
+  
+# Print other charges
+# ===========================================================================
+  def print_other_charges(self,docname):
+    print_lst = []
+    for d in getlist(self.doclist,'other_charges'):
+      lst1 = []
+      lst1.append(d.description)
+      lst1.append(d.total)
+      print_lst.append(lst1)
+    return print_lst
+  
+  def update_followup_details(self):
+    sql("delete from `tabFollow up` where parent = '%s'"%self.doc.name)
+    for d in getlist(self.doclist, 'follow_up'):
+      d.save()
diff --git a/crm/doctype/quotation/quotation.txt b/crm/doctype/quotation/quotation.txt
new file mode 100644
index 0000000..527264d
--- /dev/null
+++ b/crm/doctype/quotation/quotation.txt
@@ -0,0 +1,2953 @@
+[
+	{
+		'_last_update': '1305804973',
+		'_user_tags': None,
+		'allow_attach': 1,
+		'allow_copy': None,
+		'allow_email': 0,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': 0,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': 1,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': 1,
+		'menu_index': None,
+		'modified': '2011-05-17 16:24:50',
+		'modified_by': 'Guest',
+		'module': 'CRM',
+		'name': 'Quotation',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'status,transaction_date, customer,company,order_type',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 594
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-03-21 16:39:48',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': '000001912',
+		'owner': 'rahul@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': None,
+		'role': 'user print',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00435',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00436',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00437',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00438',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': 'customer_name',
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00439',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Customer',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00440',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00441',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 9,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00442',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 10,
+		'match': None,
+		'modified': '2011-04-29 14:22:54',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00443',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05298',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05299',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': 'QTN',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02632',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'QTN',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'quotation_to',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Quotation To',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02634',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'quotation_to',
+		'oldfieldtype': 'Select',
+		'options': '\nLead\nCustomer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:48:02',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL03788',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02638',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02639',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_person',
+		'oldfieldtype': 'Link',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02635',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Lead',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02636',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'lead',
+		'oldfieldtype': 'Link',
+		'options': 'Lead',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_name',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02637',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': 0,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 0,
+		'label': 'Address',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL05289',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 0,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL05290',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': 0,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL05291',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL05292',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05300',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Quotation Date',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02642',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'order_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Order Type',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02631',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'order_type',
+		'oldfieldtype': 'Select',
+		'options': '\nSales\nMaintenance',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02633',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nOrder Confirmed\nOrder Lost\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02643',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02644',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': "To create Quotation against Enquiry, Select Enquiry No. and click on 'Pull Enquiry Details' ",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'enq_no',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Enquiry No',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02645',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'enq_no',
+		'oldfieldtype': 'Link',
+		'options': 'Enquiry',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Pull Enquiry Detail',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02646',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': 'Will be fetched from Customer',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02640',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Customer Group',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02680',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_group',
+		'oldfieldtype': 'Link',
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05301',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Clear Table',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02650',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'clear_quotation_details',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'price_list_name',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': 1,
+		'label': 'Price List',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02651',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'price_list_name',
+		'oldfieldtype': 'Select',
+		'options': 'link:Price List',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05302',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': "Customer's currency - If you want to select a currency that is not the default currency, then you must also specify the Currency Conversion Rate.",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': 1,
+		'label': 'Currency',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02647',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': '1.00',
+		'depends_on': None,
+		'description': "Rate at which customer's currency is converted to your currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Currency Conversion Rate',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02648',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05303',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': 'Field Descriptions for Quotation Details\n\n<b>Ref Rate: </b>Rate in your selected Price List. Price Lists help you track discounts.\n\n<b>Page Break:</b> If you want to break the page on this item in the Print Format',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'quotation_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Quotation Details',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02652',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'quotation_details',
+		'oldfieldtype': 'Table',
+		'options': 'Quotation Detail',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '40px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Net Total*',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02653',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Re-Calculate Values',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02654',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Note HTML',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05304',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05305',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'charge',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Select Charges Master',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02657',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'charge',
+		'oldfieldtype': 'Link',
+		'options': 'Other Charges',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Get Charges',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02658',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Other Charges',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02659',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges',
+		'oldfieldtype': 'Table',
+		'options': 'RV Tax Detail',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Calculate Charges',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02660',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Charges Total*',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02661',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Grand Total*',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02662',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Other Charges Calculation',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05306',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'OT Notes',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05307',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05308',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Rounded Total',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02686',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'rounded_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Quotation.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02687',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05309',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Grand Total (Export)',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02689',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'grand_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Rounded Total (Export)',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02690',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'rounded_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words (Export) will be visible once you save the Quotation.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_export',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'In Words (Export)',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02691',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'in_words_export',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Add Terms and Conditions for the Quotation like Payment Terms, Validity of Offer etc. You can also prepare a master Term Sheet and use the Template',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05310',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-12-14 10:23:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Letter Head',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL04223',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'letter_head',
+		'oldfieldtype': 'Select',
+		'options': 'link:Letter Head',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02666',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02667',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05311',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'Term Details',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02669',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Filling in additional information about the Quotation will help you analyze your data better.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05312',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02675',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 60,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02676',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'enq_det',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 61,
+		'in_filter': None,
+		'label': 'Enquiry Detail',
+		'modified': '2011-05-25 12:45:08',
+		'modified_by': 'Guest',
+		'name': 'FL02672',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'enq_det',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'source',
+		'fieldtype': 'Select',
+		'hidden': 0,
+		'icon': None,
+		'idx': 62,
+		'in_filter': None,
+		'label': 'Source',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02673',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'source',
+		'oldfieldtype': 'Select',
+		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'campaign',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'Campaign',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02674',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'campaign',
+		'oldfieldtype': 'Link',
+		'options': 'Campaign',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02683',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02677',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'order_lost_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': 'Order Lost Reason',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02678',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'order_lost_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05313',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-20 17:46:40',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your sales person who will contact the customer/lead in future',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_by',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'Next Contact By',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL03767',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_by',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Person',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-20 17:46:40',
+		'default': None,
+		'depends_on': None,
+		'description': 'Your sales person will get a reminder on this date to contact the customer/lead',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Next Contact Date',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL03768',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-20 17:46:40',
+		'default': None,
+		'depends_on': None,
+		'description': 'Date on which the lead/customer was last contacted',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'last_contact_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'Last Contact Date',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL03769',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'last_contact_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-20 17:46:40',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_discuss',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': 'To Discuss',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL03771',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'to_discuss',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Keep a track on communications regarding this Quotation. This will help you remember earlier communications in case the Customer comes back again',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': 'Communication History',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL05314',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'follow_up',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': None,
+		'label': 'Follow up',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02694',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'follow_up',
+		'oldfieldtype': 'Table',
+		'options': 'Follow up',
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '40px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2011-05-25 12:45:09',
+		'modified_by': 'Guest',
+		'name': 'FL02703',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Quotation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/quotation_detail/__init__.py b/crm/doctype/quotation_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/quotation_detail/__init__.py
diff --git a/crm/doctype/quotation_detail/quotation_detail.txt b/crm/doctype/quotation_detail/quotation_detail.txt
new file mode 100644
index 0000000..1196618
--- /dev/null
+++ b/crm/doctype/quotation_detail/quotation_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': 0, 'creation': '2009-03-12 12:10:03', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 23, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'QUOD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Quotation Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': 0, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Item Code', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01048', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-21 14:38:24', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Item Name', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01458', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 0, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01049', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'UOM', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01050', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 0, 'print_hide': 0, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Quantity', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01052', 'idx': 5, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'ref_rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Ref Rate', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01053', 'idx': 6, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'ref_rate', 'fieldtype': 'Currency', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Float', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'adj_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Discount (%)', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01054', 'idx': 7, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'adj_rate', 'fieldtype': 'Float', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'export_rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 0, 'print_hide': 0, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Rate', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01057', 'idx': 8, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'export_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'export_amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 0, 'print_hide': 0, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Amount', 'width': '100px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01058', 'idx': 9, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'export_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-08 11:19:43', 'doctype': 'DocField', 'oldfieldname': 'base_ref_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Ref Rate*', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05292', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'base_ref_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'basic_rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Basic Rate*', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01055', 'idx': 11, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'basic_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:03', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Amount*', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01056', 'idx': 12, 'default': '0.00', 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-26 10:40:03', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02181', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-21 14:38:24', 'doctype': 'DocField', 'oldfieldname': 'brand', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Brand', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01457', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'brand', 'fieldtype': 'Link', 'options': 'Brand', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-04-07 16:38:16', 'doctype': 'DocField', 'oldfieldname': 'item_tax_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Item Tax Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01728', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'item_tax_rate', 'fieldtype': 'Small Text', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Check', 'creation': '2009-09-03 15:07:15', 'doctype': 'DocField', 'oldfieldname': 'page_break', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Page Break', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL02916', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'page_break', 'fieldtype': 'Check', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-08-05 08:25:32', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Against Docname', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05832', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:32', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-08-05 08:25:33', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_doctype', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Against Doctype', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Quotation Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05833', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-08-05 08:25:33', 'parenttype': 'DocType', 'fieldname': 'prevdoc_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/return_detail/__init__.py b/crm/doctype/return_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/return_detail/__init__.py
diff --git a/crm/doctype/return_detail/return_detail.txt b/crm/doctype/return_detail/return_detail.txt
new file mode 100644
index 0000000..51152d4
--- /dev/null
+++ b/crm/doctype/return_detail/return_detail.txt
@@ -0,0 +1,370 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:19',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'Return Detail',
+		'name_case': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 12
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Item Code',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02844',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02845',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'UOM',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02848',
+		'no_copy': None,
+		'oldfieldname': 'uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02849',
+		'no_copy': None,
+		'oldfieldname': 'rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Qty',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02846',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'returned_qty',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Returned Qty',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02847',
+		'no_copy': None,
+		'oldfieldname': 'returned_qty',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-21 12:06:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Serial No',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL04415',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-21 12:06:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'batch_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Batch No',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL04416',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'detail_name',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Detail Name',
+		'modified': '2011-02-23 19:09:05',
+		'modified_by': 'Administrator',
+		'name': 'FL02843',
+		'no_copy': None,
+		'oldfieldname': 'detail_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Return Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/sales_common/__init__.py b/crm/doctype/sales_common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/sales_common/__init__.py
diff --git a/crm/doctype/sales_common/sales_common.comp.js b/crm/doctype/sales_common/sales_common.comp.js
new file mode 100644
index 0000000..c03d5df
--- /dev/null
+++ b/crm/doctype/sales_common/sales_common.comp.js
@@ -0,0 +1,74 @@
+
+cur_frm.cscript.load_taxes=function(doc,cdt,cdn){if(doc.customer)return;$c_obj([doc],'load_default_taxes','',function(r,rt){refresh_field('other_charges');});}
+cur_frm.add_fetch('company','default_currency','currency');cur_frm.cscript.customer=function(doc,cdt,cdn){if(doc.customer){if(!doc.company){msgprint("Please select company to proceed");doc.customer='';refresh_field('customer');}else{var callback=function(r,rt){cur_frm.refresh();}
+$c_obj(make_doclist(doc.doctype,doc.name),'get_customer_details','',callback);}}}
+cur_frm.cscript.TerritoryHelp=function(doc,dt,dn){var call_back=function(){var sb_obj=new SalesBrowser();sb_obj.set_val('Territory');}
+loadpage('Sales Browser',call_back);}
+cur_frm.cscript.CGHelp=function(doc,dt,dn){var call_back=function(){var sb_obj=new SalesBrowser();sb_obj.set_val('Customer Group');}
+loadpage('Sales Browser',call_back);}
+cur_frm.cscript.currency=function(doc,cdt,cdn){cur_frm.cscript.price_list_name(doc,cdt,cdn);}
+cur_frm.cscript.price_list_name=function(doc,cdt,cdn){var fname=cur_frm.cscript.fname;if(doc.price_list_name&&doc.currency){$c_obj(make_doclist(doc.doctype,doc.name),'get_adj_percent','',function(r,rt){refresh_field(fname);var doc=locals[cdt][cdn];cur_frm.cscript.recalc(doc,3);});}}
+cur_frm.cscript.conversion_rate=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,3);}
+cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query=function(doc,cdt,cdn){if(doc.order_type=='Maintenance')
+return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';else
+return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';}
+cur_frm.cscript.item_code=function(doc,cdt,cdn){var fname=cur_frm.cscript.fname;var d=locals[cdt][cdn];if(d.item_code){if(!doc.company){msgprint("Please select company to proceed");d.item_code='';refresh_field('item_code',d.name,fname);}else{var callback=function(r,rt){cur_frm.cscript.recalc(doc,1);}
+get_server_fields('get_item_details',d.item_code,fname,doc,cdt,cdn,1,callback);}}
+if(cur_frm.cscript.custom_item_code){cur_frm.cscript.custom_item_code(doc,cdt,cdn);}}
+cur_frm.cscript.qty=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,1);}
+cur_frm.cscript.adj_rate=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,1);}
+cur_frm.cscript.ref_rate=function(doc,cdt,cdn){var d=locals[cdt][cdn];set_multiple(cur_frm.cscript.tname,d.name,{'export_rate':flt(d.ref_rate)*(100-flt(d.adj_rate))/100},cur_frm.cscript.fname);cur_frm.cscript.recalc(doc,3);}
+cur_frm.cscript.basic_rate=function(doc,cdt,cdn){var fname=cur_frm.cscript.fname;var d=locals[cdt][cdn];;if(!d.qty)
+{d.qty=1;refresh_field('qty',d.name,fname);}
+cur_frm.cscript.recalc(doc,2);}
+cur_frm.cscript.export_rate=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,3);}
+cur_frm.fields_dict.charge.get_query=function(doc){return'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus != 2 AND `tabOther Charges`.%(key)s LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';}
+cur_frm.cscript['Get Charges']=function(doc,cdt,cdn){$c_obj(make_doclist(doc.doctype,doc.name),'get_other_charges','',function(r,rt){cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);});}
+cur_frm.cscript.recalc=function(doc,n){if(!n)n=0;doc=locals[doc.doctype][doc.name];var tname=cur_frm.cscript.tname;var fname=cur_frm.cscript.fname;var sales_team=cur_frm.cscript.sales_team_fname;var other_fname=cur_frm.cscript.other_fname;if(!flt(doc.conversion_rate)){doc.conversion_rate=1;refresh_field('conversion_rate');}
+if(n>0)cur_frm.cscript.update_fname_table(doc,tname,fname,n);if(flt(doc.net_total)>0){var cl=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);for(var i=0;i<cl.length;i++){cl[i].total_tax_amount=0;cl[i].total_amount=0;cl[i].tax_amount=0;cl[i].total=0;cl[i].item_wise_tax_detail="";if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type)&&!cl[i].row_id){alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);validated=false;}}
+cur_frm.cscript.calc_other_charges(doc,tname,fname,other_fname);}
+cur_frm.cscript.calc_doc_values(doc,cdt,cdn,tname,fname,other_fname);cl=getchildren('Sales Team',doc.name,sales_team);for(var i=0;i<cl.length;i++){if(cl[i].allocated_percentage){cl[i].allocated_amount=flt(flt(doc.net_total)*flt(cl[i].allocated_percentage)/100);refresh_field('allocated_amount',cl[i].name,sales_team);}}
+doc.in_words='';doc.in_words_export='';refresh_many(['total_discount_rate','total_discount','net_total','total_commission','grand_total','rounded_total','grand_total_export','rounded_total_export','in_words','in_words_export','other_charges','other_charges_total']);if(cur_frm.cscript.custom_recalc)cur_frm.cscript.custom_recalc(doc);}
+cur_frm.cscript.calc_doc_values=function(doc,cdt,cdn,tname,fname,other_fname){doc=locals[doc.doctype][doc.name];var net_total=0;var other_charges_total=0;var cl=getchildren(tname,doc.name,fname);for(var i=0;i<cl.length;i++){net_total+=flt(cl[i].amount);}
+var d=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);for(var j=0;j<d.length;j++){other_charges_total+=flt(d[j].amount);}
+doc.net_total=flt(net_total);doc.other_charges_total=flt(other_charges_total);doc.grand_total=flt(flt(net_total)+flt(other_charges_total));doc.rounded_total=Math.round(doc.grand_total);doc.grand_total_export=flt(flt(doc.grand_total)/flt(doc.conversion_rate));doc.rounded_total_export=Math.round(doc.grand_total_export);doc.total_commission=flt(flt(net_total)*flt(doc.commission_rate)/100);}
+cur_frm.cscript.calc_other_charges=function(doc,tname,fname,other_fname){doc=locals[doc.doctype][doc.name];cur_frm.fields_dict['Other Charges Calculation'].disp_area.innerHTML='<b style="padding: 8px 0px;">Calculation Details for Other Charges:</b>';var cl=getchildren(tname,doc.name,fname);var tax=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);var otc=make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area,cl.length+1,tax.length+1,'90%',[],{border:'1px solid #AAA',padding:'2px'});$y(otc,{marginTop:'8px'});var tax_desc={};var tax_desc_rates=[];var net_total=0;for(var i=0;i<cl.length;i++){net_total+=flt(flt(cl[i].qty)*flt(cl[i].basic_rate));var prev_total=flt(cl[i].amount);if(cl[i].item_tax_rate)
+var check_tax=eval('var a='+cl[i].item_tax_rate+';a');$td(otc,i+1,0).innerHTML=cl[i].item_code?cl[i].item_code:cl[i].description;var tax=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);var total=net_total;for(var t=0;t<tax.length;t++){var account=tax[t].account_head;$td(otc,0,t+1).innerHTML=account?account:'';if(cl[i].item_tax_rate&&check_tax[account]!=null){rate=flt(check_tax[account]);}
+else
+rate=flt(tax[t].rate);var tax_amount=cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t,cl[i],rate);item_wise_tax_detail=cur_frm.cscript.get_item_wise_tax_detail(doc,rate,cl,i,tax,t);if(tax[t].charge_type!="Actual")tax[t].item_wise_tax_detail+=item_wise_tax_detail;tax[t].total_amount=flt(tax_amount.toFixed(2));tax[t].total_tax_amount=flt(prev_total.toFixed(2));tax[t].tax_amount+=flt(tax_amount.toFixed(2));var total_amount=flt(tax[t].tax_amount);total_tax_amount=flt(tax[t].total_tax_amount)+flt(total_amount);set_multiple('RV Tax Detail',tax[t].name,{'item_wise_tax_detail':tax[t].item_wise_tax_detail,'amount':total_amount,'total':flt(total)+flt(tax[t].tax_amount)},other_fname);prev_total+=flt(tax[t].total_amount);total+=flt(tax[t].tax_amount);if(tax[t].charge_type=='Actual')
+$td(otc,i+1,t+1).innerHTML=fmt_money(tax[t].total_amount);else
+$td(otc,i+1,t+1).innerHTML='('+fmt_money(rate)+'%) '+fmt_money(tax[t].total_amount);}}}
+cur_frm.cscript.check_charge_type_and_get_tax_amount=function(doc,tax,t,cl,rate,print_amt){doc=locals[doc.doctype][doc.name];if(!print_amt)print_amt=0;var tax_amount=0;if(tax[t].charge_type=='Actual'){var value=flt(tax[t].rate)/flt(doc.net_total);return tax_amount=flt(value)*flt(cl.amount);}
+else if(tax[t].charge_type=='On Net Total'){if(flt(print_amt)==1){doc.excise_rate=flt(rate);doc.total_excise_rate+=flt(rate);refresh_field('excise_rate');refresh_field('total_excise_rate');return}
+return tax_amount=(flt(rate)*flt(cl.amount)/100);}
+else if(tax[t].charge_type=='On Previous Row Amount'){if(flt(print_amt)==1){doc.total_excise_rate+=flt(flt(doc.excise_rate)*0.01*flt(rate));refresh_field('total_excise_rate');return}
+var row_no=(tax[t].row_id).toString();var row=(row_no).split("+");for(var r=0;r<row.length;r++){var id=cint(row[r].replace(/^\s+|\s+$/g,""));tax_amount+=(flt(rate)*flt(tax[id-1].total_amount)/100);}
+var row_id=row_no.indexOf("/");if(row_id!=-1){rate='';var row=(row_no).split("/");if(row.length>2)alert("You cannot enter more than 2 nos. for division");var id1=cint(row[0].replace(/^\s+|\s+$/g,""));var id2=cint(row[1].replace(/^\s+|\s+$/g,""));tax_amount=flt(tax[id1-1].total_amount)/flt(tax[id2-1].total_amount);}
+return tax_amount}
+else if(tax[t].charge_type=='On Previous Row Total'){if(flt(print_amt)==1){doc.sales_tax_rate+=flt(rate);refresh_field('sales_tax_rate');return}
+var row=cint(tax[t].row_id);return tax_amount=flt(rate)*(flt(tax[row-1].total_tax_amount)+flt(tax[row-1].total_amount))/100;}}
+cur_frm.cscript.update_fname_table=function(doc,tname,fname,n){doc=locals[doc.doctype][doc.name]
+var net_total=0
+var cl=getchildren(tname,doc.name,fname);for(var i=0;i<cl.length;i++){if(n==1){if(flt(cl[i].ref_rate)>0)
+set_multiple(tname,cl[i].name,{'export_rate':flt(flt(cl[i].ref_rate)*(100-flt(cl[i].adj_rate))/100)},fname);set_multiple(tname,cl[i].name,{'export_amount':flt(flt(cl[i].qty)*flt(cl[i].export_rate)),'basic_rate':flt(flt(cl[i].export_rate)*flt(doc.conversion_rate)),'amount':flt((flt(cl[i].export_rate)*flt(doc.conversion_rate))*flt(cl[i].qty))},fname);}
+else if(n==2){if(flt(cl[i].ref_rate)>0)
+set_multiple(tname,cl[i].name,{'adj_rate':100-flt(flt(cl[i].basic_rate)*100/(flt(cl[i].ref_rate)*flt(doc.conversion_rate)))},fname);set_multiple(tname,cl[i].name,{'amount':flt(flt(cl[i].qty)*flt(cl[i].basic_rate)),'export_rate':flt(flt(cl[i].basic_rate)/flt(doc.conversion_rate)),'export_amount':flt((flt(cl[i].basic_rate)/flt(doc.conversion_rate))*flt(cl[i].qty))},fname);}
+else if(n==3){set_multiple(tname,cl[i].name,{'basic_rate':flt(flt(cl[i].export_rate)*flt(doc.conversion_rate))},fname);set_multiple(tname,cl[i].name,{'amount':flt(flt(cl[i].basic_rate)*flt(cl[i].qty)),'export_amount':flt(flt(cl[i].export_rate)*flt(cl[i].qty))},fname);if(cl[i].ref_rate>0)
+set_multiple(tname,cl[i].name,{'adj_rate':100-flt(flt(cl[i].export_rate)*100/flt(cl[i].ref_rate)),'base_ref_rate':flt(flt(cl[i].ref_rate)*flt(doc.conversion_rate))},fname);}
+net_total+=flt(flt(cl[i].qty)*flt(cl[i].basic_rate));}
+doc.net_total=net_total;refresh_field('net_total');}
+cur_frm.cscript.get_item_wise_tax_detail=function(doc,rate,cl,i,tax,t){doc=locals[doc.doctype][doc.name];var detail='';detail=cl[i].item_code+" : "+cstr(rate)+NEWLINE;return detail;}
+cur_frm.cscript['Re-Calculate Values']=function(doc,cdt,cdn){cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);}
+cur_frm.cscript['Calculate Charges']=function(doc,cdt,cdn){var other_fname=cur_frm.cscript.other_fname;var cl=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);for(var i=0;i<cl.length;i++){cl[i].total_tax_amount=0;cl[i].total_amount=0;cl[i].tax_amount=0;cl[i].total=0;if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type)&&!cl[i].row_id){alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);validated=false;}}
+cur_frm.cscript.recalc(doc,1);}
+cur_frm.cscript.sales_partner=function(doc,cdt,cdn){if(doc.sales_partner){get_server_fields('get_comm_rate',doc.sales_partner,'',doc,cdt,cdn,1);}}
+cur_frm.cscript.commission_rate=function(doc,cdt,cdn){if(doc.commission_rate>100){alert("Commision rate cannot be greater than 100.");doc.total_commission=0;doc.commission_rate=0;}
+else
+doc.total_commission=doc.net_total*doc.commission_rate/100;refresh_many(['total_commission','commission_rate']);}
+cur_frm.cscript.total_commission=function(doc,cdt,cdn){if(doc.net_total){if(doc.net_total<doc.total_commission){alert("Total commission cannot be greater than net total.");doc.total_commission=0;doc.commission_rate=0;}
+else
+doc.commission_rate=doc.total_commission*100/doc.net_total;refresh_many(['total_commission','commission_rate']);}}
+cur_frm.cscript.allocated_percentage=function(doc,cdt,cdn){var fname=cur_frm.cscript.sales_team_fname;var d=locals[cdt][cdn];if(d.allocated_percentage){d.allocated_amount=flt(flt(doc.net_total)*flt(d.allocated_percentage)/100);refresh_field('allocated_amount',d.name,fname);}}
+cur_frm.cscript.validate=function(doc,cdt,cdn){cur_frm.cscript.validate_items(doc);var cl=getchildren('Other Charges',doc.name,'other_charges');for(var i=0;i<cl.length;i++){if(!cl[i].amount){alert("Please Enter Amount in Row no. "+cl[i].idx+" in Other Charges table");validated=false;}}
+cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);if(cur_frm.cscript.calc_adjustment_amount)cur_frm.cscript.calc_adjustment_amount(doc);}
+cur_frm.cscript.validate_items=function(doc){var cl=getchildren(cur_frm.cscript.tname,doc.name,cur_frm.cscript.fname);if(!cl.length){alert("Please enter Items for "+doc.doctype);validated=false;}}
\ No newline at end of file
diff --git a/crm/doctype/sales_common/sales_common.js b/crm/doctype/sales_common/sales_common.js
new file mode 100644
index 0000000..f4b3f02
--- /dev/null
+++ b/crm/doctype/sales_common/sales_common.js
@@ -0,0 +1,479 @@
+// Preset
+// ------
+// cur_frm.cscript.tname - Details table name
+// cur_frm.cscript.fname - Details fieldname
+// cur_frm.cscript.other_fname - Other Charges fieldname
+// cur_frm.cscript.sales_team_fname - Sales Team fieldname
+
+
+// ============== Load Default Taxes ===================
+cur_frm.cscript.load_taxes = function(doc, cdt, cdn) {
+  // run if this is not executed from dt_map...
+  if(doc.customer) return;
+  $c_obj([doc],'load_default_taxes','',function(r,rt){
+     refresh_field('other_charges');
+  });
+}
+
+
+// -----------------
+// Shipping Address
+// -----------------
+//cur_frm.add_fetch('ship_det_no', 'shipping_address', 'shipping_address');
+//cur_frm.add_fetch('ship_det_no', 'ship_to', 'ship_to');
+cur_frm.add_fetch('company', 'default_currency', 'currency');
+
+
+// ============== Customer and its primary contact Details ============================
+cur_frm.cscript.customer = function(doc, cdt, cdn) {
+  if(doc.customer){
+    if (!doc.company) {
+      msgprint("Please select company to proceed");
+      doc.customer = '';
+      refresh_field('customer');
+    } else {
+      var callback = function(r, rt){
+	    	cur_frm.refresh();
+      }
+      $c_obj(make_doclist(doc.doctype, doc.name), 'get_customer_details', '',callback);
+    }
+  }
+}
+
+//====================opens territory tree page ==================
+cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
+  var call_back = function(){
+
+    var sb_obj = new SalesBrowser();        
+    sb_obj.set_val('Territory');
+  }
+  loadpage('Sales Browser',call_back);
+}
+
+//====================opens customer group tree page ==================
+cur_frm.cscript.CGHelp = function(doc,dt,dn){
+	var call_back = function(){
+		var sb_obj = new SalesBrowser();				
+		sb_obj.set_val('Customer Group');
+	}
+	loadpage('Sales Browser',call_back);
+}
+
+/*
+// ============= Customer's Contact Person Details =====================================
+cur_frm.cscript.contact_person = function(doc, cdt, cdn) {
+  var callback = function(){
+    refresh_many(['contact_no','email_id','customer_mobile_no','customer_address']);
+  }
+  get_server_fields('get_contact_details','','',doc, cdt, cdn, 1, callback);
+}
+*/
+
+// TRIGGERS FOR CALCULATIONS
+// =====================================================================================================
+
+// ********************* CURRENCY ******************************
+cur_frm.cscript.currency = function(doc, cdt, cdn) {     
+	cur_frm.cscript.price_list_name(doc, cdt, cdn);
+}
+
+// ******************** PRICE LIST ******************************
+cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
+  var fname = cur_frm.cscript.fname;
+  if(doc.price_list_name && doc.currency) {
+    $c_obj(make_doclist(doc.doctype, doc.name), 'get_adj_percent', '',
+      function(r, rt) {
+        refresh_field(fname);
+        var doc = locals[cdt][cdn];
+        cur_frm.cscript.recalc(doc,3);    //this is to re-calculate BASIC RATE and AMOUNT on basis of changed REF RATE
+      }
+    );
+  }
+}
+
+
+// ******************* CONVERSION RATE ***************************
+cur_frm.cscript.conversion_rate = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 3);/*cur_frm.cscript.price_list_name(doc, cdt, cdn);*/ }
+
+// ******************** ITEM CODE ******************************** 
+cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
+  if (doc.order_type == 'Maintenance')
+    return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+  else 
+    return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+}
+
+
+
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+  var fname = cur_frm.cscript.fname;
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    if (!doc.company) {
+      msgprint("Please select company to proceed");
+      d.item_code = '';
+      refresh_field('item_code', d.name, fname);
+    } else {
+      var callback = function(r, rt){
+        cur_frm.cscript.recalc(doc, 1);
+      }
+      get_server_fields('get_item_details',d.item_code, fname,doc,cdt,cdn,1,callback);
+    }
+  }
+  if(cur_frm.cscript.custom_item_code){
+  	cur_frm.cscript.custom_item_code(doc, cdt, cdn);
+  }
+}
+
+// *********************** QUANTITY ***************************
+cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
+  
+// ************************ DISCOUNT (%) ***********************
+cur_frm.cscript.adj_rate = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
+
+// ************************ REF RATE ****************************
+cur_frm.cscript.ref_rate = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  set_multiple(cur_frm.cscript.tname, d.name, {'export_rate': flt(d.ref_rate) * (100 - flt(d.adj_rate)) / 100}, cur_frm.cscript.fname);
+  cur_frm.cscript.recalc(doc, 3);
+}
+
+// *********************** BASIC RATE **************************
+cur_frm.cscript.basic_rate = function(doc, cdt, cdn) { 
+  var fname = cur_frm.cscript.fname;
+  var d = locals[cdt][cdn];;
+  if(!d.qty)
+  {
+    d.qty = 1;
+    refresh_field('qty', d.name, fname);
+
+  }
+  cur_frm.cscript.recalc(doc, 2); 
+}
+
+// ************************ EXPORT RATE *************************
+cur_frm.cscript.export_rate = function(doc,cdt,cdn) { cur_frm.cscript.recalc(doc, 3);}
+
+// ************* GET OTHER CHARGES BASED ON COMPANY *************
+cur_frm.fields_dict.charge.get_query = function(doc) {
+  return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus != 2 AND `tabOther Charges`.%(key)s LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
+}
+
+// ********************* Get Charges ****************************
+cur_frm.cscript['Get Charges'] = function(doc, cdt, cdn) {
+   $c_obj(make_doclist(doc.doctype,doc.name),'get_other_charges','', function(r, rt) { cur_frm.cscript['Calculate Charges'](doc, cdt, cdn);});
+}
+
+
+// CALCULATION OF TOTAL AMOUNTS
+// ======================================================================================================== 
+cur_frm.cscript.recalc = function(doc, n) {
+  if(!n)n=0;
+  doc = locals[doc.doctype][doc.name];
+  var tname = cur_frm.cscript.tname;
+  var fname = cur_frm.cscript.fname;
+  var sales_team = cur_frm.cscript.sales_team_fname;
+  var other_fname  = cur_frm.cscript.other_fname;
+  
+  if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
+
+  if(n > 0) cur_frm.cscript.update_fname_table(doc , tname , fname , n); // updates all values in table (i.e. amount, export amount, net total etc.)
+  
+  if(flt(doc.net_total) > 0) {
+    var cl = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+    for(var i = 0; i<cl.length; i++){
+      cl[i].total_tax_amount = 0;
+      cl[i].total_amount = 0;
+      cl[i].tax_amount = 0;                    // this is done to calculate other charges
+      cl[i].total = 0;
+      cl[i].item_wise_tax_detail = "";
+      if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
+        alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
+        validated = false;
+      }
+    }
+    cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
+  }
+  cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
+
+  // ******************* calculate allocated amount of sales person ************************
+  cl = getchildren('Sales Team', doc.name, sales_team);
+  for(var i=0;i<cl.length;i++) {
+    if (cl[i].allocated_percentage) {
+      cl[i].allocated_amount = flt(flt(doc.net_total)*flt(cl[i].allocated_percentage)/100);
+      refresh_field('allocated_amount', cl[i].name, sales_team);
+    }
+  }
+  doc.in_words = '';
+  doc.in_words_export = '';
+  refresh_many(['total_discount_rate','total_discount','net_total','total_commission','grand_total','rounded_total','grand_total_export','rounded_total_export','in_words','in_words_export','other_charges','other_charges_total']);
+  if(cur_frm.cscript.custom_recalc)cur_frm.cscript.custom_recalc(doc);
+}
+
+// ******* Calculation of total amounts of document (item amount + other charges)****************
+cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) {
+  doc = locals[doc.doctype][doc.name];
+  var net_total = 0; var other_charges_total = 0;
+  var cl = getchildren(tname, doc.name, fname);
+  for(var i = 0; i<cl.length; i++){
+    net_total += flt(cl[i].amount);
+  }
+  var d = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+  for(var j = 0; j<d.length; j++){
+    other_charges_total += flt(d[j].amount);
+  }
+  doc.net_total = flt(net_total);
+  doc.other_charges_total = flt(other_charges_total);
+  doc.grand_total = flt(flt(net_total) + flt(other_charges_total));
+  doc.rounded_total = Math.round(doc.grand_total);
+  doc.grand_total_export = flt(flt(doc.grand_total) / flt(doc.conversion_rate));
+  doc.rounded_total_export = Math.round(doc.grand_total_export);
+  doc.total_commission = flt(flt(net_total) * flt(doc.commission_rate) / 100);
+}
+
+// ******************************* OTHER CHARGES *************************************
+cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname) {
+  doc = locals[doc.doctype][doc.name];
+  // make display area
+  // ------------------
+
+  cur_frm.fields_dict['Other Charges Calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Other Charges:</b>';
+  var cl = getchildren(tname, doc.name, fname);
+  var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+  // make display table
+  // ------------------
+  var otc = make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
+  $y(otc,{marginTop:'8px'});
+  
+  var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
+  
+  
+  for(var i=0;i<cl.length;i++) {
+    net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
+    var prev_total = flt(cl[i].amount);
+    if(cl[i].item_tax_rate)
+      var check_tax = eval('var a='+cl[i].item_tax_rate+';a');        //to get in dictionary
+    
+    // Add Item Code in new Row 
+    //--------------------------
+    $td(otc,i+1,0).innerHTML = cl[i].item_code ? cl[i].item_code : cl[i].description;
+    
+    var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+    var total = net_total;
+    
+    for(var t=0;t<tax.length;t++){
+     
+      var account = tax[t].account_head;
+      $td(otc,0,t+1).innerHTML = account?account:'';
+      //Check For Rate
+      if(cl[i].item_tax_rate && check_tax[account]!=null)  {rate = flt(check_tax[account]);}
+      else               // if particular item doesn't have particular rate it will take other charges rate
+        rate = flt(tax[t].rate);
+      //Check For Rate and get tax amount
+      var tax_amount = cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t, cl[i], rate);
+      
+      //enter item_wise_tax_detail i.e. tax rate on each item
+      
+      item_wise_tax_detail = cur_frm.cscript.get_item_wise_tax_detail( doc, rate, cl, i, tax, t);
+      
+      // this is calculation part for all types
+      if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
+      tax[t].total_amount = flt(tax_amount.toFixed(2));     //stores actual tax amount in virtual field
+      tax[t].total_tax_amount = flt(prev_total.toFixed(2));      //stores total amount in virtual field
+      tax[t].tax_amount += flt(tax_amount.toFixed(2));       
+      var total_amount = flt(tax[t].tax_amount);
+      total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
+      set_multiple('RV Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)+flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
+      prev_total += flt(tax[t].total_amount);   // for previous row total
+      total += flt(tax[t].tax_amount);     // for adding total to previous amount
+      
+      if(tax[t].charge_type == 'Actual')
+        $td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
+      else
+        $td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
+      
+    }
+  }
+}
+cur_frm.cscript.check_charge_type_and_get_tax_amount = function( doc, tax, t, cl, rate, print_amt) {
+  doc = locals[doc.doctype][doc.name];
+  if (! print_amt) print_amt = 0;
+  var tax_amount = 0;
+  if(tax[t].charge_type == 'Actual') {
+    var value = flt(tax[t].rate) / flt(doc.net_total);   // this give the ratio in which all items are divided           
+    return tax_amount = flt(value) * flt(cl.amount);
+   }   
+  else if(tax[t].charge_type == 'On Net Total') {
+    if (flt(print_amt) == 1) {
+      doc.excise_rate = flt(rate);
+      doc.total_excise_rate += flt(rate);
+      refresh_field('excise_rate');
+      refresh_field('total_excise_rate');
+      return
+    }
+    return tax_amount = (flt(rate) * flt(cl.amount) / 100);
+  }
+  else if(tax[t].charge_type == 'On Previous Row Amount'){
+    if(flt(print_amt) == 1) {
+      doc.total_excise_rate += flt(flt(doc.excise_rate) * 0.01 * flt(rate));
+      refresh_field('total_excise_rate');
+      return
+    }
+    var row_no = (tax[t].row_id).toString();
+    var row = (row_no).split("+");      // splits the values and stores in an array
+    for(var r = 0;r<row.length;r++){
+      var id = cint(row[r].replace(/^\s+|\s+$/g,""));
+      tax_amount += (flt(rate) * flt(tax[id-1].total_amount) / 100);
+    }
+    var row_id = row_no.indexOf("/");
+    if(row_id != -1) {
+      rate = '';
+      var row = (row_no).split("/");      // splits the values and stores in an array
+      if(row.length>2) alert("You cannot enter more than 2 nos. for division");
+      var id1 = cint(row[0].replace(/^\s+|\s+$/g,""));
+      var id2 = cint(row[1].replace(/^\s+|\s+$/g,""));
+      tax_amount = flt(tax[id1-1].total_amount) / flt(tax[id2-1].total_amount);
+    }
+    return tax_amount
+  }
+  else if(tax[t].charge_type == 'On Previous Row Total') {
+    if(flt(print_amt) == 1) {
+      doc.sales_tax_rate += flt(rate);
+      refresh_field('sales_tax_rate');
+      return
+    }
+    var row = cint(tax[t].row_id);
+    return tax_amount = flt(rate) * (flt(tax[row-1].total_tax_amount)+flt(tax[row-1].total_amount)) / 100;
+  }
+}
+
+// ********************** Update values in table ******************************
+cur_frm.cscript.update_fname_table = function(doc , tname , fname , n) {
+  doc = locals[doc.doctype][doc.name] 
+  var net_total = 0
+  var cl = getchildren(tname, doc.name, fname);
+  for(var i=0;i<cl.length;i++) {
+    if(n == 1){
+      if(flt(cl[i].ref_rate) > 0)
+        set_multiple(tname, cl[i].name, {'export_rate': flt(flt(cl[i].ref_rate) * (100 - flt(cl[i].adj_rate)) / 100)}, fname);
+      set_multiple(tname, cl[i].name, {'export_amount': flt(flt(cl[i].qty) * flt(cl[i].export_rate)), 'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate)), 'amount': flt((flt(cl[i].export_rate) * flt(doc.conversion_rate)) * flt(cl[i].qty)) }, fname);
+    }
+    else if(n == 2){
+      if(flt(cl[i].ref_rate) > 0)
+        set_multiple(tname, cl[i].name, {'adj_rate': 100 - flt(flt(cl[i].basic_rate)  * 100 / (flt(cl[i].ref_rate) * flt(doc.conversion_rate)))}, fname);
+      set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(cl[i].basic_rate)), 'export_rate': flt(flt(cl[i].basic_rate) / flt(doc.conversion_rate)), 'export_amount': flt((flt(cl[i].basic_rate) / flt(doc.conversion_rate)) * flt(cl[i].qty)) }, fname);
+    }
+    else if(n == 3){
+      set_multiple(tname, cl[i].name, {'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate))}, fname);
+      set_multiple(tname, cl[i].name, {'amount' : flt(flt(cl[i].basic_rate) * flt(cl[i].qty)), 'export_amount': flt(flt(cl[i].export_rate) * flt(cl[i].qty))}, fname);
+      if(cl[i].ref_rate > 0)
+        set_multiple(tname, cl[i].name, {'adj_rate': 100 - flt(flt(cl[i].export_rate) * 100 / flt(cl[i].ref_rate)), 'base_ref_rate': flt(flt(cl[i].ref_rate) * flt(doc.conversion_rate)) }, fname);
+    }
+    net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
+  }
+  doc.net_total = net_total;
+  refresh_field('net_total');
+}
+
+cur_frm.cscript.get_item_wise_tax_detail = function( doc, rate, cl, i, tax, t) {
+  doc = locals[doc.doctype][doc.name];
+  var detail = '';
+  detail = cl[i].item_code + " : " + cstr(rate) + NEWLINE;
+  return detail;
+}
+
+// **************** RE-CALCULATE VALUES ***************************
+
+cur_frm.cscript['Re-Calculate Values'] = function(doc, cdt, cdn) {  
+  cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);
+}
+
+cur_frm.cscript['Calculate Charges'] = function(doc, cdt, cdn) {
+  var other_fname  = cur_frm.cscript.other_fname;
+
+  var cl = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
+  for(var i = 0; i<cl.length; i++){
+    cl[i].total_tax_amount = 0;
+    cl[i].total_amount = 0;
+    cl[i].tax_amount = 0;                    // this is done to calculate other charges
+    cl[i].total = 0;
+    if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
+      alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
+      validated = false;
+    }
+  }
+  cur_frm.cscript.recalc(doc, 1);
+}
+
+// Get Sales Partner Commission
+// =================================================================================
+cur_frm.cscript.sales_partner = function(doc, cdt, cdn){
+  if(doc.sales_partner){
+
+    get_server_fields('get_comm_rate', doc.sales_partner, '', doc, cdt, cdn, 1);
+  }
+}
+
+// *******Commission Rate Trigger (calculates total commission amount)*********
+cur_frm.cscript.commission_rate = function(doc, cdt, cdn) {
+  if(doc.commission_rate > 100){
+    alert("Commision rate cannot be greater than 100.");
+    doc.total_commission = 0;
+    doc.commission_rate = 0;
+  }
+  else
+    doc.total_commission = doc.net_total * doc.commission_rate / 100;
+  refresh_many(['total_commission','commission_rate']);
+
+}
+
+// *******Total Commission Trigger (calculates commission rate)*********
+cur_frm.cscript.total_commission = function(doc, cdt, cdn) {
+  if(doc.net_total){
+    if(doc.net_total < doc.total_commission){
+      alert("Total commission cannot be greater than net total.");
+      doc.total_commission = 0;
+      doc.commission_rate = 0;
+    }
+    else
+      doc.commission_rate = doc.total_commission * 100 / doc.net_total;
+    refresh_many(['total_commission','commission_rate']);
+  }
+}
+// Sales Person Allocated % trigger 
+// ==============================================================================
+cur_frm.cscript.allocated_percentage = function(doc, cdt, cdn) {
+  var fname = cur_frm.cscript.sales_team_fname;
+  var d = locals[cdt][cdn];
+  if (d.allocated_percentage) {
+    d.allocated_amount = flt(flt(doc.net_total)*flt(d.allocated_percentage)/100);
+    refresh_field('allocated_amount', d.name, fname);
+  }
+}
+
+// Client Side Validation
+// =================================================================================
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+  cur_frm.cscript.validate_items(doc);
+  var cl = getchildren('Other Charges', doc.name, 'other_charges');
+  for(var i =0;i<cl.length;i++) {
+    if(!cl[i].amount) {
+      alert("Please Enter Amount in Row no. "+cl[i].idx+" in Other Charges table");
+      validated = false;
+    }
+  }
+  cur_frm.cscript['Calculate Charges'] (doc, cdt, cdn);
+
+  if (cur_frm.cscript.calc_adjustment_amount) cur_frm.cscript.calc_adjustment_amount(doc);
+}
+
+
+// ************** Atleast one item in document ****************
+cur_frm.cscript.validate_items = function(doc) {
+  var cl = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
+  if(!cl.length){
+    alert("Please enter Items for " + doc.doctype);
+    validated = false;
+  }
+}
+
diff --git a/crm/doctype/sales_common/sales_common.py b/crm/doctype/sales_common/sales_common.py
new file mode 100644
index 0000000..f99853b
--- /dev/null
+++ b/crm/doctype/sales_common/sales_common.py
@@ -0,0 +1,759 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d,dl
+
+		self.doctype_dict = {
+			'Sales Order'		: 'Sales Order Detail',
+			'Delivery Note'		: 'Delivery Note Detail',
+			'Receivable Voucher':'RV Detail',
+			'Installation Note' : 'Installed Item Details'
+		}
+												 
+		self.ref_doctype_dict= {}
+
+		self.next_dt_detail = {
+			'delivered_qty' : 'Delivery Note Detail',
+			'billed_qty'		: 'RV Detail',
+			'installed_qty' : 'Installed Item Details'}
+
+		self.msg = []
+
+
+	# Get Sales Person Details
+	# ==========================
+	def get_sales_person_details(self, obj):
+		if obj.doc.doctype != 'Quotation':
+			obj.doc.clear_table(obj.doclist,'sales_team')
+			idx = 0
+			for d in sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % obj.doc.customer):
+				ch = addchild(obj.doc, 'sales_team', 'Sales Team', 1, obj.doclist)
+				ch.sales_person = d and cstr(d[0]) or ''
+				ch.allocated_percentage = d and flt(d[1]) or 0
+				ch.allocated_amount = d and flt(d[2]) or 0
+				ch.incentives = d and flt(d[3]) or 0
+				ch.idx = idx
+				idx += 1
+
+
+	# Get customer's contact person details
+	# ==============================================================
+	def get_contact_details(self, obj = '', primary = 0):
+		cond = " and contact_name = '"+cstr(obj.doc.contact_person)+"'"
+		if primary: cond = " and is_primary_contact = 'Yes'"
+		contact = sql("select contact_name, contact_no, email_id, contact_address from `tabContact` where customer = '%s' and docstatus != 2 %s" %(obj.doc.customer, cond), as_dict = 1)
+		if not contact:
+			return
+		c = contact[0]
+		obj.doc.contact_person = c['contact_name'] or ''
+		obj.doc.contact_no = c['contact_no'] or ''
+		obj.doc.email_id = c['email_id'] or ''
+		obj.doc.customer_mobile_no = c['contact_no'] or ''
+		if c['contact_address']:
+			obj.doc.customer_address = c['contact_address']
+
+
+	# Get customer's primary shipping details
+	# ==============================================================
+	def get_shipping_details(self, obj = ''):
+		det = sql("select name, ship_to, shipping_address from `tabShipping Address` where customer = '%s' and docstatus != 2 and ifnull(is_primary_address, 'Yes') = 'Yes'" %(obj.doc.customer), as_dict = 1)
+		obj.doc.ship_det_no = det and det[0]['name'] or ''
+		obj.doc.ship_to = det and det[0]['ship_to'] or ''
+		obj.doc.shipping_address = det and det[0]['shipping_address'] or ''
+
+
+	# get invoice details
+	# ====================
+	def get_invoice_details(self, obj = ''):
+		if obj.doc.company:
+			acc_head = sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + get_value('Company', obj.doc.company, 'abbr')))
+			obj.doc.debit_to = acc_head and acc_head[0][0] or ''
+
+
+	# Get Customer Details along with its primary contact details
+	# ==============================================================
+	def get_customer_details(self, obj = '', inv_det_reqd = 1):
+		details = sql("select customer_name,address, territory, customer_group, default_sales_partner, default_commission_rate from `tabCustomer` where name = '%s' and docstatus != 2" %(obj.doc.customer), as_dict = 1)
+		obj.doc.customer_name = details and details[0]['customer_name'] or ''
+		obj.doc.customer_address =	details and details[0]['address'] or ''
+		obj.doc.territory = details and details[0]['territory'] or ''
+		obj.doc.customer_group	=	details and details[0]['customer_group'] or ''
+		obj.doc.sales_partner	 =	details and details[0]['default_sales_partner'] or ''
+		obj.doc.commission_rate =	details and flt(details[0]['default_commission_rate']) or ''
+		if obj.doc.doctype != 'Receivable Voucher':
+			obj.doc.delivery_address =	details and details[0]['address'] or ''
+			self.get_contact_details(obj,primary = 1) # get primary contact details
+		self.get_sales_person_details(obj) # get default sales person details
+
+		if obj.doc.doctype == 'Receivable Voucher' and inv_det_reqd:
+			self.get_invoice_details(obj) # get invoice details
+	
+	
+	# Get Item Details
+	# ===============================================================
+	def get_item_details(self, item_code, obj):
+		if not obj.doc.price_list_name:
+			msgprint("Please Select Price List before selecting Items")
+			raise Exception
+		item = sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, description_html from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life >	now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" %(item_code), as_dict=1)
+		tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
+		t = {}
+		for x in tax: t[x[0]] = flt(x[1])
+		ret = {
+			'description'								 : item and item[0]['description_html'] or item[0]['description'],
+			'item_group'									: item and item[0]['item_group'] or '',
+			'item_name'									 : item and item[0]['item_name'] or '',
+			'brand'											 : item and item[0]['brand'] or '',
+			'stock_uom'									 : item and item[0]['stock_uom'] or '',
+			'reserved_warehouse'					: item and item[0]['default_warehouse'] or '',
+			'warehouse'									 : item and item[0]['default_warehouse'] or '',
+			'income_account'							: item and item[0]['default_income_account'] or '',
+			'cost_center'								 : item and item[0]['default_sales_cost_center'] or '',
+			'qty'												 : 1.00,	 # this is done coz if item once fetched is fetched again thn its qty shld be reset to 1
+			'adj_rate'										: 0,
+			'amount'											: 0,
+			'export_amount'							 : 0,
+			'item_tax_rate'							 : str(t),
+			'batch_no'										: ''
+		}
+		if(obj.doc.price_list_name and item):	#this is done to fetch the changed BASIC RATE and REF RATE based on PRICE LIST
+			ref_rate =	self.get_ref_rate(item_code, obj.doc.price_list_name, obj.doc.currency)
+			ret['ref_rate'] = flt(ref_rate)
+			ret['export_rate'] = flt(ref_rate)
+			ret['base_ref_rate'] = flt(ref_rate) * flt(obj.doc.conversion_rate)
+			ret['basic_rate'] = flt(ref_rate) * flt(obj.doc.conversion_rate)
+			
+		if obj.doc.doctype == 'Receivable Voucher':
+			return ret
+		return str(ret)
+	
+	# ***************** Get Ref rate as entered in Item Master ********************
+	def get_ref_rate(self, item_code, price_list_name, currency):
+		ref_rate = sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, currency))
+		return ref_rate and ref_rate[0][0] or 0
+
+		
+	# ****** Re-calculates Basic Rate & amount based on Price List Selected ******
+	def get_adj_percent(self, obj): 
+		for d in getlist(obj.doclist, obj.fname):
+			ref_rate = self.get_ref_rate(d.item_code,obj.doc.price_list_name,obj.doc.currency)
+			d.adj_rate = 0
+			d.ref_rate = flt(ref_rate)
+			d.basic_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
+			d.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
+			d.export_rate = flt(ref_rate)
+
+
+	# Load Default Taxes
+	# ====================
+	def load_default_taxes(self, obj):
+		self.get_other_charges(obj,1)
+
+		
+	# Get other charges from Master
+	# =================================================================================
+	def get_other_charges(self,obj,default = 0):
+		obj.doc.clear_table(obj.doclist,'other_charges')
+		if not getlist(obj.doclist, 'other_charges'):
+			if default: add_cond = 'ifnull(t2.is_default,0) = 1'
+			else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
+			idx = 0
+			other_charge = sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
+			for other in other_charge:
+				d =	addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist)
+				d.charge_type = other['charge_type']
+				d.row_id = other['row_id']
+				d.description = other['description']
+				d.account_head = other['account_head']
+				d.rate = flt(other['rate'])
+				d.tax_amount = flt(other['tax_amount'])
+				d.idx = idx
+				idx += 1
+			
+			
+	# Get TERMS AND CONDITIONS
+	# =======================================================================================
+	def get_tc_details(self,obj):
+		r = sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
+		if r: obj.doc.terms = r[0][0]
+
+#---------------------------------------- Get Tax Details -------------------------------#
+	def get_tax_details(self, item_code, obj):
+		tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
+		t = {}
+		for x in tax: t[x[0]] = flt(x[1])
+		ret = {
+			'item_tax_rate'		:	tax and str(t) or ''
+		}
+		return str(ret)
+
+	# Get Serial No Details
+	# ==========================================================================
+	def get_serial_details(self, serial_no, obj):
+		item = sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
+		tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item[0]['item_code'])
+		t = {}
+		for x in tax: t[x[0]] = flt(x[1])
+		ret = {
+			'item_code'				: item and item[0]['item_code'] or '',
+			'make'						 : item and item[0]['make'] or '',
+			'label'						: item and item[0]['label'] or '',
+			'brand'						: item and item[0]['brand'] or '',
+			'description'			: item and item[0]['description'] or '',
+			'item_tax_rate'		: str(t)
+		}
+		return str(ret)
+		
+	# Get Commission rate
+	# =======================================================================
+	def get_comm_rate(self, sales_partner, obj):
+
+		comm_rate = sql("select commission_rate from `tabSales Partner` where name = '%s' and docstatus != 2" %(sales_partner), as_dict=1)
+		if comm_rate:
+			total_comm = flt(comm_rate[0]['commission_rate']) * flt(obj.doc.net_total) / 100
+			ret = {
+				'commission_rate'		 :	comm_rate and flt(comm_rate[0]['commission_rate']) or 0,
+				'total_commission'		:	flt(total_comm)
+			}
+			return str(ret)
+		else:
+			msgprint("Business Associate : %s does not exist in the system." % (sales_partner))
+			raise Exception
+
+	
+	# To verify whether rate entered in details table does not exceed max discount %
+	# =======================================================================================
+	def validate_max_discount(self,obj, detail_table):
+		for d in getlist(obj.doclist, detail_table):
+			discount = sql("select max_discount from tabItem where name = '%s'" %(d.item_code),as_dict = 1)
+			if discount and discount[0]['max_discount'] and (flt(d.adj_rate)>flt(discount[0]['max_discount'])):
+				msgprint("You cannot give more than " + cstr(discount[0]['max_discount']) + " % discount on Item Code : "+cstr(d.item_code))
+				raise Exception
+
+
+	# Get sum of allocated % of sales person (it should be 100%)
+	# ========================================================================
+	# it indicates % contribution of sales person in sales
+	def get_allocated_sum(self,obj):
+		sum = 0
+		for d in getlist(obj.doclist,'sales_team'):
+			sum += flt(d.allocated_percentage)
+		if (flt(sum) != 100) and getlist(obj.doclist,'sales_team'):
+			msgprint("Total Allocated % of Sales Persons should be 100%")
+			raise Exception
+			
+	# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
+	# ===========================================================================
+	def check_conversion_rate(self, obj):
+		default_currency = get_obj('Manage Account').doc.default_currency
+		company_currency = sql("select default_currency from `tabCompany` where name = '%s'" % obj.doc.company)
+		curr = company_currency and cstr(company_currency[0][0]) or default_currency
+		if (obj.doc.currency == curr and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != curr and flt(obj.doc.conversion_rate) == 1.00):
+			msgprint("Please Enter Appropriate Conversion Rate.")
+			raise Exception
+	
+
+	# Get Tax rate if account type is TAX
+	# =========================================================================
+	def get_rate(self, arg):
+		arg = eval(arg)
+		rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s' and docstatus != 2" %(arg['account_head']), as_dict=1)
+		ret = {'rate' : 0}
+		if arg['charge_type'] == 'Actual' and rate[0]['account_type'] == 'Tax':
+			msgprint("You cannot select ACCOUNT HEAD of type TAX as your CHARGE TYPE is 'ACTUAL'")
+			ret = {
+				'account_head'	:	''
+			}
+		elif rate[0]['account_type'] in ['Tax', 'Chargeable'] and not arg['charge_type'] == 'Actual':
+			ret = {
+				'rate'	:	rate and flt(rate[0]['tax_rate']) or 0
+			}
+		return cstr(ret)
+		
+
+	# Make Packing List from Sales BOM
+	# =======================================================================
+	def has_sales_bom(self, item_code):
+		return sql("select name from `tabSales BOM` where name=%s and docstatus != 2", item_code)
+	
+	def get_sales_bom_items(self, item_code):
+		return sql("select item_code, qty, uom from `tabSales BOM Detail` where parent=%s", item_code)
+
+
+	# --------------
+	# get item list
+	# --------------
+	def get_item_list(self, obj, is_stopped):
+		il = []
+		for d in getlist(obj.doclist,obj.fname):
+			reserved_qty = 0		# used for delivery note
+			qty = flt(d.qty)
+			if is_stopped:
+				qty = flt(d.qty) > flt(d.delivered_qty) and flt(flt(d.qty) - flt(d.delivered_qty)) or 0
+				
+			if d.prevdoc_doctype == 'Sales Order':			# used in delivery note to reduce reserved_qty 
+				# Eg.: if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12.
+				# But in this case reserved qty should only be reduced by 10 and not 12.
+
+				tot_qty, max_qty, tot_amt, max_amt = self.get_curr_and_ref_doc_details(d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Sales Order Detail', obj.doc.name, obj.doc.doctype)
+				if((flt(tot_qty) + flt(qty) > flt(max_qty))):
+					reserved_qty = -(flt(max_qty)-flt(tot_qty))
+				else:	
+					reserved_qty = - flt(qty)
+			
+			warehouse = (obj.fname == "sales_order_details") and d.reserved_warehouse or d.warehouse
+			
+			if self.has_sales_bom(d.item_code):
+				for i in self.get_sales_bom_items(d.item_code):
+					il.append([warehouse, i[0], flt(flt(i[1])* qty), reserved_qty, i[2], d.batch_no, d.serial_no])
+			else:
+				il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no])
+		return il
+
+
+	# -----------------------
+	# add packing list items
+	# -----------------------
+	def get_packing_item_details(self, item):
+		return sql("select item_name, description, stock_uom from `tabItem` where name = %s", item, as_dict = 1)[0]
+
+	def get_bin_qty(self, item, warehouse):
+		det = sql("select actual_qty, projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item, warehouse), as_dict = 1)
+		return det and det[0] or ''
+
+	def add_packing_list_item(self,obj, item_code, qty, warehouse, line):
+		bin = self.get_bin_qty(item_code, warehouse)
+		item = self.get_packing_item_details(item_code)
+		pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Detail', 1, obj.doclist)
+		pi.parent_item = item_code
+		pi.item_code = item_code
+		pi.item_name = item['item_name']
+		pi.parent_detail_docname = line.name
+		pi.description = item['description']
+		pi.uom = item['stock_uom']
+		pi.qty = flt(qty)
+		pi.actual_qty = bin and flt(bin['actual_qty']) or 0
+		pi.projected_qty = bin and flt(bin['projected_qty']) or 0
+		pi.warehouse = warehouse
+		pi.prevdoc_doctype = line.prevdoc_doctype
+		pi.serial_no = cstr(line.serial_no)
+		pi.idx = self.packing_list_idx
+		self.packing_list_idx += 1
+
+
+	# ------------------
+	# make packing list from sales bom if exists or directly copy item with balance
+	# ------------------ 
+	def make_packing_list(self, obj, fname):
+		obj.doc.clear_table(obj.doclist, 'packing_details')
+		self.packing_list_idx = 0
+		for d in getlist(obj.doclist, fname):
+			warehouse = fname == "sales_order_details" and d.reserved_warehouse or d.warehouse
+			if self.has_sales_bom(d.item_code):
+				for i in self.get_sales_bom_items(d.item_code):
+					self.add_packing_list_item(obj, i[0], flt(i[1])*flt(d.qty), warehouse, d)
+			else:
+				self.add_packing_list_item(obj, d.item_code, d.qty, warehouse, d)
+
+
+	# Get total in words
+	# ==================================================================	
+	def get_total_in_words(self, currency, amount):
+		from webnotes.utils import money_in_words
+		return money_in_words(amount, currency)
+		
+
+	# Get month based on date (required in sales person and sales partner)
+	# ========================================================================
+	def get_month(self,date):
+		month_list = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
+		month_idx = cint(cstr(date).split('-')[1])-1
+		return month_list[month_idx]
+		
+		
+	# **** Check for Stop SO as no transactions can be made against Stopped SO. Need to unstop it. ***
+	def check_stop_sales_order(self,obj):
+		for d in getlist(obj.doclist,obj.fname):
+			ref_doc_name = ''
+			if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_doctype == 'Sales Order':
+				ref_doc_name = d.prevdoc_docname
+			elif d.fields.has_key('sales_order') and d.sales_order and not d.delivery_note:
+				ref_doc_name = d.sales_order
+			if ref_doc_name:
+				so_status = sql("select status from `tabSales Order` where name = %s",ref_doc_name)
+				so_status = so_status and so_status[0][0] or ''
+				if so_status == 'Stopped':
+					msgprint("You cannot do any transaction against Sales Order : '%s' as it is Stopped." %(ref_doc_name))
+					raise Exception
+					
+					
+	# ****** Check for Item.is_sales_item = 'Yes' and Item.docstatus != 2 *******
+	def check_active_sales_items(self,obj):
+		for d in getlist(obj.doclist, obj.fname):
+			if d.item_code:		# extra condn coz item_code is not mandatory in RV
+				valid_item = sql("select docstatus,is_sales_item, is_service_item from tabItem where name = %s",d.item_code)
+				if valid_item and valid_item[0][0] == 2:
+					msgprint("Item : '%s' does not exist in system." %(d.item_code))
+					raise Exception
+				sales_item = valid_item and valid_item[0][1] or 'No'
+				service_item = valid_item and valid_item[0][2] or 'No'
+				if sales_item == 'No' and service_item == 'No':
+					msgprint("Item : '%s' is neither Sales nor Service Item"%(d.item_code))
+					raise Exception
+
+
+# **************************************************************************************************************************************************
+
+	def check_credit(self,obj,grand_total):
+		acc_head = sql("select name from `tabAccount` where company = '%s' and master_name = '%s'"%(obj.doc.company, obj.doc.customer))
+		if acc_head:
+			tot_outstanding = 0
+			dbcr = sql("select sum(debit), sum(credit) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No')='No'" % acc_head[0][0])
+			if dbcr:
+				tot_outstanding = flt(dbcr[0][0])-flt(dbcr[0][1])
+
+			exact_outstanding = flt(tot_outstanding) + flt(grand_total)
+			get_obj('Account',acc_head[0][0]).check_credit_limit(acc_head[0][0], obj.doc.company, exact_outstanding)
+
+	def validate_fiscal_year(self,fiscal_year,transaction_date,dn):
+		fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year)
+		ysd=fy and fy[0][0] or ""
+		yed=add_days(str(ysd),365)
+		if str(transaction_date) < str(ysd) or str(transaction_date) > str(yed):
+			msgprint("%s not within the fiscal year"%(dn))
+			raise Exception
+
+	# Check Approving Authority
+	# -------------------------
+	def check_approving_authority(self, doctype_name, grand_total):
+		det = sql("select amount from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount <= '%s'" % (doctype_name, grand_total))
+		amt_list, auth_users = [], []
+		if det:
+			for x in det:
+				amt_list.append(flt(x[0]))
+			max_amount = max(amt_list)
+			# Get names of all approving authority with max amount
+			for d in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount = '%s'" % (doctype_name, flt(max_amount))): auth_users.append(d[0])
+			for x in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount > '%s'" % (doctype_name, grand_total)): auth_users.append(x[0])
+			if not has_common(auth_users, session['data']['profile']['roles']):
+				msgprint("You do not have an authority to submit this %s. Only %s can submit since amount exceeds %s. %s" % (doctype_name, auth_users, get_defaults()['currency'], flt(max_amount)))
+				raise Exception
+
+	# get against document date	self.prevdoc_date_field
+	#-----------------------------
+	def get_prevdoc_date(self, obj):
+		import datetime
+		for d in getlist(obj.doclist, obj.fname):
+			if d.prevdoc_doctype and d.prevdoc_docname:
+				if d.prevdoc_doctype == 'Receivable Voucher':
+					dt = sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
+				else:
+					dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
+				d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
+
+	def update_prevdoc_detail(self, is_submit, obj):
+		StatusUpdater(obj, is_submit).update()
+
+	# ---------------------------------------------------------------------------------------------
+	# get qty, amount already billed or delivered against curr line item for current doctype
+	# For Eg: SO-RV get total qty, amount from SO and also total qty, amount against that SO in RV
+	# ---------------------------------------------------------------------------------------------
+	def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
+		# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
+		if curr_parent_doctype == 'Installation Note':
+			curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
+			qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
+		else:
+			curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
+			qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
+
+		# get total qty of ref doctype
+		ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
+		max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
+
+		return qty, max_qty, amt, max_amt
+
+
+
+
+
+#
+# make item code readonly if (detail no is set)
+#
+
+
+class StatusUpdater:
+	"""
+		Updates the status of the calling records
+		
+		From Delivery Note 
+			- Update Delivered Qty
+			- Update Percent
+			- Validate over delivery
+			
+		From Receivable Voucher 
+			- Update Billed Qty
+			- Update Percent
+			- Validate over billing
+			
+		From Installation Note
+			- Update Installed Qty
+			- Update Percent Qty
+			- Validate over installation
+	"""
+	def __init__(self, obj, is_submit):
+		self.obj = obj # caller object
+		self.is_submit = is_submit
+		self.tolerance = {}
+		self.global_tolerance = None
+	
+	def update(self):
+		self.update_all_qty()
+		self.validate_all_qty()
+	
+	def validate_all_qty(self):
+		"""
+			Validates over-billing / delivery / installation in Delivery Note, Receivable Voucher, Installation Note
+			To called after update_all_qty
+		"""
+		if self.obj.doc.doctype=='Delivery Note':
+			self.validate_qty({
+				'source_dt'		:'Delivery Note Detail',
+				'compare_field'	:'delivered_qty',
+				'target_dt'		:'Sales Order Detail',
+				'join_field'	:'prevdoc_detail_docname'
+			})
+		elif self.obj.doc.doctype=='Receivable Voucher':
+			self.validate_qty({
+				'source_dt'		:'RV Detail',
+				'compare_field'	:'billed_qty',
+				'target_dt'		:'Sales Order Detail',
+				'join_field'	:'so_detail'
+			})
+		elif self.obj.doc.doctype=='Installation Note':
+			self.validate_qty({
+				'source_dt'		:'Installation Item Details',
+				'compare_field'	:'installed_qty',
+				'target_dt'		:'Delivery Note Detail',
+				'join_field'	:'dn_detail'
+			}, no_tolerance =1);
+
+	
+	def get_tolerance_for(self, item_code):
+		"""
+			Returns the tolerance for the item, if not set, returns global tolerance
+		"""
+		if self.tolerance.get(item_code):
+			return self.tolerance[item_code]
+		
+		tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
+
+		if not(tolerance):
+			if self.global_tolerance == None:
+				self.global_tolerance = flt(get_value('Manage Account',None,'tolerance') or 0)
+			tolerance = self.global_tolerance
+		
+		self.tolerance[item_code] = tolerance
+		return tolerance
+		
+	def check_overflow_with_tolerance(self, item, args):
+		"""
+			Checks if there is overflow condering a relaxation tolerance
+		"""
+		
+		# check if overflow is within tolerance
+		tolerance = self.get_tolerance_for(item['item_code'])
+		overflow_percent = ((item[args['compare_field']] - item['qty']) / item['qty'] * 100)
+	
+		if overflow_percent - tolerance > 0.0001:
+			item['max_allowed'] = flt(item['qty'] * (100+tolerance)/100)
+			item['reduce_by'] = cint(item[args['compare_field']] - item['max_allowed'])
+		
+			msgprint("""
+				Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against <b>%(parenttype)s %(parent)s</b> is <b>%(max_allowed)s</b>. 
+				
+				If you want to increase your overflow tolerance, please increase tolerance %% in Global Defaults or Item master. 
+				
+				Or, you must reduce the qty by %(reduce_by)s""" % item, raise_exception=1)
+
+	def validate_qty(self, args, no_tolerance=None):
+		"""
+			Updates qty at row level
+		"""
+		# get unique transactions to update
+		for d in self.obj.doclist:
+			if d.doctype == args['source_dt']:
+				args['name'] = d.fields[args['join_field']]
+
+				# get all qty where qty > compare_field
+				item = sql("""
+					select item_code, qty, `%(compare_field)s`, parenttype, parent from `tab%(target_dt)s` 
+					where qty < `%(compare_field)s` and name="%(name)s" and docstatus=1
+					""" % args, as_dict=1)
+				
+				if item:
+					item = item[0]
+					item['idx'] = d.idx
+					
+					if no_tolerance:
+						item['reduce_by'] = item[args['compare_field']] - item['qty']
+						msgprint("""
+							Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against 
+							<b>%(parenttype)s %(parent)s</b> is <b>%(qty)s</b>. 
+							
+							You must reduce the qty by %(reduce_by)s""" % item, raise_exception=1)
+						
+					else:
+						self.check_overflow_with_tolerance(item, args)
+						
+	
+	def update_all_qty(self):
+		"""
+			Updates delivered / billed / installed qty in Sales Order & Delivery Note
+		"""
+		if self.obj.doc.doctype=='Delivery Note':
+			self.update_qty({
+				'target_field'			:'delivered_qty',
+				'target_dt'				:'Sales Order Detail',
+				'target_parent_dt'		:'Sales Order',
+				'target_parent_field'	:'per_delivered',
+				'source_dt'				:'Delivery Note Detail',
+				'source_field'			:'qty',
+				'join_field'			:'prevdoc_detail_docname',
+				'percent_join_field'	:'prevdoc_docname',
+				'status_field'			:'delivery_status',
+				'keyword'				:'Delivered'
+			})
+			
+		elif self.obj.doc.doctype=='Receivable Voucher':
+			self.update_qty({
+				'target_field'			:'billed_qty',
+				'target_dt'				:'Sales Order Detail',
+				'target_parent_dt'		:'Sales Order',
+				'target_parent_field'	:'per_billed',
+				'source_dt'				:'RV Detail',
+				'source_field'			:'qty',
+				'join_field'			:'so_detail',
+				'percent_join_field'	:'sales_order',
+				'status_field'			:'billing_status',
+				'keyword'				:'Billed'
+			})
+
+			self.update_qty({
+				'target_field'			:'billed_qty',
+				'target_dt'				:'Delivery Note Detail',
+				'target_parent_dt'		:'Delivery Note',
+				'target_parent_field'	:'per_billed',
+				'source_dt'				:'RV Detail',
+				'source_field'			:'qty',
+				'join_field'			:'dn_detail',
+				'percent_join_field'	:'delivery_note',
+				'status_field'			:'billing_status',
+				'keyword'				:'Billed'
+			})
+
+		if self.obj.doc.doctype=='Installation Note':
+			self.update_qty({
+				'target_field'			:'installed_qty',
+				'target_dt'				:'Delivery Note Detail',
+				'target_parent_dt'		:'Delivery Note',
+				'target_parent_field'	:'per_installed',
+				'source_dt'				:'Installed Item Details',
+				'source_field'			:'qty',
+				'join_field'			:'prevdoc_detail_docname',
+				'percent_join_field'	:'prevdoc_docname',
+				'status_field'			:'installation_status',
+				'keyword'				:'Installed'
+			})
+
+
+	def update_qty(self, args):
+		"""
+			Updates qty at row level
+		"""
+		# condition to include current record (if submit or no if cancel)
+		if self.is_submit:
+			args['cond'] = ' or parent="%s"' % self.obj.doc.name
+		else:
+			args['cond'] = ' and parent!="%s"' % self.obj.doc.name
+		
+		# update quantities in child table
+		for d in self.obj.doclist:
+			if d.doctype == args['source_dt']:
+				# updates qty in the child table
+				args['detail_id'] = d.fields.get(args['join_field'])
+			
+				if args['detail_id']:
+					sql("""
+						update 
+							`tab%(target_dt)s` 
+						set 
+							%(target_field)s = (select sum(qty) from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" and (docstatus=1 %(cond)s))
+						where
+							name="%(detail_id)s"
+					""" % args)			
+		
+		# get unique transactions to update
+		for name in set([d.fields.get(args['percent_join_field']) for d in self.obj.doclist if d.doctype == args['source_dt']]):
+			if name:
+				args['name'] = name
+				
+				# update percent complete in the parent table
+				if args.get('source_dt')!='Installed Item Details':
+					sql("""
+						update 
+							`tab%(target_parent_dt)s` 
+						set 
+							%(target_parent_field)s = (
+								(select sum(amount) from `tab%(source_dt)s` where `%(percent_join_field)s`="%(name)s" and (docstatus=1 %(cond)s)) 
+								/ net_total
+								* 100
+							)
+							where
+								name="%(name)s"
+						""" % args)
+				else:
+					sql("""
+						update 
+							`tab%(target_parent_dt)s` 
+						set 
+							%(target_parent_field)s = (
+								(select sum(qty) from `tab%(source_dt)s` where `%(percent_join_field)s`="%(name)s" and (docstatus=1 %(cond)s)) 
+								/ (select sum(qty) from `tab%(target_dt)s` where parent="%(name)s" and docstatus=1) 
+								* 100
+							)
+							where
+								name="%(name)s"
+						""" % args)
+					
+
+				# update field
+				if args['status_field']:
+					sql("""
+						update
+							`tab%(target_parent_dt)s` 
+						set
+							%(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001, 'Not %(keyword)s', 
+									if(%(target_parent_field)s>=99.99, 'Fully %(keyword)s', 'Partly %(keyword)s')
+								)
+						where
+							name="%(name)s"
+					""" % args)
+
diff --git a/crm/doctype/sales_common/sales_common.txt b/crm/doctype/sales_common/sales_common.txt
new file mode 100644
index 0000000..df360cb
--- /dev/null
+++ b/crm/doctype/sales_common/sales_common.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-09 15:26:59', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 342, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Sales Common', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-30 22:12:20', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/crm/doctype/sales_order/__init__.py b/crm/doctype/sales_order/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/sales_order/__init__.py
diff --git a/crm/doctype/sales_order/sales_order.js b/crm/doctype/sales_order/sales_order.js
new file mode 100644
index 0000000..48da9ca
--- /dev/null
+++ b/crm/doctype/sales_order/sales_order.js
@@ -0,0 +1,353 @@
+// Module CRM
+
+cur_frm.cscript.tname = "Sales Order Detail";
+cur_frm.cscript.fname = "sales_order_details";
+cur_frm.cscript.other_fname = "other_charges";
+cur_frm.cscript.sales_team_fname = "sales_team";
+
+
+$import(Sales Common)
+$import(Other Charges)
+$import(SMS Control)
+
+
+// ONLOAD
+// ================================================================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+  if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+  // load default charges
+  
+  if(doc.__islocal){
+    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
+  }   
+  
+
+}
+
+cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
+  if(doc.__islocal) {
+    if(doc.quotation) cur_frm.cscript['Pull Quotation Details'](doc,cdt,cdn);
+  } else {
+	cur_frm.cscript.load_taxes(doc, cdt, cdn);
+  } 
+}
+
+// REFRESH
+// ================================================================================================
+cur_frm.cscript.get_open_status = function(doc) {
+  var open_delivery = 0; var open_invoicing=0;
+  var ch = getchildren('Sales Order Detail',doc.name,'sales_order_details');
+  for(var i in ch){
+  	if(ch[i].qty > ch[i].delivered_qty) open_delivery = 1;
+  	if(ch[i].qty > ch[i].billed_qty) open_invoicing = 1;
+    if(ch[i].amount > ch[i].billed_amt) open_invoicing = 1;
+  }	
+  return [open_delivery, open_invoicing];
+}
+
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.clear_custom_buttons();
+  
+  var open_status = cur_frm.cscript.get_open_status(doc);
+  if(doc.docstatus==1) {
+  	if(doc.status != 'Stopped') {
+	    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+  	  // delivery note
+  	  if(open_status[0] && doc.order_type!='Maintenance')
+        cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
+  	  
+  	  // maintenance
+  	  if(open_status[0] && doc.order_type=='Maintenance') {
+        cur_frm.add_custom_button('Make Maint. Visit', cur_frm.cscript['Make Maintenance Visit']);
+        cur_frm.add_custom_button('Make Maint. Schedule', cur_frm.cscript['Make Maintenance Schedule']);
+  	  }
+
+      // indent
+      if(doc.order_type != 'Maintenance')
+        cur_frm.add_custom_button('Make Indent', cur_frm.cscript['Make Indent']);
+  	  
+      // sales invoice
+  	  if(open_status[1])
+        cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
+      
+      // stop
+      if(open_status[0] || open_status[1])
+        cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']);
+  } else {
+  	
+  	  // un-stop
+  	  cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
+  }
+  	
+    unhide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
+  } else {
+  	hide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
+  }
+
+}
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0);
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.cscript['Pull Quotation Details'] = function(doc,dt,dn) {
+  var callback = function(r,rt){
+    var doc = locals[cur_frm.doctype][cur_frm.docname];          
+    if(r.message){              
+      doc.quotation_no = r.message;      
+		  if(doc.quotation_no) {		      
+  			  unhide_field(['quotation_date','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);			    			  
+  			  if(doc.customer) get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0);
+		  }		  
+		  cur_frm.refresh();
+    }
+  } 
+
+ $c_obj(make_doclist(doc.doctype, doc.name),'pull_quotation_details','',callback);
+}
+
+
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+  tn = createLocal('Contact');
+  locals['Contact'][tn].is_customer = 1;
+  if(doc.customer) locals['Contact'][tn].customer = doc.customer;
+  loaddoc('Contact', tn);
+}
+
+// DOCTYPE TRIGGERS
+// ================================================================================================
+
+/*
+// ***************** get shipping address based on customer selected *****************
+cur_frm.fields_dict['ship_det_no'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabShipping Address`.`name`, `tabShipping Address`.`ship_to`, `tabShipping Address`.`shipping_address` FROM `tabShipping Address` WHERE `tabShipping Address`.customer = "'+ doc.customer+'" AND `tabShipping Address`.`docstatus` != 2 AND `tabShipping Address`.`name` LIKE "%s" ORDER BY `tabShipping Address`.name ASC LIMIT 50';
+}
+*/
+
+
+// ***************** Get project name *****************
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  var cond = '';
+  if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
+  return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
+}
+
+//---- get customer details ----------------------------
+cur_frm.cscript.project_name = function(doc,cdt,cdn){
+  $c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
+    refresh_many(['customer','customer_name', 'customer_address', 'contact_person', 'territory', 'contact_no', 'email_id', 'customer_group']);
+  });
+  
+}
+
+
+
+// *************** Customized link query for QUOTATION ***************************** 
+cur_frm.fields_dict['quotation_no'].get_query = function(doc) {
+  var cond='';
+  if(doc.order_type) cond = ' ifnull(`tabQuotation`.order_type, "") = "'+doc.order_type+'" and';
+  if(doc.customer) cond += ' ifnull(`tabQuotation`.customer, "") = "'+doc.customer+'" and';
+  
+  return repl('SELECT DISTINCT name, customer, transaction_date  FROM `tabQuotation` WHERE `tabQuotation`.company = "' + doc.company + '" and `tabQuotation`.`docstatus` = 1 and `tabQuotation`.status != "Order Lost" and %(cond)s `tabQuotation`.%(key)s LIKE "%s" ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond});
+}
+
+
+// SALES ORDER DETAILS TRIGGERS
+// ================================================================================================
+
+// ***************** Get available qty in warehouse of item selected **************** 
+cur_frm.cscript.reserved_warehouse = function(doc, cdt , cdn) {
+  var d = locals[cdt][cdn];
+  if (d.reserved_warehouse) {
+    arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.reserved_warehouse +"'}";
+    get_server_fields('get_available_qty',arg,'sales_order_details',doc,cdt,cdn,1);
+  }
+}
+
+//----------- make maintenance schedule----------
+cur_frm.cscript['Make Maintenance Schedule'] = function() {
+  var doc = cur_frm.doc;
+
+  if (doc.docstatus == 1) { 
+    $c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_schedule','',
+      function(r,rt){
+        if(r.message == 'No'){
+          n = createLocal("Maintenance Schedule");
+          $c('dt_map', args={
+                  'docs':compress_doclist([locals["Maintenance Schedule"][n]]),
+                  'from_doctype':'Sales Order',
+                  'to_doctype':'Maintenance Schedule',
+                  'from_docname':doc.name,
+            'from_to_list':"[['Sales Order', 'Maintenance Schedule'], ['Sales Order Detail', 'Item Maintenance Detail']]"
+          }
+          , function(r,rt) {
+            loaddoc("Maintenance Schedule", n);
+          }
+          );
+        }
+        else{
+          msgprint("You have already created Maintenance Schedule against this Sales Order");
+        }
+      }
+    );
+  }
+}
+
+//------------ make maintenance visit ------------
+cur_frm.cscript['Make Maintenance Visit'] = function() {
+  var doc = cur_frm.doc;
+
+  if (doc.docstatus == 1) { 
+    $c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
+      function(r,rt){
+        if(r.message == 'No'){
+          n = createLocal("Maintenance Visit");
+          $c('dt_map', args={
+                  'docs':compress_doclist([locals["Maintenance Visit"][n]]),
+                  'from_doctype':'Sales Order',
+                  'to_doctype':'Maintenance Visit',
+                  'from_docname':doc.name,
+            'from_to_list':"[['Sales Order', 'Maintenance Visit'], ['Sales Order Detail', 'Maintenance Visit Detail']]"
+          }
+          , function(r,rt) {
+            loaddoc("Maintenance Visit", n);
+          }
+          );
+        }
+        else{
+          msgprint("You have already completed maintenance against this Sales Order");
+        }
+      }
+    );
+  }
+}
+
+// make indent
+// ================================================================================================
+cur_frm.cscript['Make Indent'] = function() {
+  var doc = cur_frm.doc;
+  if (doc.docstatus == 1) { 
+  n = createLocal("Indent");
+  $c('dt_map', args={
+          'docs':compress_doclist([locals["Indent"][n]]),
+          'from_doctype':'Sales Order',
+          'to_doctype':'Indent',
+          'from_docname':doc.name,
+    'from_to_list':"[['Sales Order', 'Indent'], ['Sales Order Detail', 'Indent Detail']]"
+  }
+  , function(r,rt) {
+    loaddoc("Indent", n);
+    }
+    );
+  }
+}
+
+
+// MAKE DELIVERY NOTE
+// ================================================================================================
+cur_frm.cscript['Make Delivery Note'] = function() {
+  var doc = cur_frm.doc;
+  if (doc.docstatus == 1) { 
+  n = createLocal("Delivery Note");
+  $c('dt_map', args={
+          'docs':compress_doclist([locals["Delivery Note"][n]]),
+          'from_doctype':'Sales Order',
+          'to_doctype':'Delivery Note',
+          'from_docname':doc.name,
+    'from_to_list':"[['Sales Order', 'Delivery Note'], ['Sales Order Detail', 'Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+  }
+  , function(r,rt) {
+    loaddoc("Delivery Note", n);
+    }
+    );
+  }
+}
+
+
+// MAKE SALES INVOICE
+// ================================================================================================
+cur_frm.cscript['Make Sales Invoice'] = function() {
+  var doc = cur_frm.doc;
+
+  n = createLocal('Receivable Voucher');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Receivable Voucher'][n]]),
+    'from_doctype':doc.doctype,
+    'to_doctype':'Receivable Voucher',
+    'from_docname':doc.name,
+    'from_to_list':"[['Sales Order','Receivable Voucher'],['Sales Order Detail','RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+    }, function(r,rt) {
+       loaddoc('Receivable Voucher', n);
+    }
+  );
+}
+
+
+// STOP SALES ORDER
+// ==================================================================================================
+cur_frm.cscript['Stop Sales Order'] = function() {
+  var doc = cur_frm.doc;
+
+  var check = confirm("Are you sure you want to STOP " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'stop_sales_order', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });
+  }
+}
+
+// UNSTOP SALES ORDER
+// ==================================================================================================
+cur_frm.cscript['Unstop Sales Order'] = function() {
+  var doc = cur_frm.doc;
+
+  var check = confirm("Are you sure you want to UNSTOP " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'unstop_sales_order', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });
+  }
+}
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+
diff --git a/crm/doctype/sales_order/sales_order.py b/crm/doctype/sales_order/sales_order.py
new file mode 100644
index 0000000..e1e15f1
--- /dev/null
+++ b/crm/doctype/sales_order/sales_order.py
@@ -0,0 +1,487 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.tname = 'Sales Order Detail'
+    self.fname = 'sales_order_details'
+    self.person_tname = 'Target Detail'
+    self.partner_tname = 'Partner Target Detail'
+    self.territory_tname = 'Territory Target Detail'
+
+# Autoname
+# ===============
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+    
+# DOCTYPE TRIGGER FUNCTIONS
+# =============================
+  # Pull Quotation Details
+  # -----------------------
+  def pull_quotation_details(self):
+    self.doc.clear_table(self.doclist, 'other_charges')
+    self.doc.clear_table(self.doclist, 'sales_order_details')
+    self.doc.clear_table(self.doclist, 'sales_team')
+    self.doc.clear_table(self.doclist, 'tc_details')
+    if self.doc.quotation_no:        
+      get_obj('DocType Mapper', 'Quotation-Sales Order').dt_map('Quotation', 'Sales Order', self.doc.quotation_no, self.doc, self.doclist, "[['Quotation', 'Sales Order'],['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team'],['TC Detail','TC Detail']]")      
+    else:
+      msgprint("Please select Quotation whose details need to pull")    
+
+    return cstr(self.doc.quotation_no)
+  
+  #pull project customer
+  #-------------------------
+  def pull_project_customer(self):
+    res = sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
+    if res:
+      get_obj('DocType Mapper', 'Project-Sales Order').dt_map('Project', 'Sales Order', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Order']]")
+      
+  
+  # Get Customer Details
+  # ---------------------
+  #def get_customer_details(self):
+  #  sales_com_obj = get_obj('Sales Common')
+  #  sales_com_obj.get_customer_details(self)
+  #  sales_com_obj.get_shipping_details(self)
+
+  # Get contact person details based on customer selected
+  # ------------------------------------------------------
+  def get_contact_details(self):
+    get_obj('Sales Common').get_contact_details(self,0)
+
+  # Get Commission rate of Sales Partner
+  # -------------------------------------
+  def get_comm_rate(self, sales_partner):
+    return get_obj('Sales Common').get_comm_rate(sales_partner, self)
+
+  # Clear Sales Order Details Table
+  # --------------------------------
+  def clear_sales_order_details(self):
+    self.doc.clear_table(self.doclist, 'sales_order_details')
+    
+
+# SALES ORDER DETAILS TRIGGER FUNCTIONS
+# ================================================================================
+  # Get Item Details
+  # ----------------
+  def get_item_details(self, item_code):
+    return get_obj('Sales Common').get_item_details(item_code, self)
+
+  # Re-calculates Basic Rate & amount based on Price List Selected
+  # --------------------------------------------------------------
+  def get_adj_percent(self, arg=''):
+    get_obj('Sales Common').get_adj_percent(self)
+
+  # Get projected qty of item based on warehouse selected
+  # -----------------------------------------------------
+  def get_available_qty(self,args):
+    args = eval(args)
+    tot_avail_qty = sql("select projected_qty, actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
+    ret = {
+       'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
+       'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
+    }
+    return cstr(ret)
+  
+  
+# OTHER CHARGES TRIGGER FUNCTIONS
+# ====================================================================================
+  
+  # Get Tax rate if account type is TAX
+  # ------------------------------------
+  def get_rate(self,arg):
+    return get_obj('Sales Common').get_rate(arg)
+
+  # Load Default Charges
+  # ----------------------------------------------------------
+  def load_default_taxes(self):
+    return get_obj('Sales Common').load_default_taxes(self)
+
+  # Pull details from other charges master (Get Other Charges)
+  # ----------------------------------------------------------
+  def get_other_charges(self):
+    return get_obj('Sales Common').get_other_charges(self)
+ 
+ 
+# GET TERMS & CONDITIONS
+# =====================================================================================
+  def get_tc_details(self):
+    return get_obj('Sales Common').get_tc_details(self)
+
+#check if maintenance schedule already generated
+#============================================
+  def check_maintenance_schedule(self):
+    nm = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", self.doc.name)
+    nm = nm and nm[0][0] or ''
+    
+    if not nm:
+      return cstr('No')
+
+#check if maintenance visit already generated
+#============================================
+  def check_maintenance_visit(self):
+    nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
+    nm = nm and nm[0][0] or ''
+    
+    if not nm:
+      return cstr('No')
+
+# VALIDATE
+# =====================================================================================
+  # Fiscal Year Validation
+  # ----------------------
+  def validate_fiscal_year(self):
+    get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Sales Order Date')
+  
+  # Validate values with reference document
+  #----------------------------------------
+  def validate_reference_value(self):
+    get_obj('DocType Mapper', 'Quotation-Sales Order', with_children = 1).validate_reference_value(self, self.doc.name)
+
+  # Validate Mandatory
+  # -------------------
+  def validate_mandatory(self):
+    # validate transaction date v/s delivery date
+    if self.doc.delivery_date:
+      if getdate(self.doc.transaction_date) > getdate(self.doc.delivery_date):
+        msgprint("Expected Delivery Date cannot be before Sales Order Date")
+        raise Exception
+
+  # Validate P.O Date
+  # ------------------
+  def validate_po_date(self):
+    # validate p.o date v/s delivery date
+    if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) >= getdate(self.doc.delivery_date):
+      msgprint("Expected Delivery Date cannot be before Purchase Order Date")
+      raise Exception  
+    # amendment date is necessary if document is amended
+    if self.doc.amended_from and not self.doc.amendment_date:
+      msgprint("Please Enter Amendment Date")
+      raise Exception
+  
+  # Validations of Details Table
+  # -----------------------------
+  def validate_for_items(self):
+    check_list,flag = [],0
+    chk_dupl_itm = []
+    # Sales Order Details Validations
+    for d in getlist(self.doclist, 'sales_order_details'):
+      if cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
+        flag = 1
+      if d.prevdoc_docname:
+        if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
+          msgprint("Sales Order Date cannot be before Quotation Date")
+          raise Exception
+        # validates whether quotation no in doctype and in table is same
+        if not cstr(d.prevdoc_docname) == cstr(self.doc.quotation_no):
+          msgprint("Items in table does not belong to the Quotation No mentioned.")
+          raise Exception
+
+      # validates whether item is not entered twice
+      e = [d.item_code, d.description, d.reserved_warehouse, d.prevdoc_docname or '']
+      f = [d.item_code, d.description]
+
+      #check item is stock item
+      st_itm = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
+
+      if st_itm and st_itm[0][0] == 'Yes':
+        if e in check_list:
+          msgprint("Item %s has been entered twice." % d.item_code)
+        else:
+          check_list.append(e)
+      elif st_itm and st_itm[0][0]== 'No':
+        if f in chk_dupl_itm:
+          msgprint("Item %s has been entered twice." % d.item_code)
+        else:
+          chk_dupl_itm.append(f)
+
+      # used for production plan
+      d.transaction_date = self.doc.transaction_date
+      d.delivery_date = self.doc.delivery_date
+
+      # gets total projected qty of item in warehouse selected (this case arises when warehouse is selected b4 item)
+      tot_avail_qty = sql("select projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
+      d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
+    
+    if flag == 0:
+      msgprint("There are no items of the quotation selected.")
+      raise Exception
+
+  # validate sales/ service item against order type
+  #----------------------------------------------------
+  def validate_sales_mntc_item(self):
+    if self.doc.order_type == 'Maintenance':
+      item_field = 'is_service_item'
+      order_type = 'Maintenance Order'
+      item_type = 'service item'
+    else :
+      item_field = 'is_sales_item'
+      order_type = 'Sales Order'
+      item_type = 'sales item'
+    
+    for d in getlist(self.doclist, 'sales_order_details'):
+      res = sql("select %s from `tabItem` where name='%s'"% (item_field,d.item_code))
+      res = res and res[0][0] or 'No'
+      
+      if res == 'No':
+        msgprint("You can not select non "+item_type+" "+d.item_code+" in "+order_type)
+        raise Exception
+  
+  # validate sales/ maintenance quotation against order type
+  #------------------------------------------------------------------
+  def validate_sales_mntc_quotation(self):
+    for d in getlist(self.doclist, 'sales_order_details'):
+      if d.prevdoc_docname:
+        res = sql("select order_type from `tabQuotation` where name=%s", (d.prevdoc_docname))
+        res = res and res[0][0] or ''
+        
+        if self.doc.order_type== 'Maintenance' and res != 'Maintenance':
+          msgprint("You can not select non Maintenance Quotation against Maintenance Order")
+          raise Exception
+        elif self.doc.order_type != 'Maintenance' and res == 'Maintenance':
+          msgprint("You can not select non Sales Quotation against Sales Order")
+          raise Exception
+
+  #do not allow sales item/quotation in maintenance order and service item/quotation in sales order
+  #-----------------------------------------------------------------------------------------------
+  def validate_order_type(self):
+    #validate delivery date
+    if self.doc.order_type != 'Maintenance' and not self.doc.delivery_date:
+      msgprint("Please enter 'Expected Delivery Date'")
+      raise Exception
+    
+    self.validate_sales_mntc_quotation()
+    self.validate_sales_mntc_item()
+
+  #check for does customer belong to same project as entered..
+  #-------------------------------------------------------------------------------------------------
+  def validate_proj_cust(self):
+    if self.doc.project_name and self.doc.customer_name:
+      res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+      if not res:
+        msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
+        raise Exception
+       
+
+  # Validate
+  # ---------
+  def validate(self):
+    self.validate_fiscal_year()
+    self.validate_order_type()
+    self.validate_mandatory()
+    self.validate_proj_cust()
+    self.validate_po_date()
+    #self.validate_reference_value()
+    self.validate_for_items()
+    sales_com_obj = get_obj(dt = 'Sales Common')
+    sales_com_obj.check_active_sales_items(self)
+    sales_com_obj.check_conversion_rate(self)
+
+        # verify whether rate is not greater than max_discount
+    sales_com_obj.validate_max_discount(self,'sales_order_details')
+        # this is to verify that the allocated % of sales persons is 100%
+    sales_com_obj.get_allocated_sum(self)
+    sales_com_obj.make_packing_list(self,'sales_order_details')
+    
+        # get total in words
+    self.doc.in_words = sales_com_obj.get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
+    self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
+    
+    # set SO status
+    self.doc.status='Draft'
+    if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
+    if not self.doc.delivery_status: self.doc.delivery_status = 'Not Delivered'
+    
+
+# ON SUBMIT
+# ===============================================================================================
+  # Checks Quotation Status
+  # ------------------------
+  def check_prev_docstatus(self):
+    for d in getlist(self.doclist, 'sales_order_details'):
+      cancel_quo = sql("select name from `tabQuotation` where docstatus = 2 and name = '%s'" % d.prevdoc_docname)
+      if cancel_quo:
+        msgprint("Quotation :" + cstr(cancel_quo[0][0]) + " is already cancelled !")
+        raise Exception , "Validation Error. "
+  
+  def update_enquiry_status(self, prevdoc, flag):
+    enq = sql("select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.name=%s", prevdoc)
+    if enq:
+      sql("update `tabEnquiry` set status = %s where name=%s",(flag,enq[0][0]))
+
+  #update status of quotation, enquiry
+  #----------------------------------------
+  def update_prevdoc_status(self, flag):
+    for d in getlist(self.doclist, 'sales_order_details'):
+      if d.prevdoc_docname:
+        if flag=='submit':
+          sql("update `tabQuotation` set status = 'Order Confirmed' where name=%s",d.prevdoc_docname)
+          
+          #update enquiry
+          self.update_enquiry_status(d.prevdoc_docname, 'Order Confirmed')
+        elif flag == 'cancel':
+          chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Detail` t2 where t2.parent = t1.name and t2.prevdoc_docname=%s and t1.name!=%s and t1.docstatus=1", (d.prevdoc_docname,self.doc.name))
+          if not chk:
+            sql("update `tabQuotation` set status = 'Submitted' where name=%s",d.prevdoc_docname)
+            
+            #update enquiry
+            self.update_enquiry_status(d.prevdoc_docname, 'Quotation Sent')
+  
+  # Submit
+  # -------
+  def on_submit(self):
+    self.check_prev_docstatus()    
+    self.update_stock_ledger(update_stock = 1)
+    self.set_sms_msg(1)
+    # update customer's last sales order no.
+    update_customer = sql("update `tabCustomer` set last_sales_order = '%s', modified = '%s' where name = '%s'" %(self.doc.name, self.doc.modified, self.doc.customer))
+    get_obj('Sales Common').check_credit(self,self.doc.grand_total)
+    
+    # Check for Approving Authority
+    get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.grand_total, self)
+    
+    #update prevdoc status
+    self.update_prevdoc_status('submit')
+    # set SO status
+    set(self.doc, 'status', 'Submitted')
+  
+    # on submit notification    
+    if self.doc.email_id:
+      get_obj('Notification Control').notify_contact('Sales Order',self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
+        
+ 
+# ON CANCEL
+# ===============================================================================================
+  def on_cancel(self):
+    # Cannot cancel stopped SO
+    if self.doc.status == 'Stopped':
+      msgprint("Sales Order : '%s' cannot be cancelled as it is Stopped. Unstop it for any further transactions" %(self.doc.name))
+      raise Exception
+    self.check_nextdoc_docstatus()
+    self.update_stock_ledger(update_stock = -1)
+    self.set_sms_msg()
+    
+    #update prevdoc status
+    self.update_prevdoc_status('cancel')
+    
+    # ::::::::: SET SO STATUS ::::::::::
+    set(self.doc, 'status', 'Cancelled')
+    
+  # CHECK NEXT DOCSTATUS
+  # does not allow to cancel document if DN or RV made against it is SUBMITTED 
+  # ----------------------------------------------------------------------------
+  def check_nextdoc_docstatus(self):
+    # Checks Delivery Note
+    submit_dn = sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Detail` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
+    if submit_dn:
+      msgprint("Delivery Note : " + cstr(submit_dn[0][0]) + " has been submitted against " + cstr(self.doc.doctype) + ". Please cancel Delivery Note : " + cstr(submit_dn[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
+    # Checks Receivable Voucher
+    submit_rv = sql("select t1.name from `tabReceivable Voucher` t1,`tabRV Detail` t2 where t1.name = t2.parent and t2.sales_order = '%s' and t1.docstatus = 1" % (self.doc.name))
+    if submit_rv:
+      msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Sales Invoice : "+ cstr(submit_rv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
+    #check maintenance schedule
+    submit_ms = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
+    if submit_ms:
+      msgprint("Maintenance Schedule : " + cstr(submit_ms[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Schedule : "+ cstr(submit_ms[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
+    submit_mv = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
+    if submit_mv:
+      msgprint("Maintenance Visit : " + cstr(submit_mv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Visit : " + cstr(submit_mv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
+
+
+  def check_modified_date(self):
+    mod_db = sql("select modified from `tabSales Order` where name = '%s'" % self.doc.name)
+    date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
+    
+    if date_diff and date_diff[0][0]:
+      msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
+      raise Exception
+
+  # STOP SALES ORDER
+  # ==============================================================================================      
+  # Stops Sales Order & no more transactions will be created against this Sales Order
+  def stop_sales_order(self):
+    self.check_modified_date()
+    self.update_stock_ledger(update_stock = -1,clear = 1)
+    # ::::::::: SET SO STATUS ::::::::::
+    set(self.doc, 'status', 'Stopped')
+    msgprint(self.doc.doctype + ": " + self.doc.name + " has been Stopped. To make transactions against this Sales Order you need to Unstop it.")
+
+  # UNSTOP SALES ORDER
+  # ==============================================================================================      
+  # Unstops Sales Order & now transactions can be continued against this Sales Order
+  def unstop_sales_order(self):
+    self.check_modified_date()
+    self.update_stock_ledger(update_stock = 1,clear = 1)
+    # ::::::::: SET SO STATUS ::::::::::
+    set(self.doc, 'status', 'Submitted')
+    msgprint(self.doc.doctype + ": " + self.doc.name + " has been Unstopped.")
+
+  # UPDATE STOCK LEDGER
+  # ===============================================================================================
+  def update_stock_ledger(self, update_stock, clear = 0):
+    for d in self.get_item_list(clear):
+      stock_item = sql("SELECT is_stock_item FROM tabItem where name = '%s'"%(d[1]),as_dict = 1)       # stock ledger will be updated only if it is a stock item
+      if stock_item and stock_item[0]['is_stock_item'] == "Yes":
+        if not d[0]:
+          msgprint("Message: Please enter Reserved Warehouse for item %s as it is stock item."% d[1])
+          raise Exception
+        bin = get_obj('Warehouse', d[0]).update_bin( 0, flt(update_stock) * flt(d[2]), 0, 0, 0, d[1], self.doc.transaction_date)
+
+  # Gets Items from packing list
+  #=================================
+  def get_item_list(self, clear):
+    return get_obj('Sales Common').get_item_list( self, clear)
+    
+  # SET MESSAGE FOR SMS
+  #======================
+  def set_sms_msg(self, is_submitted = 0):
+    if is_submitted:
+      if not self.doc.amended_from:
+        msg = 'Sales Order: '+self.doc.name+' has been made against PO no: '+cstr(self.doc.po_no)
+        set(self.doc, 'message', msg)
+      else:
+        msg = 'Sales Order has been amended. New SO no:'+self.doc.name
+        set(self.doc, 'message', msg)
+    else:
+      msg = 'Sales Order: '+self.doc.name+' has been cancelled.'
+      set(self.doc, 'message', msg)
+    
+  # SEND SMS
+  # =========
+  def send_sms(self):
+    if not self.doc.customer_mobile_no:
+      msgprint("Please enter customer mobile no")
+    elif not self.doc.message:
+      msgprint("Please enter the message you want to send")
+    else:
+      msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.customer_mobile_no,], self.doc.message))
+
+  # on update
+  def on_update(self):
+    pass
+
+  # Repair Sales Order
+  # ===========================================
+  def repair_sales_order(self):
+    get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)
diff --git a/crm/doctype/sales_order/sales_order.txt b/crm/doctype/sales_order/sales_order.txt
new file mode 100644
index 0000000..f9d2aa4
--- /dev/null
+++ b/crm/doctype/sales_order/sales_order.txt
@@ -0,0 +1,3276 @@
+[
+	{
+		'_last_update': '1306899441',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': "cur_frm.add_fetch('customer','sales_person','sales_person');",
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': 1,
+		'issingle': 0,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'Sales Order',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'status,transaction_date,customer,customer_name, territory,order_type,company',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
+		'tag_fields': 'delivery_status,billing_status',
+		'use_template': None,
+		'version': 592
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00494',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00495',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00496',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00497',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': 'customer_name',
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00498',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Customer',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00499',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00500',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00501',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 9,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00502',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 10,
+		'match': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00503',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'FL05100',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 0,
+		'label': None,
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'FL05101',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'FL03010',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'SO\nSO/10-11/\nSO/11-12/',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:53',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select Customer',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'FL03778',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Customer Address',
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'FL03013',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Contact Person',
+		'modified': '2011-06-02 09:56:17',
+		'modified_by': 'Administrator',
+		'name': 'FL03014',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Contact',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03012',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05089',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05090',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05091',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05092',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03015',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'Category of customer as entered in Customer master',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Customer Group',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03060',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': 'Purchase Order sent by customer',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_no',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'P.O. No',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03016',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'po_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'P.O. Date',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03017',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'po_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05102',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Sales Order Date',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03019',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'order_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Order Type',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03009',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'order_type',
+		'oldfieldtype': 'Select',
+		'options': '\nSales\nMaintenance',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03011',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nStopped\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 1,
+		'label': 'Expected Delivery Date',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03020',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'delivery_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:53',
+		'default': None,
+		'depends_on': None,
+		'description': 'Track this Sales Order against any Project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03777',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': '% of materials delivered against this Sales Order',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_delivered',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': 1,
+		'label': '%  Delivered',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03021',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'per_delivered',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': '% of materials billed against this Sales Order',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_billed',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': '% Qty Billed',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03022',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'per_billed',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03025',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03026',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'shipping_address_name',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Shipping Address Name',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05094',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 17:00:43',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'shipping_address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': 0,
+		'label': 'Shipping Address',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': '000000170',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05103',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': 'Quotation no against which this Sales Order is made ',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'quotation_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': 1,
+		'label': 'Quotation No',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03028',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'quotation_no',
+		'oldfieldtype': 'Link',
+		'options': 'Quotation',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'quotation_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Quotation Date',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03029',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'quotation_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Pull Quotation Details',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03030',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'pull_quotation_details',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'price_list_name',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Price List',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03031',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'price_list_name',
+		'oldfieldtype': 'Select',
+		'options': 'link:Price List',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05104',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': "Customer's currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Currency',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03023',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': '1.00',
+		'depends_on': None,
+		'description': "Rate at which customer's currency is converted to your currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Conversion Rate',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03024',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05105',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Sales Order Details',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03032',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_order_details',
+		'oldfieldtype': 'Table',
+		'options': 'Sales Order Detail',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '40px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Clear Table',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03033',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'clear_sales_order_details',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Re-Calculate Values',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03035',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Net Total*',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03034',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Note1',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05106',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>NOTE :</b> * In Base Currency',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05107',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'charge',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Select Charges Master',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03038',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'charge',
+		'oldfieldtype': 'Link',
+		'options': 'Other Charges',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Get Charges',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03039',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Other Charges',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03040',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges',
+		'oldfieldtype': 'Table',
+		'options': 'RV Tax Detail',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Calculate Charges',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03041',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Charges Total*',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03042',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Grand Total*',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03043',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'OT Notes',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05108',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>NOTE :</b> * In Base Currency',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Other Charges Calculation',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05109',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05110',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Rounded Total',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03068',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rounded_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Sales Order.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03069',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05111',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': 'Grand Total (Export)',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03071',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Rounded Total (Export)',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03072',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rounded_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words (Export) will be visible once you save the Sales Order.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_export',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'In Words (Export)',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03073',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words_export',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05112',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03047',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03048',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05113',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': None,
+		'label': 'Term Details',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03050',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': 'Filling in additional information about the Sales Order will help you analyze your data better.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05114',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05115',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-12-14 10:33:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': None,
+		'label': 'Letter Head',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04196',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'letter_head',
+		'oldfieldtype': 'Select',
+		'options': 'link:Letter Head',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03053',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03054',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03057',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05116',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'source',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'Source',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03055',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'source',
+		'oldfieldtype': 'Select',
+		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': "eval:doc.source == 'Campaign'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'campaign',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': 'Campaign',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03056',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'campaign',
+		'oldfieldtype': 'Link',
+		'options': 'Campaign',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'note',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': 'Note',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03065',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'note',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03063',
+		'no_column': 0,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-06-01 09:07:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_status',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'Delivery Status',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05197',
+		'no_column': 0,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nBilled\nNot Billed\nPartly Billed\nClosed',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-06-01 09:07:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'billing_status',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 75,
+		'in_filter': None,
+		'label': 'Billing Status',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05196',
+		'no_column': 0,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nDelivered\nNot Delivered\nPartly Delivered\nClosed\nNot Applicable',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': 'Display all the individual items delivered with the main items',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': 0,
+		'icon': None,
+		'idx': 76,
+		'in_filter': None,
+		'label': 'Packing List',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05117',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'packing_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 77,
+		'in_filter': None,
+		'label': 'Packing Details',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03075',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'packing_details',
+		'oldfieldtype': 'Table',
+		'options': 'Delivery Note Packing Detail',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:32:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 78,
+		'in_filter': None,
+		'label': 'Sales Team',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL05118',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'Name as entered in Sales Partner master',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_partner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 79,
+		'in_filter': 1,
+		'label': 'Sales Partner',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03077',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_partner',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Partner',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'commission_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 80,
+		'in_filter': None,
+		'label': 'Commission Rate',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03078',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'commission_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_commission',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 81,
+		'in_filter': None,
+		'label': 'Total Commission',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03079',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_commission',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_team',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 82,
+		'in_filter': None,
+		'label': 'Sales Team1',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03080',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_team',
+		'oldfieldtype': 'Table',
+		'options': 'Sales Team',
+		'owner': 'Administrator',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 83,
+		'in_filter': None,
+		'label': 'Repair Sales Order',
+		'modified': '2011-06-02 09:56:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03093',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_sales_order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Sales Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/sales_order_detail/__init__.py b/crm/doctype/sales_order_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/sales_order_detail/__init__.py
diff --git a/crm/doctype/sales_order_detail/sales_order_detail.txt b/crm/doctype/sales_order_detail/sales_order_detail.txt
new file mode 100644
index 0000000..1eda61a
--- /dev/null
+++ b/crm/doctype/sales_order_detail/sales_order_detail.txt
@@ -0,0 +1,1037 @@
+[
+	{
+		'_last_update': '1304676470',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'SOD/.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'Sales Order Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 51
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03098',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Item Name',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03099',
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 0,
+		'label': 'Description',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03100',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Quantity',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03102',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_uom',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'UOM',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03101',
+		'no_copy': None,
+		'oldfieldname': 'stock_uom',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ref_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Ref Rate',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03103',
+		'no_copy': None,
+		'oldfieldname': 'ref_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'adj_rate',
+		'fieldtype': 'Float',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Discount(%)',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03104',
+		'no_copy': None,
+		'oldfieldname': 'adj_rate',
+		'oldfieldtype': 'Float',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'export_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03105',
+		'no_copy': None,
+		'oldfieldname': 'export_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'export_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03106',
+		'no_copy': 0,
+		'oldfieldname': 'export_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'base_ref_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Ref Rate*',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03107',
+		'no_copy': None,
+		'oldfieldname': 'base_ref_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'basic_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Basic Rate*',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03108',
+		'no_copy': None,
+		'oldfieldname': 'basic_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Amount*',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03109',
+		'no_copy': 0,
+		'oldfieldname': 'amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reserved_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Reserved Warehouse',
+		'modified': '2011-05-06 15:38:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03110',
+		'no_copy': 1,
+		'oldfieldname': 'reserved_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'projected_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Projected Qty',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03111',
+		'no_copy': 1,
+		'oldfieldname': 'projected_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-28 11:15:20',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Actual Qty',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL04493',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivered_qty',
+		'fieldtype': 'Currency',
+		'hidden': 0,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 0,
+		'label': 'Delivered Qty',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03112',
+		'no_copy': 1,
+		'oldfieldname': 'delivered_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'billed_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 0,
+		'label': 'Billed Qty',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03113',
+		'no_copy': 1,
+		'oldfieldname': 'billed_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-05 17:16:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'billed_amt',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Billed Amt',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL04748',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'For Production',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'planned_qty',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Planned Quantity',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03114',
+		'no_copy': 1,
+		'oldfieldname': 'planned_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'For Production',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'produced_qty',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Produced Quantity',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03115',
+		'no_copy': None,
+		'oldfieldname': 'produced_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Brand Name',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03116',
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Link',
+		'options': 'Brand',
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': 1,
+		'label': 'Item Group',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03117',
+		'no_copy': None,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'prevdoc_docname',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Quotation No.',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03118',
+		'no_copy': None,
+		'oldfieldname': 'prevdoc_docname',
+		'oldfieldtype': 'Link',
+		'options': 'Quotation',
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'page_break',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Page Break',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03120',
+		'no_copy': None,
+		'oldfieldname': 'page_break',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'required for production. will be used later.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Expected Delivery Date',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03122',
+		'no_copy': None,
+		'oldfieldname': 'delivery_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'required for production. will be used later.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'confirmation_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Confirmed Delivery Date',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03123',
+		'no_copy': None,
+		'oldfieldname': 'confirmation_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_tax_rate',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Item Tax Rate',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03119',
+		'no_copy': None,
+		'oldfieldname': 'item_tax_rate',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 28,
+		'in_filter': 0,
+		'label': 'Sales Order Date',
+		'modified': '2011-05-06 15:38:40',
+		'modified_by': 'Administrator',
+		'name': 'FL03121',
+		'no_copy': None,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Order Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/sales_team/__init__.py b/crm/doctype/sales_team/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/sales_team/__init__.py
diff --git a/crm/doctype/sales_team/sales_team.txt b/crm/doctype/sales_team/sales_team.txt
new file mode 100644
index 0000000..0ae2eb6
--- /dev/null
+++ b/crm/doctype/sales_team/sales_team.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-16 18:21:56', 'search_fields': None, 'module': 'CRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 7, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Sales Team', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-24 09:09:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-16 18:21:56', 'doctype': 'DocField', 'oldfieldname': 'sales_person', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Sales Person', 'width': '200px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales Team', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01421', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-24 09:09:57', 'parenttype': 'DocType', 'fieldname': 'sales_person', 'fieldtype': 'Link', 'options': 'Sales Person', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-27 09:44:18', 'doctype': 'DocField', 'oldfieldname': 'contact_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Contact No.', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Sales Team', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03680', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-24 09:09:57', 'parenttype': 'DocType', 'fieldname': 'contact_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-16 18:21:56', 'doctype': 'DocField', 'oldfieldname': 'allocated_percentage', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Allocated (%)', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales Team', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01422', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-24 09:09:57', 'parenttype': 'DocType', 'fieldname': 'allocated_percentage', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-16 18:21:56', 'doctype': 'DocField', 'oldfieldname': 'allocated_amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Allocated Amount', 'width': '120px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales Team', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01423', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-11-24 09:09:57', 'parenttype': 'DocType', 'fieldname': 'allocated_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-26 17:32:54', 'doctype': 'DocField', 'oldfieldname': 'parenttype', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'saumil@webnotestech.com', 'label': 'Parenttype', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Sales Team', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02191', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-11-24 09:09:57', 'parenttype': 'DocType', 'fieldname': 'parenttype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-07-20 13:14:29', 'doctype': 'DocField', 'oldfieldname': 'incentives', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Incentives', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales Team', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05663', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-24 09:09:57', 'parenttype': 'DocType', 'fieldname': 'incentives', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/crm/doctype/shipping_address/__init__.py b/crm/doctype/shipping_address/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/shipping_address/__init__.py
diff --git a/crm/doctype/shipping_address/shipping_address.comp.js b/crm/doctype/shipping_address/shipping_address.comp.js
new file mode 100755
index 0000000..c3deecf
--- /dev/null
+++ b/crm/doctype/shipping_address/shipping_address.comp.js
@@ -0,0 +1,2 @@
+
+cur_frm.add_fetch('customer','customer_name','customer_name');cur_frm.add_fetch('customer','address','customer_address');
\ No newline at end of file
diff --git a/crm/doctype/shipping_address/shipping_address.js b/crm/doctype/shipping_address/shipping_address.js
new file mode 100755
index 0000000..77c0d35
--- /dev/null
+++ b/crm/doctype/shipping_address/shipping_address.js
@@ -0,0 +1,4 @@
+// Get Customer Details
+// =====================================================================
+cur_frm.add_fetch('customer','customer_name','customer_name');
+cur_frm.add_fetch('customer','address','customer_address');
diff --git a/crm/doctype/shipping_address/shipping_address.py b/crm/doctype/shipping_address/shipping_address.py
new file mode 100755
index 0000000..76d3749
--- /dev/null
+++ b/crm/doctype/shipping_address/shipping_address.py
@@ -0,0 +1,25 @@
+import webnotes
+sql = webnotes.conn.sql
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  # on update
+  # ---------- 
+  def on_update(self):
+    self.update_primary_shipping_address()
+    self.get_customer_details()
+
+  # set is_primary_address for other shipping addresses belonging to same customer
+  # -------------------------------------------------------------------------------
+  def update_primary_shipping_address(self):
+    if self.doc.is_primary_address == 'Yes':
+      sql("update `tabShipping Address` set is_primary_address = 'No' where customer = %s and is_primary_address = 'Yes' and name != %s",(self.doc.customer, self.doc.name))
+
+  # Get Customer Details
+  # ---------------------
+  def get_customer_details(self):
+    det = sql("select customer_name, address from tabCustomer where name = '%s'" % (self.doc.customer))
+    self.doc.customer_name = det and det[0][0] or ''
+    self.doc.customer_address = det and det[0][1] or ''
diff --git a/crm/doctype/shipping_address/shipping_address.txt b/crm/doctype/shipping_address/shipping_address.txt
new file mode 100755
index 0000000..c059bbd
--- /dev/null
+++ b/crm/doctype/shipping_address/shipping_address.txt
@@ -0,0 +1,406 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'SA.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 11:01:06',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-24 10:39:09',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'Shipping Address',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'customer, ship_to, shipping_address',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 8
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 11:01:06',
+		'modified_by': 'Administrator',
+		'name': '000000259',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-05-09 11:01:06',
+		'modified_by': 'Administrator',
+		'name': '000000260',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer',
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-05-09 11:01:06',
+		'modified_by': 'Administrator',
+		'name': '000000261',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-09 11:01:06',
+		'modified_by': 'Administrator',
+		'name': '000000262',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ship_to',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Ship To',
+		'modified': '2011-05-09 11:01:06',
+		'modified_by': 'Administrator',
+		'name': '000000263',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'shipping_address',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Shipping Address',
+		'modified': '2011-05-09 11:01:06',
+		'modified_by': 'Administrator',
+		'name': '000000264',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 11:01:07',
+		'modified_by': 'Administrator',
+		'name': '000000265',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_primary_address',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Is Primary Address',
+		'modified': '2011-05-09 11:01:07',
+		'modified_by': 'Administrator',
+		'name': '000000266',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Yes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'shipping_details',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Shipping Details',
+		'modified': '2011-05-09 11:01:07',
+		'modified_by': 'Administrator',
+		'name': '000000267',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:01:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-09 11:01:07',
+		'modified_by': 'Administrator',
+		'name': '000000268',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Shipping Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/doctype/sms_center/__init__.py b/crm/doctype/sms_center/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/sms_center/__init__.py
diff --git a/crm/doctype/sms_center/sms_center.js b/crm/doctype/sms_center/sms_center.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/doctype/sms_center/sms_center.js
diff --git a/crm/doctype/sms_center/sms_center.py b/crm/doctype/sms_center/sms_center.py
new file mode 100644
index 0000000..5564347
--- /dev/null
+++ b/crm/doctype/sms_center/sms_center.py
@@ -0,0 +1,67 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+# ----------
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+      
+  def create_receiver_list(self):
+    rec, where_clause = '', ''
+    if self.doc.send_to == 'All Customer Contact':
+      where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(is_customer, 0) = 1"
+    if self.doc.send_to == 'All Supplier Contact':
+      where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(is_supplier, 0) = 1"
+    if self.doc.send_to == 'All Sales Partner Contact':
+      where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_aprtner = '%s'" % self.doc.sales_partner or " and ifnull(is_sales_partner, 0) = 1"
+    msgprint(1)
+    if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
+      msgprint("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
+      rec = sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
+    elif self.doc.send_to == 'All Lead (Open)':
+      rec = sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'")
+    elif self.doc.send_to == 'All Employee (Active)':
+      where_clause = self.doc.department and " and t1.department = '%s'" % self.doc.department or ""
+      where_clause += self.doc.branch and " and t1.branch = '%s'" % self.doc.branch or ""
+      rec = sql("select t1.employee_name, t2.cell_number from `tabEmployee` t1, `tabEmployee Profile` t2 where t2.employee = t1.name and t1.status = 'Active' and t1.docstatus != 2 and ifnull(t2.cell_number,'')!='' %s" % where_clause)
+    elif self.doc.send_to == 'All Sales Person':
+      rec = sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''")
+
+    rec_list = ''
+    for d in rec:
+      rec_list += d[0] + ' - ' + d[1] + '\n'
+    self.doc.receiver_list = rec_list
+
+  def get_receiver_nos(self):
+    receiver_nos = []
+    for d in self.doc.receiver_list.split('\n'):
+      receiver_no = d
+      if '-' in d:
+        receiver_no = receiver_no.split('-')[1]
+      if receiver_no.strip():
+        receiver_nos.append(cstr(receiver_no).strip())
+    return receiver_nos
+
+  def send_sms(self):
+    if not self.doc.message:
+      msgprint("Please enter message before sending")
+    else:
+      receiver_list = self.get_receiver_nos()
+      if receiver_list:
+        msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, cstr(self.doc.message)))
diff --git a/crm/doctype/sms_center/sms_center.txt b/crm/doctype/sms_center/sms_center.txt
new file mode 100644
index 0000000..23e379f
--- /dev/null
+++ b/crm/doctype/sms_center/sms_center.txt
@@ -0,0 +1,486 @@
+[
+	{
+		'allow_attach': 0,
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': 0,
+		'hide_toolbar': 0,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': 4,
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'SMS Center',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 1,
+		'smallicon': None,
+		'use_template': None,
+		'version': 36
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:24',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'PERM00532',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 0,
+		'creation': '2010-08-08 17:09:24',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'PERM00533',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-15 16:59:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'column_break1',
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL04772',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'send_to',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Send To',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL03352',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nAll Contact\nAll Customer Contact\nAll Supplier Contact\nAll Sales Partner Contact\nAll Lead (Open)\nAll Employee (Active)\nAll Sales Person',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': "eval:doc.send_to=='All Customer Contact'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL03353',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-01-11 15:10:58',
+		'default': None,
+		'depends_on': "eval:doc.send_to=='All Supplier Contact'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Supplier',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL04407',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-01-11 15:10:58',
+		'default': None,
+		'depends_on': "eval:doc.send_to=='All Employee (Active)'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Department',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL04409',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Department',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-01-11 15:10:58',
+		'default': None,
+		'depends_on': "eval:doc.send_to=='All Employee (Active)'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'branch',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Branch',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL04408',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Branch',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-11 16:55:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Create Receiver List',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL04411',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'create_receiver_list',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'receiver_list',
+		'fieldtype': 'Code',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Receiver List',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL03359',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-15 16:59:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'column_break2',
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL04773',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': 'Message greater than 160 character will be splitted into multiple mesage',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'message',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Message',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL03354',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Send SMS',
+		'modified': '2011-02-15 17:06:33',
+		'modified_by': 'Administrator',
+		'name': 'FL03357',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'send_sms',
+		'owner': 'Administrator',
+		'parent': 'SMS Center',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/crm/page/__init__.py b/crm/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/page/__init__.py
diff --git a/crm/page/customers/__init__.py b/crm/page/customers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/page/customers/__init__.py
diff --git a/crm/page/customers/customers.comp.js b/crm/page/customers/customers.comp.js
new file mode 100644
index 0000000..b6e831c
--- /dev/null
+++ b/crm/page/customers/customers.comp.js
@@ -0,0 +1,3 @@
+
+pscript.onload_customers=function(){make_customer_tab($i('dcv_customers'));}
+function make_customer_tab(parent){pscript.dcv_customers=new wn.widgets.DocColumnView('Customers',parent,['Customer Group','Customer','Contact'],{'Customer Group':{show_fields:['name'],create_fields:['name'],search_fields:['name'],next_col:'Customer'},'Customer':{show_fields:['name','customer_name'],create_fields:['name','customer_name'],search_fields:['customer_name'],filter_by:['Customer Group','customer_group'],next_col:'Contact'},'Contact':{show_fields:['name','first_name','last_name'],create_fields:['name','first_name','last_name'],search_fields:['first_name','last_name'],conditions:['is_customer=1'],set_values:{'is_customer':1},filter_by:['Customer','customer']},})}
\ No newline at end of file
diff --git a/crm/page/customers/customers.html b/crm/page/customers/customers.html
new file mode 100644
index 0000000..9f3d19c
--- /dev/null
+++ b/crm/page/customers/customers.html
@@ -0,0 +1 @@
+<div id="dcv_customers"></div>
\ No newline at end of file
diff --git a/crm/page/customers/customers.js b/crm/page/customers/customers.js
new file mode 100644
index 0000000..7902e24
--- /dev/null
+++ b/crm/page/customers/customers.js
@@ -0,0 +1,34 @@
+//make tabs
+
+pscript.onload_customers = function() {
+	make_customer_tab($i('dcv_customers'));
+}
+
+function make_customer_tab(parent) {	
+	pscript.dcv_customers = new wn.widgets.DocColumnView('Customers', parent, 
+		['Customer Group', 'Customer', 'Contact'], {
+		'Customer Group': { 
+			show_fields : ['name'],
+			create_fields : ['name'],
+			search_fields : ['name'],
+			next_col: 'Customer'
+		},
+		'Customer': { 
+			show_fields : ['name', 'customer_name'],
+			create_fields : ['name', 'customer_name'],
+			search_fields : ['customer_name'],
+			filter_by : ['Customer Group', 'customer_group'],
+			next_col: 'Contact'
+		},
+		'Contact': { 
+			show_fields : ['name', 'first_name', 'last_name'],
+			create_fields : ['name','first_name', 'last_name'],
+			search_fields : ['first_name', 'last_name'],
+			conditions: ['is_customer=1'],
+			set_values: {'is_customer': 1 },
+			filter_by : ['Customer', 'customer']
+		},
+	})
+}
+
+
diff --git a/crm/page/customers/customers.txt b/crm/page/customers/customers.txt
new file mode 100644
index 0000000..7f44ab45
--- /dev/null
+++ b/crm/page/customers/customers.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-03-25 13:48:50',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-03-25 13:48:50',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'customers',
+		'owner': 'Administrator',
+		'page_name': 'Customers',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file
diff --git a/crm/page/sales_browser/__init__.py b/crm/page/sales_browser/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/page/sales_browser/__init__.py
diff --git a/crm/page/sales_browser/sales_browser.html b/crm/page/sales_browser/sales_browser.html
new file mode 100644
index 0000000..1acb5ee
--- /dev/null
+++ b/crm/page/sales_browser/sales_browser.html
@@ -0,0 +1,4 @@
+<div class="layout_wrapper">
+<div id="tr_header"></div>
+<div id="tr_body" style="margin: 16px"></div>
+</div>
\ No newline at end of file
diff --git a/crm/page/sales_browser/sales_browser.js b/crm/page/sales_browser/sales_browser.js
new file mode 100644
index 0000000..a24c942
--- /dev/null
+++ b/crm/page/sales_browser/sales_browser.js
@@ -0,0 +1,421 @@
+pscript['onload_Sales Browser'] = function(){
+  var parent = $i('tr_body');
+  parent.innerHTML = 'Please select your chart: '
+  var sel = $a(parent,'select');
+  add_sel_options(sel, ['Territory', 'Customer Group', 'Item Group', 'Sales Person'], 'Territory');
+  var btn = $btn(parent, 'Go', function() { new SalesBrowser().set_val(sel_val(sel)) }, {marginTop:'8px'});
+}
+
+//================================= SalesBrowser Class ======================================
+SalesBrowser = function(){
+  
+  this.make_body = function(){
+  
+    $i('tr_header').innerHTML = '';
+    $i('tr_body').innerHTML = '';
+    //make header
+    var desc = this.sel;
+    var me = this;
+    var h = new PageHeader($i('tr_header'),desc);
+    h.add_button('New '+this.sel, function() { me.set_dialog(1); }, 0, 'ui-icon-plus', 1);
+    h.add_button('Refresh', function() { me.refresh_tree(); }, 0, 'ui-icon-refresh');
+
+    var div_body = $a($i('tr_body'),'div');
+    var tr_main_grid = make_table(div_body,1,2,'100%',['60%','40%'],{width: "100%", tableLayout: "fixed", borderCollapse: "collapse", border:"0px", padding:"4px 4px 4px 4px"});
+    
+    $y($td(tr_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px", width: "60%"});   
+    this.tree_area = $a($td(tr_main_grid,0,0),'div');
+
+    $y($td(tr_main_grid,0,1),{border: "1px solid #DDD"});   
+    this.detail_area = $a($td(tr_main_grid,0,1),'div');
+    
+    this.make_tree_body(this.tree_area);  
+    this.refresh_tree();
+  }
+  
+  this.set_val = function(b){
+    var me = this;
+    me.sel = b;  
+    me.make_body();
+  }
+}
+
+//=================================================================================================================================
+SalesBrowser.prototype.make_tree_body = function(parent){
+
+  //this.tab2 =make_table(this.wrapper,1,2,'100%',['60%','40%']);
+  this.make_tree();
+  this.make_rgt_sect();
+  
+}
+
+//=================================================================================================================================
+SalesBrowser.prototype.make_rgt_sect=function(){
+  //var d = $a($td(this.tab2,0,1),'div','',{border:'1px solid #000'});
+
+  this.rgt_tab =make_table(this.detail_area,4,1,'','',{padding:"4px",spacing:"4px"});
+  this.dtl = $a($td(this.rgt_tab,0,0),'div');
+  this.btn = $a($td(this.rgt_tab,1,0),'div','span');
+  this.help = $a($td(this.rgt_tab,2,0),'div');
+  this.help.innerHTML = "Note: Explore and click on the tree node to see details."
+
+  this.set_btn();
+}
+//=================================================================================================================================
+SalesBrowser.prototype.set_btn = function(){
+  var me = this;
+  this.edit_btn = $btn(this.btn,'Edit',function(){ me.set_dialog(2); });
+
+  this.trash_btn = $btn(this.btn,'Trash',null);
+  this.trash_btn.onclick = function(){
+    var check = confirm("Are you sure you want to trash "+me.cur_node.rec.name+" node?");
+    
+    if(check){
+      var arg = [me.cur_node.rec.name, me.sel];
+      $c_obj('Sales Browser Control','trash_record',arg.join(','),function(r,rt){      me.refresh_tree();});
+
+    }
+  }
+}
+
+//=====================================================
+SalesBrowser.prototype.set_dialog = function(f){
+
+ 
+  if(this.sel == 'Territory')
+    new MakeDialog('Territory','territory',f,this);            //Territory Dialog
+  if(this.sel == 'Customer Group')
+    new MakeDialog('Customer Group','customer_group',f,this);  //Customer Group Dialog  
+  if(this.sel == 'Item Group')
+    new MakeDialog('Item Group','item_group',f,this);   //Item Group Dialog
+  if(this.sel == 'Sales Person')
+    new MakeDialog('Sales Person','sales_person',f,this);//Sales Person Dialog 
+  
+}
+//=====================================================Make Tree============================================================================
+SalesBrowser.prototype.make_tree = function() {
+  var me = this;
+
+  this.tree = new Tree(this.tree_area, '100%');
+  
+  //---------------------------------------------------------------------------------------------------------------------------------
+  // on click
+  this.tree.std_onclick = function(node) {
+      
+      me.cur_node = node;
+      if(node.rec.name =='All Customer Groups' || node.rec.name =='All Sales Persons' || node.rec.name =='All Item Groups' || node.rec.name =='All Territories'){
+        //$di(me.add_btn);
+
+        $dh(me.edit_btn);
+        $dh(me.trash_btn);
+      }
+      else{
+        //$di(me.add_btn);
+        //if(node.has_children == false)
+          //$dh(me.add_btn);
+
+        $di(me.edit_btn);
+        $di(me.trash_btn);
+
+      }
+      me.make_details();
+	  
+  }
+  //---------------------------------------------------------------------------------------------------------------------------------
+  // on expand
+  this.tree.std_onexp = function(node) {
+
+    if(node.expanded_once)return;
+    $di(node.loading_div);
+
+    var callback = function(r,rt) {
+
+      $dh(node.loading_div);
+      var n = me.tree.allnodes[r.message.parent];
+      var cl = r.message.cl;
+
+      for(var i=0;i<cl.length;i++) {
+        var imgsrc=null;
+        var has_children = true;
+
+        if(cl[i].is_group=='No') {
+          var imgsrc = 'images/icons/page.gif';
+          has_children = false;
+        }
+        var t = me.tree.addNode(n, cl[i].name, imgsrc,me.tree.std_onclick, has_children ? me.tree.std_onexp : null);
+        t.rec = cl[i];
+        t.parent_account = r.message.parent;
+        t.has_children = has_children;
+      }
+
+    }
+    var arg = [node.rec.name, me.sel];
+    $c_obj('Sales Browser Control','get_record_list',arg.join(','),callback);
+  }
+  
+ 
+}
+
+//=================================================================================================================================
+SalesBrowser.prototype.make_details = function(){
+  var me = this;
+  var callback = function(r,rt){
+
+    me.dtl.innerHTML = "";
+    //me.dtl_tab = make_table(me.dtl,3,2,'','',{tableLayout:'fixed',borderCollapse: 'collapse'})
+    
+    var h = $a(me.dtl,'h3','',{padding:'4px', margin:'0px',backgroundColor:'#EEEEEE',borderBottom:'1px solid #AAAAAA'});
+    $(h).html(r.message.name);
+    
+    var d = $a(me.dtl,'div');
+    me.dtl_tab = make_table(me.dtl,3,2,'','',{tableLayout:'fixed',borderCollapse: 'collapse',padding:'4px'})
+    $td(me.dtl_tab,0,0).innerHTML="Parent";
+    if(r.message.parent != '')
+      $td(me.dtl_tab,0,1).innerHTML=": "+r.message.parent;
+    else
+      $td(me.dtl_tab,0,1).innerHTML=": ----";    
+    $td(me.dtl_tab,1,0).innerHTML="Has Child Node";
+    $td(me.dtl_tab,1,1).innerHTML=": "+r.message.is_group;
+   
+
+    me.open_doc = $a(me.dtl,'div','link_type',{paddingTop:'14px'});
+    me.open_doc.innerHTML = "Click here to open "+r.message.name;
+    
+    me.open_doc.onclick = function(){
+      loaddoc(me.sel,r.message.name );
+    }
+  }
+
+  var arg = [this.cur_node.rec.name, this.sel];
+  
+  $c_obj('Sales Browser Control','get_record',arg.join(','),callback);
+
+}
+//=================================================================================================================================
+SalesBrowser.prototype.refresh_tree=function(){
+
+  this.tree_area.innerHTML = '';
+  this.dtl.innerHTML = '';  
+  this.first_level_node();    //set root
+  //hide add, edit, trash buttons
+  //$dh(this.add_btn);
+  $dh(this.edit_btn);
+  $dh(this.trash_btn);
+  
+
+
+}
+
+//=============================== make first level node ================================================
+SalesBrowser.prototype.first_level_node = function(){
+
+  var me = this;
+  var callback = function(r,rt) {
+
+    var cl = r.message.cl;
+
+    for(var i=0;i<cl.length;i++) {
+      var imgsrc=null;
+      var has_children = true;
+
+      if(cl[i].is_group=='No') {
+        var imgsrc = 'images/icons/page.gif';
+        has_children = false;
+      }
+     me.tree_area.innerHTML = ''; 
+     if(me.tree) {
+
+        me.tree.innerHTML = '';
+        me.tree.body.innerHTML = '';
+        
+        me.make_tree();
+      }
+
+      var t = me.tree.addNode(null, cl[i].name, imgsrc,me.tree.std_onclick, has_children ? me.tree.std_onexp : null);
+      t.rec ={};
+      t.rec.name = cl[i].name;
+      t.has_children = has_children;
+    }
+  }
+
+  $c_obj('Sales Browser Control','get_fl_node',this.sel,callback);
+
+}
+
+//========================================= Dialog Section ===================================================================
+//--------------------------------------------------------------------------------------------------------------------------------
+//========================================================================
+MakeDialog=function(label,field_name,n,cls_obj){
+
+  var new_head = 'Create A New '+label;
+
+  this.label = label;
+
+  this.lbl_rec = label+' Name';
+  this.field_name = field_name;
+  this.n = n;
+  this.cls_obj=cls_obj;
+  //-----------------------------------------------
+ 
+  this.main_dialog = new Dialog(400,300,new_head);      
+  this.set_dg_fields();
+  this.set_dg_values();
+  //-----------------------------------------------
+  this.new_main_dialog = this.main_dialog;
+  
+  this.new_main_dialog.show();
+
+}
+//=================================================================================================================================
+MakeDialog.prototype.set_dg_fields = function(){
+
+  var bd_lst = [];
+  bd_lst.push(['HTML','Heading'],['Data',this.lbl_rec],['Select','Parent'],['Select','Has Child Node']);
+  if(this.cls_obj.sel == 'Sales Person')
+    bd_lst.push(['HTML','','All nodes are allowed in transaction.']);
+  else
+    bd_lst.push(['HTML','','Only leaf nodes are allowed in transaction.']);
+  if(this.n==1)
+    bd_lst.push(['Button','Create']);
+  
+  if(this.n==2){
+    bd_lst.push(['Button','Update']);
+    this.set_edit_fields();
+  }  
+
+  this.main_dialog.make_body(bd_lst);
+  
+  //-----------------------------------------------
+}
+
+
+//==================================================================================================================================== 
+MakeDialog.prototype.set_edit_fields=function(){
+  var me = this;
+  var callback = function(r,rt){
+    
+    me.main_dialog.widgets[me.lbl_rec].value = r.message.name;
+    
+    add_sel_options(me.main_dialog.widgets['Parent'], r.message.parent_lst,r.message.parent);    
+    me.main_dialog.widgets['Has Child Node'].value = r.message.is_group;
+  }
+
+  var arg = [this.cls_obj.cur_node.rec.name, this.cls_obj.sel];
+  
+  $c_obj('Sales Browser Control','get_record',arg.join(','),callback);
+}
+//======================================= Validation - fields entered or not =================================================
+MakeDialog.prototype.validate = function(){
+
+  if(!this.main_dialog.widgets[this.lbl_rec].value) {
+      err_msg1 ='Please enter '+this.label +' Name' 
+      alert(err_msg1); 
+      return 1;
+    }
+    if(!this.main_dialog.widgets['Parent'].value){
+      alert('Please enter Parent Name' );
+      return 1;
+    }
+}
+//==================================================================================================================================== 
+MakeDialog.prototype.set_dg_values = function(){
+  if(this.n==1){
+    var me = this;
+    var callback = function(r,rt){
+      me.main_dialog.widgets[me.lbl_rec].disabled = 0;
+      me.main_dialog.widgets['Parent'].disabled = 0;
+
+      add_sel_options(me.main_dialog.widgets['Parent'],r.message);
+      //add_sel_options(this.main_dialog.widgets['Parent'], [this.cls_obj.cur_node.rec.name]);
+      me.btn_onclick('Create',me.cls_obj);
+    }
+  
+    $c_obj('Sales Browser Control','get_parent_lst',this.cls_obj.sel,callback);
+
+  }  
+  if(this.n == 2){
+    this.main_dialog.widgets[this.lbl_rec].disabled = 1;
+    this.main_dialog.widgets['Parent'].disabled = 0;
+    this.btn_onclick('Update');
+    this.old_value = sel_val(this.main_dialog.widgets['Parent']);
+  }
+
+  add_sel_options(this.main_dialog.widgets['Has Child Node'], ['Yes','No'], 'No');
+
+}
+
+//================================================================================================================================= 
+//-----------------------------------------Dialog button onclick event----------------------------------------------
+MakeDialog.prototype.btn_onclick=function(btn_name){
+  var me = this;
+  this.btn_name = btn_name;
+  this.main_dialog.widgets[this.btn_name].onclick = function() {
+  
+    var callback=function(r,rt){
+      if(r.message == 'true'){
+        me.main_dialog.hide();
+      }
+      else{
+        flag = me.validate();
+        if(flag == 1) return;
+           
+        //---------------------------------------------------------  
+
+        var arg2 = me.make_args();
+        
+        //create Sales Person -- server to Sales Browser Control
+        if(me.btn_name == "Create")
+          method_name = "add_node";
+        else 
+          method_name = "edit_node";       
+           
+        $c_obj('Sales Browser Control',method_name, docstring(arg2), function(r,rt) { 
+          me.main_dialog.widgets[me.lbl_rec].value='';
+          me.main_dialog.hide();
+          /*if(me.btn_name == "Create"){
+            me.cls_obj.cur_node.clear_child_nodes();
+            me.cls_obj.dtl.innerHTML = '';  
+            me.cls_obj.cur_node.expand();
+          }
+          else{
+            me.cls_obj.refresh_tree();   
+          }*/
+          me.cls_obj.refresh_tree(); 
+        });
+      }
+    }
+    var arg1 = {'node_title':me.cls_obj.sel,'is_group':sel_val(me.main_dialog.widgets['Has Child Node']),'lft':0,'rgt':0,'nm':me.main_dialog.widgets[me.lbl_rec].value,'parent_nm':sel_val(me.main_dialog.widgets['Parent']),'action':me.btn_name};
+    $c_obj('Sales Browser Control','mvalidate',docstring(arg1),callback);
+  }
+}
+//=================================================================================================================================
+
+MakeDialog.prototype.make_args = function(){
+  var args ={};   //args making
+  var nt = this.cls_obj.sel;
+  var nm = this.main_dialog.widgets[this.lbl_rec].value;
+  var pnm = sel_val(this.main_dialog.widgets['Parent']);
+  var grp = sel_val(this.main_dialog.widgets['Has Child Node']);
+
+  if(this.n==1)
+    var old_prt ='';
+  else if(this.n==2){
+    if(this.old_value == sel_val(this.main_dialog.widgets['Parent']))
+      var old_prt = '';
+    else
+      var old_prt = this.old_value;
+  }
+  
+  if(this.cls_obj.sel == 'Territory')
+    return {'node_title':nt,'territory_name':nm,'parent_territory':pnm,'is_group':grp,'old_parent':old_prt}
+
+  else if(this.cls_obj.sel == 'Customer Group')
+    return {'node_title':nt,'customer_group_name':nm,'parent_customer_group':pnm,'is_group':grp,'old_parent':old_prt}
+
+  else if(this.cls_obj.sel == 'Item Group')
+    return {'node_title':nt,'item_group_name':nm,'parent_item_group':pnm,'is_group':grp,'old_parent':old_prt}
+
+  else if(this.cls_obj.sel == 'Sales Person')
+    return {'node_title':nt,'sales_person_name':nm,'parent_sales_person':pnm,'is_group':grp,'old_parent':old_prt}
+
+}
\ No newline at end of file
diff --git a/crm/page/sales_browser/sales_browser.txt b/crm/page/sales_browser/sales_browser.txt
new file mode 100644
index 0000000..bdeb236
--- /dev/null
+++ b/crm/page/sales_browser/sales_browser.txt
@@ -0,0 +1 @@
+[{'creation': '2010-06-16 11:44:38', 'module': 'CRM', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Sales Browser', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Sales Browser', 'idx': None, 'static_content': None, 'modified': '2010-11-10 19:21:50', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000140', 'parent': 'Sales Browser', 'creation': '2010-06-16 12:08:31', 'modified': '2010-11-10 19:21:50', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000149', 'parent': 'Sales Browser', 'creation': '2010-07-14 15:57:09', 'modified': '2010-11-10 19:21:50', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'Material Master Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/crm/page/sales_dashboard/__init__.py b/crm/page/sales_dashboard/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/page/sales_dashboard/__init__.py
diff --git a/crm/page/sales_dashboard/sales_dashboard.html b/crm/page/sales_dashboard/sales_dashboard.html
new file mode 100644
index 0000000..ec76d44
--- /dev/null
+++ b/crm/page/sales_dashboard/sales_dashboard.html
@@ -0,0 +1,6 @@
+<div class="layout_wrapper">
+<div id="pt_header"></div>
+<div id="pt_filters"></div>
+<p>&nbsp;</p>
+<div id="plot_test"></div>
+</div>
\ No newline at end of file
diff --git a/crm/page/sales_dashboard/sales_dashboard.js b/crm/page/sales_dashboard/sales_dashboard.js
new file mode 100644
index 0000000..cdb5c7c
--- /dev/null
+++ b/crm/page/sales_dashboard/sales_dashboard.js
@@ -0,0 +1,301 @@
+pscript['onload_Sales Dashboard'] = function() {
+  var h = new PageHeader('pt_header','Sales Dashboard');
+  
+  pscript.make_filters(); 
+  $dh(pscript.mnt_div);
+  $dh(pscript.mnt_div1);
+  //pscript.dx_axis = [];
+  
+  if($.jqplot) pscript.all_onchnge();
+  else
+    // import the library
+    $c_js('jquery/jquery.jqplot.min.js', pscript.all_onchnge);
+}
+//=======================================================================
+pscript.make_filters = function(){
+  this.tab = make_table('pt_filters', 2, 4, '800px', ['200px','200px','200px','200px'], {padding: '2px'});
+  pscript.fiscal_year();
+  pscript.report_type();
+  pscript.item_grp();
+  pscript.month_lst();
+}
+//=======================================================================
+
+pscript.fiscal_year=function(){
+  var me = this;
+  $td(this.tab,0,0).innerHTML = "Select Year";
+  this.sel_fy = $a($td(this.tab,1,0), 'select', null, {width:'120px'});
+  $c_obj('Plot Control', 'get_fiscal_year', '', function(r,rt){
+    if(r.message)  fy_lst = r.message;
+    else  fy_lst = [];
+    empty_select(me.sel_fy);
+    add_sel_options(me.sel_fy,fy_lst);
+    me.sel_fy.value = sys_defaults.fiscal_year;
+  });
+  
+}
+
+//=======================================================================
+
+pscript.report_type=function(){
+  $td(this.tab,0,1).innerHTML = "Select Report";
+  this.sel_rpt = $a($td(this.tab,1,1), 'select', null, {width:'120px'});
+  rpt_lst = ['Monthly','Weekly']; 
+  add_sel_options(this.sel_rpt,rpt_lst);
+}
+
+//=======================================================================
+
+pscript.item_grp=function(){
+  var me = this;
+  
+  $td(this.tab,0,2).innerHTML = "Select Item Group";
+  
+  this.sel_grp = $a($td(this.tab,1,2), 'select', null, {width:'120px'});
+  $c_obj('Plot Control', 'get_item_groups', '', function(r,rt){
+    
+    itg_lst = r.message;
+    itg_lst.push('All');
+    
+    empty_select(me.sel_grp);
+    add_sel_options(me.sel_grp, itg_lst.reverse());
+  });
+  
+}
+
+//=======================================================================
+
+pscript.month_lst=function(){
+  pscript.mnt_div1 = $a($td(this.tab,0,3));
+  pscript.mnt_div1.innerHTML = "Select Month";
+  pscript.mnt_div = $a($td(this.tab,1,3));
+  this.sel_mnt = $a(pscript.mnt_div, 'select', null, {width:'120px'});
+  mnt_lst = ['All','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 
+  add_sel_options(this.sel_mnt,mnt_lst);
+}
+
+//=======================================================================
+pscript.all_onchnge = function(){
+  pscript.report_change();
+  pscript.fiscal_year_onchnage();
+  pscript.month_onchange();
+  pscript.item_grp_onchange();
+  pscript.monthly();
+}
+
+//=======================================================================
+pscript.report_change = function(){
+  var me = this;
+  this.sel_rpt.onchange = function(){
+    
+    $dh(pscript.mnt_div);
+    $dh(pscript.mnt_div1);
+    if(me.sel_rpt.value == 'Monthly'){
+      
+      pscript.monthly();
+    }
+    
+    else if(me.sel_rpt.value == 'Weekly'){
+      $ds(pscript.mnt_div); 
+      $ds(pscript.mnt_div1);
+      me.sel_mnt.value = 'All';
+      pscript.get_x_dates();
+
+    }
+    
+    else{
+      me.sel_mnt.value = 'All';
+      $i('plot_test').innerHTML = '';
+    }
+  }
+
+}
+//=======================================================================
+pscript.fiscal_year_onchnage = function(){
+  var me = this;
+  this.sel_fy.onchange = function(){ 
+
+    if(me.sel_rpt.value == 'Monthly'){
+      
+      me.sel_mnt.value = 'All';
+      $dh(pscript.mnt_div); 
+      $dh(pscript.mnt_div1);     
+      pscript.monthly();
+    }
+    else if(me.sel_rpt.value == 'Weekly' && me.sel_mnt.value){
+    
+      pscript.get_x_dates();
+      
+    }
+    
+    else{
+      me.sel_mnt.value = 'All';
+      me.sel_rpt.value == '';
+      $i('plot_test').innerHTML = '';
+      
+    }
+  }
+
+}
+//=======================================================================
+pscript.month_onchange = function(){
+  this.sel_mnt.onchange = function(){
+    pscript.get_x_dates();
+    
+  }
+}
+//=======================================================================
+
+pscript.item_grp_onchange=function(){
+  var me = this;
+  this.sel_grp.onchange = function(){
+  
+    if(me.sel_rpt.value == 'Monthly'){
+      
+      me.sel_mnt.value = 'All';
+      $dh(pscript.mnt_div); 
+      $dh(pscript.mnt_div1);     
+      pscript.monthly();
+    }
+    else if(me.sel_rpt.value == 'Weekly' && me.sel_mnt.value){
+    
+      pscript.get_x_dates();
+      
+    }
+    
+    else{
+      me.sel_mnt.value = 'All';
+      me.sel_rpt.value == '';
+      $i('plot_test').innerHTML = '';
+      
+    }
+  }
+    
+  }
+
+//=======================================================================
+
+pscript.get_x_dates=function(){
+  
+  if(this.sel_mnt.value !='All'){
+    
+    pscript.weekly();
+  }
+  else{ 
+    
+    $c_obj('Plot Control','yr_wk_dates',this.sel_fy.value,
+      function(r,rt){
+        
+        pscript.dx_axis = r.message[0];
+        
+        pscript.x_axis = r.message[1];
+        
+        pscript.yearly();
+      }
+    );
+    
+  }
+}
+
+//=======================================================================
+pscript.draw_graph1 = function(x_axis,line1,t) {
+  
+  t = t + " ("+sys_defaults.currency +")";
+  $i('plot_test').innerHTML = '';
+  // div plot_test contains the container div
+  $.jqplot('plot_test',  [line1],{
+    title:t,
+    axesDefaults: {
+      min:0  
+    },
+    
+    axes:{ 
+      xaxis:{ticks:x_axis}
+    }
+  });
+}
+//=======================================================================
+pscript.monthly = function(){
+  var callback = function(r,rt){
+    x_axis = r.message.x_axis;
+    msg_data = r.message.msg_data; 
+    
+    var line1 = [];
+    for(var i=0; i<x_axis.length;i++){
+      var f =0
+      for(var j=0; j<msg_data.length;j++){
+        if(msg_data[j] && x_axis[i]){
+          if(x_axis[i][1] == msg_data[j][1])
+          { 
+            line1.push([i+1,flt(msg_data[j][0])]);
+            f = 1
+          }
+          
+        }
+      }
+      if(f == 0){
+        line1.push([i+1,0]);
+      }
+    }
+    pscript.draw_graph1(x_axis,line1,'Monthly Sales');
+  }
+  var val2 = '';
+  if(this.sel_grp.value != 'All') val2 = this.sel_grp.value;
+  $c_obj('Plot Control','get_monthwise_amount',[this.sel_fy.value,val2],callback);
+}
+
+//=======================================================================
+
+pscript.weekly = function(){
+  
+  var callback = function(r,rt){
+    
+    x_axis =[[1,'Week1'],[2,'Week2'],[3,'Week3'],[4,'Week4'],[5,'Week5'],[6,'Week6']];
+    var line1 = [];
+    for(var i=0; i<x_axis.length;i++){
+      var f = 0;
+      for(var j=0; j<r.message.length;j++){
+        if(r.message[j]){
+          if(r.message[j][1] == x_axis[i][1]){ line1.push([i+1,flt(r.message[j][0])]); f=1;}}
+      }
+      if(f == 0){
+        line1.push([i+1,0]);
+      }
+    }
+    
+    pscript.draw_graph1(x_axis,line1,'Weekly Sales');
+  }
+  dict_mnt={'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,'Jul':7,'Aug':8,'Sep':9,'Oct':10,'Nov':11,'Dec':12};
+  var val3 = '';
+  if(this.sel_grp.value != 'All') val3 = this.sel_grp.value;
+  $c_obj('Plot Control','get_weekwise_amount',[dict_mnt[this.sel_mnt.value],this.sel_fy.value,val3],callback);
+}
+
+//=======================================================================
+
+pscript.yearly = function(){
+  
+  var callback = function(r,rt){
+      
+    var line1 = [];
+    for(var i=0; i<pscript.x_axis.length;i++){
+      var f = 0
+      for(var j=0; j<r.message.length;j++){
+        if(r.message[j]){
+
+          if((r.message[j][1] == pscript.x_axis[i][1]) && (r.message[j][2] == pscript.x_axis[i][2])){ line1.push([pscript.x_axis[i][0],r.message[j][0]]); break; f =1;}
+      }
+      }
+      if(f == 0){
+        line1.push([pscript.x_axis[i][0],0]);
+      }
+    }
+    
+    pscript.draw_graph1(pscript.dx_axis,line1,'Year-Weekly Sales');
+  }
+  var val2 = '';
+  if(this.sel_grp.value != 'All') val2 = this.sel_grp.value;
+  
+  
+  $c_obj('Plot Control','get_year_weekwise_amount',[this.sel_fy.value,val2],callback);
+} 
\ No newline at end of file
diff --git a/crm/page/sales_dashboard/sales_dashboard.txt b/crm/page/sales_dashboard/sales_dashboard.txt
new file mode 100644
index 0000000..c08615a
--- /dev/null
+++ b/crm/page/sales_dashboard/sales_dashboard.txt
@@ -0,0 +1 @@
+[{'creation': '2010-05-21 13:56:25', 'module': 'CRM', 'doctype': 'Page', 'owner': 'harshada@webnotestech.com', 'style': None, 'modified_by': 'saumil@webnotestech.com', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Sales Dashboard', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Sales Dashboard', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'saumil@webnotestech.com', 'name': 'PR000136', 'parent': 'Sales Dashboard', 'creation': '2010-05-21 13:56:25', 'modified': '2010-08-08 00:01:08', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Sales Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/crm/search_criteria/__init__.py b/crm/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/__init__.py
diff --git a/crm/search_criteria/delivered_items_to_be_install/__init__.py b/crm/search_criteria/delivered_items_to_be_install/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/delivered_items_to_be_install/__init__.py
diff --git a/crm/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.js b/crm/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.js
new file mode 100644
index 0000000..d8b6476
--- /dev/null
+++ b/crm/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/crm/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt b/crm/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
new file mode 100644
index 0000000..13dd74b
--- /dev/null
+++ b/crm/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "(`tabDelivery Note Detail`.`qty`- ifnull(`tabDelivery Note Detail`.`installed_qty`, 0)) AS 'Pending to Install'",
+		'add_cond': '`tabDelivery Note Detail`.`qty` > ifnull(`tabDelivery Note Detail`.`installed_qty`, 0)',
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Status,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Contact Person,Delivery Note\x01Voucher Date,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Installed Qty,Delivery Note\x01% Installed',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Delivered Items to be Install',
+		'custom_query': '',
+		'description': 'Delivered Items to be Install',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-03-29 14:08:46',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'delivered_items_to_be_install',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py b/crm/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/delivery_note_itemwise_pending_to_bill/__init__.py
diff --git a/crm/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt b/crm/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt
new file mode 100644
index 0000000..732281c
--- /dev/null
+++ b/crm/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabDelivery Note Detail`.`qty` - `tabDelivery Note Detail`.`billed_qty`) AS 'Pending Qty'\nSUM((`tabDelivery Note Detail`.`qty` - `tabDelivery Note Detail`.`billed_qty`) * `tabDelivery Note Detail`.`basic_rate`) AS 'Pending Amount'",
+		'add_cond': "`tabDelivery Note`.status != 'Stopped'\nCASE WHEN `tabDelivery Note`.`per_billed` IS NULL OR `tabDelivery Note`.per_billed = '' THEN 0 < 100 ELSE `tabDelivery Note`.per_billed <100 END",
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Status,Delivery Note\x01Customer Name,Delivery Note\x01Voucher Date,Delivery Note\x01% Billed,Delivery Note\x01Posting Date,Delivery Note\x01Company Name,Delivery Note\x01Fiscal Year,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Against Document No,Delivery Note Detail\x01Document Type,Delivery Note Detail\x01Against Document Detail No',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Delivery Note Itemwise Pending To Bill',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Company Name':'','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabDelivery Note Detail`.item_code, `tabDelivery Note`.`name`',
+		'idx': None,
+		'modified': '2010-04-06 17:22:13',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'delivery_note_itemwise_pending_to_bill',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/draft_sales_orders/__init__.py b/crm/search_criteria/draft_sales_orders/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/draft_sales_orders/__init__.py
diff --git a/crm/search_criteria/draft_sales_orders/draft_sales_orders.js b/crm/search_criteria/draft_sales_orders/draft_sales_orders.js
new file mode 100644
index 0000000..0e73442
--- /dev/null
+++ b/crm/search_criteria/draft_sales_orders/draft_sales_orders.js
@@ -0,0 +1,6 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+
+}
\ No newline at end of file
diff --git a/crm/search_criteria/draft_sales_orders/draft_sales_orders.txt b/crm/search_criteria/draft_sales_orders/draft_sales_orders.txt
new file mode 100644
index 0000000..84dc8fe
--- /dev/null
+++ b/crm/search_criteria/draft_sales_orders/draft_sales_orders.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01P.O. No,Sales Order\x01Grand Total',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Draft Sales Orders',
+		'custom_query': '',
+		'description': 'List of Open Sales orders filtered by period, customer and other details',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Draft','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-01 15:19:41',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'draft_sales_orders',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/follow_up_report/__init__.py b/crm/search_criteria/follow_up_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/follow_up_report/__init__.py
diff --git a/crm/search_criteria/follow_up_report/follow_up_report.js b/crm/search_criteria/follow_up_report/follow_up_report.js
new file mode 100644
index 0000000..9497efb
--- /dev/null
+++ b/crm/search_criteria/follow_up_report/follow_up_report.js
@@ -0,0 +1,47 @@
+report.customize_filters = function() {
+  this.mytabs.items['Select Columns'].hide()
+  this.mytabs.items['More Filters'].hide()
+  
+  this.hide_all_filters();
+  this.add_filter({fieldname:'follow_up_on', label:'Follow up on', fieldtype:'Select', options:''+NEWLINE+'Lead'+NEWLINE+'Enquiry'+NEWLINE+'Quotation',ignore : 1,parent:'Follow up', in_first_page : 1, single_select :1});
+  this.add_filter({fieldname:'lead_name', label:'Lead', fieldtype:'Link', options:'Lead', report_default:'', ignore : 1, parent:'Follow up', in_first_page : 1});
+  this.add_filter({fieldname:'enq_name', label:'Enquiry', fieldtype:'Link', options:'Enquiry', report_default:'', ignore : 1, parent:'Follow up', in_first_page : 1});
+  this.add_filter({fieldname:'qtn_name', label:'Quotation', fieldtype:'Link', options:'Quotation', report_default:'', ignore : 1, parent:'Follow up', in_first_page : 1});
+  
+  this.get_filter('Follow up', 'Follow up type').set_as_single();
+  this.set_filter_properties('Follow up', 'Follow up by', {filter_hide:0, in_first_page : 1});
+  this.set_filter_properties('Follow up', 'Follow up type', {filter_hide:0, in_first_page : 1});
+  this.set_filter_properties('Follow up', 'From Date', {filter_hide:0, in_first_page : 1});
+  this.set_filter_properties('Follow up', 'To Date', {filter_hide:0, in_first_page : 1});
+
+  this.orig_sort_list = [['Date','`tabFollow up`.`date`'],['Document Type','`tabFollow up`.`parenttype`'],['Document','`tabFollow up`.`parent`'],['Follow Up By','`tabFollow up`.`follow_up_by`'],['Follow Up Type','`tabFollow up`.`follow_up_type`']];
+}
+
+
+report.get_query = function() {
+  var lead_id = this.filter_fields_dict['Follow up'+FILTER_SEP+'Lead'].get_value();
+  var enq_id = this.filter_fields_dict['Follow up'+FILTER_SEP+'Enquiry'].get_value();
+  var quo_id = this.filter_fields_dict['Follow up'+FILTER_SEP+'Quotation'].get_value();
+
+  var follow_up_on = this.filter_fields_dict['Follow up'+FILTER_SEP+'Follow up on'].get_value();
+  var follow_up_by = this.filter_fields_dict['Follow up'+FILTER_SEP+'Follow up by'].get_value();
+
+  var on_type = this.filter_fields_dict['Follow up'+FILTER_SEP+'Follow up type'].get_value();
+  var from_date = this.filter_fields_dict['Follow up'+FILTER_SEP+'From Date'].get_value();
+  var to_date = this.filter_fields_dict['Follow up'+FILTER_SEP+'To Date'].get_value();
+  
+  var cond = 'parenttype IN ("Lead","Enquiry","Quotation")';
+  if(follow_up_on) cond = 'parenttype = "'+follow_up_on+'"';
+
+  if((follow_up_on == 'Lead' && lead_id) || (lead_id && !follow_up_on)) cond +=' AND parent = "'+lead_id+'"';
+  if((follow_up_on == 'Enquiry' && enq_id) || (enq_id && !follow_up_on)) cond +=' AND parent = "'+enq_id+'"';
+  if((follow_up_on == 'Quotation' && quo_id) || (quo_id && !follow_up_on)) cond +=' AND parent = "'+quo_id+'"';
+
+  if(on_type) cond += ' AND follow_up_type ="'+on_type+'"';
+  if(from_date) cond += ' AND date >="'+from_date+'"';
+  if(to_date) cond += ' AND date <="'+to_date+'"';
+  if(follow_up_by) cond += ' AND follow_up_by = "'+follow_up_by+'"';
+
+  var q ='SELECT distinct `tabFollow up`.`parenttype`, `tabFollow up`.`parent`, `tabFollow up`.`date`, `tabFollow up`.`notes`, `tabFollow up`.`follow_up_type`, `tabFollow up`.`follow_up_by` FROM `tabFollow up` WHERE '+cond+' ORDER BY '+sel_val(this.dt.sort_sel)+' '+this.dt.sort_order;
+  return q;
+}
diff --git a/crm/search_criteria/follow_up_report/follow_up_report.py b/crm/search_criteria/follow_up_report/follow_up_report.py
new file mode 100644
index 0000000..1dcbeb0
--- /dev/null
+++ b/crm/search_criteria/follow_up_report/follow_up_report.py
@@ -0,0 +1,16 @@
+follow_up_on = filter_values.get('follow_up_on')
+
+cols = [['Document Type', 'Data', '150px', '']
+        ,['Document', 'Link', '150px', follow_up_on]
+        ,['Follow Up Date', 'Date', '150px', '']
+        ,['Description','Data','300px','']
+        ,['Follow Up Type','Data','150px','']
+        ,['Follow Up By','Link','150px','Sales Person']
+       ]
+
+for c in cols:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
diff --git a/crm/search_criteria/follow_up_report/follow_up_report.txt b/crm/search_criteria/follow_up_report/follow_up_report.txt
new file mode 100644
index 0000000..0da414b
--- /dev/null
+++ b/crm/search_criteria/follow_up_report/follow_up_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Lead\x01ID,Follow up\x01Date,Follow up\x01Notes,Follow up\x01Follow up type',
+		'creation': '2010-08-13 11:09:21',
+		'criteria_name': 'Follow-up Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Follow up',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Lead\x01Status':'','Lead\x01Source':'','Lead\x01Lead Type':'','Lead\x01Rating':'','Lead\x01Market Segment':'','Lead\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-12 16:33:19',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'follow-up_report',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Lead',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabLead`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/gross_profit/__init__.py b/crm/search_criteria/gross_profit/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/gross_profit/__init__.py
diff --git a/crm/search_criteria/gross_profit/gross_profit.js b/crm/search_criteria/gross_profit/gross_profit.js
new file mode 100644
index 0000000..e610408
--- /dev/null
+++ b/crm/search_criteria/gross_profit/gross_profit.js
@@ -0,0 +1,16 @@
+report.customize_filters = function() {
+  this.mytabs.items['Select Columns'].hide();
+  this.mytabs.tabs['More Filters'].hide();
+  this.hide_all_filters();
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.in_first_page = 1;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Delivery Note Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/crm/search_criteria/gross_profit/gross_profit.py b/crm/search_criteria/gross_profit/gross_profit.py
new file mode 100644
index 0000000..04f0220
--- /dev/null
+++ b/crm/search_criteria/gross_profit/gross_profit.py
@@ -0,0 +1,61 @@
+# Add Columns
+# ------------
+colnames[colnames.index('Rate*')] = 'Rate' 
+col_idx['Rate'] = col_idx['Rate*']
+col_idx.pop('Rate*')
+colnames[colnames.index('Amount*')] = 'Amount' 
+col_idx['Amount'] = col_idx['Amount*']
+col_idx.pop('Amount*')
+
+columns = [['Valuation Rate','Currency','150px',''],
+           ['Valuation Amount','Currency','150px',''],
+           ['Gross Profit (%)','Currrency','150px',''],
+           ['Gross Profit','Currency','150px','']]
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+
+out, tot_amount, tot_val_amount, tot_gross_profit = [], 0, 0, 0
+
+for r in res:
+  tot_val_rate = 0
+  packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Detail` where parent = %s and parent_item = %s", (r[col_idx['ID']], r[col_idx['Item Code']]))
+  for d in packing_list_items:
+    if d[1]:
+      val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and voucher_type = 'Delivery Note' and voucher_no = %s and is_cancelled = 'No'", (d[0], d[1], r[col_idx['ID']]))
+      val_rate = val_rate and val_rate[0][0] or 0
+      if r[col_idx['Quantity']]: tot_val_rate += (flt(val_rate) * flt(d[2]) / flt(r[col_idx['Quantity']]))
+      else: tot_val_rate = 0
+
+  r.append(fmt_money(tot_val_rate))
+
+  val_amount = flt(tot_val_rate) * flt(r[col_idx['Quantity']])
+  r.append(fmt_money(val_amount))
+
+  gp = flt(r[col_idx['Amount']]) - flt(val_amount)
+  
+  if val_amount: gp_percent = gp * 100 / val_amount
+  else: gp_percent = gp
+  
+  r.append(fmt_money(gp_percent))
+  r.append(fmt_money(gp))
+  out.append(r)
+
+  tot_gross_profit += flt(gp)
+  tot_amount += flt(r[col_idx['Amount']])
+  tot_val_amount += flt(val_amount)  
+
+# Add Total Row
+# --------------
+l_row = ['' for i in range(len(colnames))]
+l_row[col_idx['Quantity']] = '<b>TOTALS</b>'
+l_row[col_idx['Amount']] = fmt_money(tot_amount)
+l_row[col_idx['Valuation Amount']] = fmt_money(tot_val_amount)
+if tot_val_amount: l_row[col_idx['Gross Profit (%)']] = fmt_money((tot_amount - tot_val_amount) * 100 / tot_val_amount)
+else: l_row[col_idx['Gross Profit (%)']] = fmt_money(tot_amount)
+l_row[col_idx['Gross Profit']] = fmt_money(tot_gross_profit)
+out.append(l_row)
\ No newline at end of file
diff --git a/crm/search_criteria/gross_profit/gross_profit.txt b/crm/search_criteria/gross_profit/gross_profit.txt
new file mode 100644
index 0000000..9e3857c
--- /dev/null
+++ b/crm/search_criteria/gross_profit/gross_profit.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Posting Date,Delivery Note\x01Posting Time,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Description,Delivery Note\x01Project Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Rate*,Delivery Note Detail\x01Amount*',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Gross Profit',
+		'custom_query': '',
+		'description': 'Invoice wise',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-10 12:39:03',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'gross_profit',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/itemwise_delivery_details/__init__.py b/crm/search_criteria/itemwise_delivery_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/itemwise_delivery_details/__init__.py
diff --git a/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.js b/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.js
new file mode 100644
index 0000000..df3b401
--- /dev/null
+++ b/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.js
@@ -0,0 +1,7 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Voucher Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Voucher Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+
+}
\ No newline at end of file
diff --git a/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py b/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py
new file mode 100644
index 0000000..55041e4
--- /dev/null
+++ b/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py
@@ -0,0 +1,17 @@
+out=[]
+qty,amt,bil_qty=0,0,0
+
+for r in res:
+  qty += flt(r[col_idx['Quantity']])
+  amt += flt(r[col_idx['Amount*']])
+  bil_qty += flt(r[col_idx['Billed Qty']])
+  out.append(r)
+
+
+#Add the totals row
+l_row = ['' for i in range(len(colnames))]
+l_row[col_idx['Item Name']] = '<b>TOTALS</b>'
+l_row[col_idx['Quantity']] = qty
+l_row[col_idx['Amount*']] = amt
+l_row[col_idx['Billed Qty']] = bil_qty
+out.append(l_row)
\ No newline at end of file
diff --git a/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt b/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
new file mode 100644
index 0000000..6a6cac9
--- /dev/null
+++ b/crm/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Rate*,Delivery Note Detail\x01Amount*,Delivery Note Detail\x01Billed Qty,Delivery Note\x01Company',
+		'creation': '2010-11-10 15:04:42',
+		'criteria_name': 'Itemwise Delivery Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01From Voucher Date\x01lower':'','Delivery Note\x01To Voucher Date\x01upper':'','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-26 09:10:53',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'itemwise_delivery_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/itemwise_sales_details/__init__.py b/crm/search_criteria/itemwise_sales_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/itemwise_sales_details/__init__.py
diff --git a/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.js b/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.js
new file mode 100644
index 0000000..43a6951
--- /dev/null
+++ b/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'ID'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Status'].df.filter_hide = 1;
+}
+
+//this.mytabs.items['Select Columns'].hide();
+this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.py b/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.py
new file mode 100644
index 0000000..e85302c
--- /dev/null
+++ b/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.py
@@ -0,0 +1,19 @@
+out=[]
+qty,amt,del_qty,bil_qty=0,0,0,0
+
+for r in res:
+  qty += flt(r[col_idx['Quantity']])
+  amt += flt(r[col_idx['Amount*']])
+  del_qty += flt(r[col_idx['Delivered Qty']])
+  bil_qty += flt(r[col_idx['Billed Qty']])
+  out.append(r)
+
+
+#Add the totals row
+l_row = ['' for i in range(len(colnames))]
+l_row[col_idx['Item Name']] = '<b>TOTALS</b>'
+l_row[col_idx['Quantity']] = qty
+l_row[col_idx['Amount*']] = amt
+l_row[col_idx['Delivered Qty']] = del_qty
+l_row[col_idx['Billed Qty']] = bil_qty
+out.append(l_row)
\ No newline at end of file
diff --git a/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.txt b/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
new file mode 100644
index 0000000..00a5341
--- /dev/null
+++ b/crm/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order Detail\x01Quantity,Sales Order Detail\x01Basic Rate*,Sales Order Detail\x01Amount*,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty,Sales Order\x01Company',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Itemwise Sales Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '',
+		'idx': None,
+		'modified': '2010-08-30 12:22:47',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'itemwise_sales_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/monthly_despatched_trend/__init__.py b/crm/search_criteria/monthly_despatched_trend/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/monthly_despatched_trend/__init__.py
diff --git a/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.js b/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.js
new file mode 100644
index 0000000..ca88e29
--- /dev/null
+++ b/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.js
@@ -0,0 +1,2 @@
+this.mytabs.items['Select Columns'].hide();
+this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.py b/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.py
new file mode 100644
index 0000000..8aed5a2
--- /dev/null
+++ b/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.py
@@ -0,0 +1,7 @@
+total = 0.0
+monthlist = ['','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+for r in res:
+  r[0] = monthlist[r[0]]
+  total += r[1]
+
+colwidths[col_idx['Total Despatched']] = '200px'
\ No newline at end of file
diff --git a/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.txt b/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.txt
new file mode 100644
index 0000000..99504e9
--- /dev/null
+++ b/crm/search_criteria/monthly_despatched_trend/monthly_despatched_trend.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "month(`tabDelivery Note`.posting_date) AS 'Sales Month'\nsum(`tabDelivery Note`.net_total) AS 'Total Despatched'",
+		'add_cond': '`tabDelivery Note`.net_total > 10',
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Monthly Despatched Trend',
+		'custom_query': '',
+		'description': 'Monthly Despatched Trend',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Chargeable':'Yes','Delivery Note\x01Department':'','Delivery Note\x01Type':'','Delivery Note\x01Company Name':'Janak Healthcare Pvt Ltd','Delivery Note\x01Fiscal Year':'2009-2010'}",
+		'graph_series': 'Despatched Month',
+		'graph_values': 'Total Despatched',
+		'group_by': 'month(`tabDelivery Note`.Posting_date)',
+		'idx': None,
+		'modified': '2010-06-07 15:19:13',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'monthly_despatched_trend',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`Sales Month`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/periodic_sales_summary/__init__.py b/crm/search_criteria/periodic_sales_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/periodic_sales_summary/__init__.py
diff --git a/crm/search_criteria/periodic_sales_summary/periodic_sales_summary.js b/crm/search_criteria/periodic_sales_summary/periodic_sales_summary.js
new file mode 100644
index 0000000..04d2755
--- /dev/null
+++ b/crm/search_criteria/periodic_sales_summary/periodic_sales_summary.js
@@ -0,0 +1,19 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'transaction_date', label:'Sales Order Date', fieldtype:'Date', parent:'Sales Order', in_first_page : 1,default:''});
+  
+  //this.filter_fields_dict['Sales Order'+FILTER_SEP +'Territory'].df.filter_hide = 0;
+  //this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order Date'].df.filter_hide = 0;
+  //this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order Date'].df.in_first_page = 1;
+  
+  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+
+  //this.mytabs.items['Select Columns'].hide();
+  //this.mytabs.items['More Filters'].hide();
+}
\ No newline at end of file
diff --git a/crm/search_criteria/periodic_sales_summary/periodic_sales_summary.txt b/crm/search_criteria/periodic_sales_summary/periodic_sales_summary.txt
new file mode 100644
index 0000000..d3099d5
--- /dev/null
+++ b/crm/search_criteria/periodic_sales_summary/periodic_sales_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': None,
+		'columns': 'Sales Order Detail\x01Item Code,Sales Order Detail\x01Quantity,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Periodic Sales Summary',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': 'fiscal_year',
+		'disabled': 1,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Company Name':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSales Order Detail`.`item_code`',
+		'idx': None,
+		'modified': '2010-06-03 13:09:00',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'periodic_sales_summary',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': '',
+		'sort_by': '`tabSales Order Detail`.`item_code`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_agentwise_commission/__init__.py b/crm/search_criteria/sales_agentwise_commission/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_agentwise_commission/__init__.py
diff --git a/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.js b/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.js
new file mode 100644
index 0000000..4cb0f3d
--- /dev/null
+++ b/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.js
@@ -0,0 +1,9 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Partner'].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/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.py b/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.py
new file mode 100644
index 0000000..4412f6c
--- /dev/null
+++ b/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.py
@@ -0,0 +1,8 @@
+coltypes[col_idx['Average Commission Rate']] = 'Currency'
+colwidths[col_idx['Average Commission Rate']] = '200px'
+
+coltypes[col_idx['Net Total']] = 'Currency'
+colwidths[col_idx['Net Total']] = '150px'
+
+coltypes[col_idx['Total Commission']] = 'Currency'
+colwidths[col_idx['Total Commission']] = '150px'
diff --git a/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.txt b/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.txt
new file mode 100644
index 0000000..27a0dbe
--- /dev/null
+++ b/crm/search_criteria/sales_agentwise_commission/sales_agentwise_commission.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabSales Order`.`total_commission`) AS 'Total Commission'\nSUM(`tabSales Order`.`net_total`) AS 'Net Total'\n((SUM(`tabSales Order`.`total_commission`) / SUM(`tabSales Order`.`net_total`)) * 100) AS 'Average Commission Rate'",
+		'add_cond': '`tabSales Order`.`net_total` > 0',
+		'add_tab': None,
+		'columns': 'Sales Order\x01Business Associate',
+		'creation': '2010-08-26 11:52:27',
+		'criteria_name': 'Sales Agentwise Commission',
+		'custom_query': '',
+		'description': 'Sales Agentwise Commission',
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1}",
+		'graph_series': '',
+		'graph_values': '',
+		'group_by': '`tabSales Order`.`sales_partner`',
+		'idx': None,
+		'modified': '2010-08-26 11:48:17',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_agentwise_commission',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_order_pending_items1/__init__.py b/crm/search_criteria/sales_order_pending_items1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_order_pending_items1/__init__.py
diff --git a/crm/search_criteria/sales_order_pending_items1/sales_order_pending_items1.js b/crm/search_criteria/sales_order_pending_items1/sales_order_pending_items1.js
new file mode 100644
index 0000000..46d4b2b
--- /dev/null
+++ b/crm/search_criteria/sales_order_pending_items1/sales_order_pending_items1.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/crm/search_criteria/sales_order_pending_items1/sales_order_pending_items1.txt b/crm/search_criteria/sales_order_pending_items1/sales_order_pending_items1.txt
new file mode 100644
index 0000000..1ea02d9
--- /dev/null
+++ b/crm/search_criteria/sales_order_pending_items1/sales_order_pending_items1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.delivered_qty, 0)) AS "Qty To Deliver"\n(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.billed_qty, 0)) AS "Qty To Bill"\n(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.delivered_qty, 0))*`tabSales Order Detail`.basic_rate AS "Amount To Deliver"\n(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.billed_qty, 0))*`tabSales Order Detail`.basic_rate AS "Amount To Bill"',
+		'add_cond': '(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.delivered_qty, 0) > 0 or `tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.billed_qty, 0) > 0)\n`tabSales Order`.status != "Stopped"',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order Detail\x01Description,Sales Order Detail\x01Quantity,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Sales Order Pending Items1',
+		'custom_query': '',
+		'description': 'Sales Order Pending Items',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:08:05',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_order_pending_items1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_orderwise_booking_ b/crm/search_criteria/sales_orderwise_booking_
new file mode 100644
index 0000000..46a478c
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_booking_
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
diff --git a/crm/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py b/crm/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py
diff --git a/crm/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt b/crm/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
new file mode 100644
index 0000000..cce0f0a
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(CASE WHEN `tabSales Order`.`status` = 'Stopped' THEN (`tabSales Order Detail`.`delivered_qty` * `tabSales Order Detail`.`basic_rate`) ELSE (`tabSales Order Detail`.`qty` * `tabSales Order Detail`.`basic_rate`) END) AS 'Booking Total'\nSUM(`tabSales Order Detail`.`delivered_qty` * `tabSales Order Detail`.`basic_rate`) AS 'Delivered Amount'",
+		'add_cond': '',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Territory',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Sales Orderwise Booking & Delivery Summary',
+		'custom_query': '',
+		'description': 'Sales Orderwise Booking & Delivery Summary',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSales Order`.`name`',
+		'idx': None,
+		'modified': '2010-08-30 12:48:21',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_orderwise_booking_&_delivery_summary',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py b/crm/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py
diff --git a/crm/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.js b/crm/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.js
new file mode 100644
index 0000000..46d4b2b
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/crm/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt b/crm/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
new file mode 100644
index 0000000..290df07
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': 'SUM((`tabSales Order Detail`.`qty` - ifnull(`tabSales Order Detail`.`billed_qty`, 0)) * `tabSales Order Detail`.`basic_rate`) AS "Pending Amount"',
+		'add_cond': '`tabSales Order`.status != "Stopped"\n`tabSales Order`.order_type!="Maintenance"',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Company Name,Sales Order\x01Sales Order Date,Sales Order\x01Net Total,Sales Order\x01Zone,Sales Order\x01Territory,Sales Order\x01Email Id',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Sales Orderwise Pending Amount To Bill',
+		'custom_query': '',
+		'description': 'Sales Orderwise Pending Amount To Bill',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Company Name':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSales Order`.`name`',
+		'idx': None,
+		'modified': '2011-03-29 14:06:13',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_orderwise_pending_amount_to_bill',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py b/crm/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py
diff --git a/crm/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt b/crm/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
new file mode 100644
index 0000000..31d8a21
--- /dev/null
+++ b/crm/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': 'SUM(`tabSales Order Detail`.`qty` - ifnull(`tabSales Order Detail`.`delivered_qty`, 0)) AS "Pending Qty"',
+		'add_cond': '`tabSales Order`.status != "Stopped"\n`tabSales Order Detail`.`qty` > ifnull(`tabSales Order Detail`.`delivered_qty`, 0)',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Territory,Sales Order\x01Email Id',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Sales Orderwise Pending Qty To Deliver',
+		'custom_query': '',
+		'description': 'Sales Orderwise Pending Qty To Deliver',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSales Order`.`name`',
+		'idx': None,
+		'modified': '2011-03-29 14:02:58',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_orderwise_pending_qty_to_deliver',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py b/crm/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py
diff --git a/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js b/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
new file mode 100644
index 0000000..0e0d461
--- /dev/null
+++ b/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
@@ -0,0 +1,45 @@
+report.customize_filters = function() {
+
+  this.hide_all_filters();
+
+  this.add_filter({fieldname:'sales_person', label:'Sales Person', fieldtype:'Link', options:'Sales Person',ignore : 1,parent:'Target Detail'});
+  
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
+ 
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
+  
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
+  
+  this.add_filter({fieldname : 'target_on', label:'Target On', fieldtype:'Select', options:'Quantity'+NEWLINE+'Amount',report_default:'Quantity',ignore : 1,parent:'Target Detail'});
+  this.filter_fields_dict['Target Detail'+FILTER_SEP +'Sales Person'].df.in_first_page = 1;
+}
+this.mytabs.items['Select Columns'].hide();
+report.get_query = function() {
+
+  sales_person = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Sales Person'].get_value();
+  target_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Target On'].get_value();   
+  under = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Under'].get_value();
+  if(under == 'Sales Invoice') under = 'Receivable Voucher';
+
+  if(target_on == 'Quantity'){
+    q1 = 't1.target_qty AS "Target Quantity"';
+    q2 = '0 AS "Target Quantity"';
+    cond1 = 'ifnull(t1.target_qty,"")!=""';
+    cond2 = 'ifnull(t6.target_qty,"")!=""';
+  }  
+  else{
+    q1 = 't1.target_amount AS "Target Amount"';
+    q2 = '0 AS "Target Amount"';
+    cond1 = 'ifnull(t1.target_amount,"")!=""';
+    cond2 = 'ifnull(t6.target_amount,"")!=""';
+  }
+  if(under =='Receivable Voucher')
+    tab = 'RV';
+  else
+    tab = under;
+
+  var q ='SELECT t1.item_group AS "Item Group", '+q1+', t2.distribution_id AS "Distribution Id" FROM `tabTarget Detail` t1, `tabSales Person` t2 WHERE t1.parenttype = "Sales Person" AND t1.parent = "'+sales_person+'" AND t1.parent=t2.name AND ifnull(t1.item_group,"") != "" AND '+cond1+' UNION SELECT t3.item_group AS "Item Group", '+q2+',"" AS "Distribution Id" FROM `tab'+tab+' Detail` t3,`tabSales Team` t4,`tab'+under+'` t5 where t3.item_group NOT IN (SELECT t6.item_group AS "Item Group" FROM `tabTarget Detail` t6, `tabSales Person` t7 WHERE t6.parenttype = "Sales Person" AND t6.parent = "'+sales_person+'" AND t6.parent=t7.name AND '+cond2+') AND t4.sales_person = "'+sales_person+'" AND t3.parent = t5.name AND t4.parent = t5.name AND t5.docstatus = 1';
+
+  return q;
+
+}
\ No newline at end of file
diff --git a/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py b/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
new file mode 100644
index 0000000..1eaf7bf
--- /dev/null
+++ b/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
@@ -0,0 +1,125 @@
+# validate Filters
+flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'sales_person':'Sales Person', 'target_on':'Target On'}
+for f in flt_dict:
+  if not filter_values.get(f):
+    msgprint("Please Select " + cstr(flt_dict[f]))
+    raise Exception
+
+# Get Values from fliters
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+under = filter_values.get('under')
+if under == 'Sales Invoice': under = 'Receivable Voucher'
+sales_person = filter_values.get('sales_person')
+target_on = filter_values.get('target_on')
+
+
+# Set required field names 
+based_on_fn = 'sales_person'
+
+date_fn  = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date' 
+
+mon_list = []
+
+data = {'start_date':0, 'end_date':1}
+
+def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
+  count = 1
+  if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
+  for m in range(12):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+    
+    # make mon_list for Monthly Period
+    if period == 'Monthly' :
+      mon_list.append([start_date, last_date])
+      # add months as Column names
+      month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+      append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
+      
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+    
+    # make mon_list for Quaterly Period
+    if period == 'Quarterly' and count % 3 == 0: 
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column names
+      append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    
+    # make mon_list for Half Yearly Period
+    if period == 'Half Yearly' and count % 6 == 0 :
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+
+    # make mon_list for Annual Period
+    if period == 'Annual' and count % 12 == 0:
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
+    count = count +1
+
+def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
+  col = ['Target', 'Actual', 'Variance']
+  for c in col:
+    n = str(name) and ' (' + str(name) +')' or ''
+    colnames.append(str(c) + n )
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(c) + n ] = len(colnames) - 1
+
+
+
+# make default columns
+#coltypes[col_idx['Item Group']] = 'Link'
+#coloptions[col_idx['Item Group']]= 'Sales '
+
+# get start date
+start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
+if not start_date:
+  msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
+  raise Exception
+start_date = start_date.strftime('%Y-%m-%d')
+
+# make month list and columns
+make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
+
+
+
+bc_obj = get_obj('Budget Control')
+for r in res:
+
+  count = 0
+
+  for idx in range(3, len(colnames), 3):
+
+    cidx = 2
+    # ================= Calculate Target ==========================================
+    r.append(bc_obj.get_monthly_budget(r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
+
+    #================== Actual Amount =============================================
+    actual = 0
+
+
+
+    #----------------------------------------------------------    
+    if target_on == "Quantity":
+
+      actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+    
+    #----------------------------------------------------------  
+    if target_on == "Amount":
+
+      actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+    #----------------------------------------------------------
+
+    actual = actual and flt(actual[0][0]) or 0 
+    r.append(actual)
+    # ================ Variance ===================================================
+
+    r.append(r[idx] - r[idx + 1])
+
+    count = count +1
\ No newline at end of file
diff --git a/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt b/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
new file mode 100644
index 0000000..07ba395
--- /dev/null
+++ b/crm/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Sales Persons Target Variance (Item Group wise)',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Target Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-25 17:22:58',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_persons_target_variance_item_group_wise',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Person',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabTarget Detail`.`target_amount`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/sales_personwise_transaction_summary/__init__.py b/crm/search_criteria/sales_personwise_transaction_summary/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/sales_personwise_transaction_summary/__init__.py
diff --git a/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js b/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
new file mode 100755
index 0000000..15de4b9
--- /dev/null
+++ b/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
@@ -0,0 +1,40 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  //Add filter
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Order', ignore : 1,parent:'Sales Person', single_select :1, in_first_page:1});
+  this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'Sales Person', in_first_page:1});
+  this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'Sales Person', in_first_page:1});
+  this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1,parent:'Sales Person', in_first_page:1});
+  this.add_filter({fieldname:'sales_person', label:'Sales Person', fieldtype:'Link', options:'Sales Person', ignore : 1,parent:'Sales Person', in_first_page:1});
+}
+
+// hide sections
+this.mytabs.items['More Filters'].hide();
+this.mytabs.items['Select Columns'].hide();
+
+// Get query
+report.get_query = function() {
+  based_on = this.get_filter('Sales Person', 'Based On').get_value();
+  from_date = this.get_filter('Sales Person', 'From Date').get_value();
+  to_date = this.get_filter('Sales Person', 'To Date').get_value();
+  vid = this.get_filter('Sales Person', 'Voucher Id').get_value();
+  terr = this.get_filter('Sales Person', 'Territory').get_value();
+  sp = this.get_filter('Sales Person', 'Sales Person').get_value();
+
+  date_fld = 'transaction_date';
+  if(based_on == 'Sales Invoice') {
+    based_on = 'Receivable Voucher';
+    date_fld = 'voucher_date';
+  }
+
+  sp_cond = '';
+  if (from_date) sp_cond += ' AND t1.' + date_fld + '>= "' + from_date + '"';
+  if (to_date) sp_cond += ' AND t1.' + date_fld + '<= "' + to_date + '"';
+  if (vid) sp_cond += ' AND t1.name LIKE "%' + vid + '%"';
+  if (terr) sp_cond += ' AND t1.territory = "' + terr + '"';
+  if (sp) sp_cond += ' AND t2.sales_person = "' + sp + '"';
+
+  return 'SELECT t1.`name`, t1.`customer_name`, t1.`territory`, t1.`' + date_fld + '`, t1.`net_total`, t1.`grand_total`, t2.`sales_person`, t2.`allocated_percentage`, t2.`allocated_amount` FROM `tab' + based_on + '` t1, `tabSales Team` t2 WHERE t1.docstatus=1 AND t2.`parenttype` = "' + based_on + '" AND t2.`parent` = t1.`name`' + sp_cond + ' ORDER BY t1.`name` DESC';
+}
+
diff --git a/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py b/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
new file mode 100755
index 0000000..e47d654
--- /dev/null
+++ b/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
@@ -0,0 +1,13 @@
+if filter_values.get('based_on') == 'Sales Invoice':
+  based_on_dt = 'Receivable Voucher'
+else:
+  based_on_dt = filter_values.get('based_on')
+
+cols = [[filter_values.get('based_on'), 'Link','150px', based_on_dt], ['Customer', 'Link','150px','Customer'], ['Territory', 'Link','120px','Territory'], ['Transaction Date', 'Date', '120px', ''], ['Net Total', 'Currency', '80px', ''], ['Grand Total', 'Currency', '80px', ''], ['Sales Person', 'Link', '150px', 'Sales Person'], ['% Contribution', 'Currency', '120px', ''], ['Contribution Amt', 'Currency', '120px', '']]
+
+for c in cols:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
diff --git a/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt b/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
new file mode 100755
index 0000000..1013bc4
--- /dev/null
+++ b/crm/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Sales Person\x01ID',
+		'creation': '2011-06-07 16:58:27',
+		'criteria_name': 'Sales Personwise Transaction Summary',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Person',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-02-24 17:35:32',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_personwise_transaction_summary',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Person`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/so_pending_items_3/__init__.py b/crm/search_criteria/so_pending_items_3/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/so_pending_items_3/__init__.py
diff --git a/crm/search_criteria/so_pending_items_3/so_pending_items_3.txt b/crm/search_criteria/so_pending_items_3/so_pending_items_3.txt
new file mode 100644
index 0000000..43cdc8d
--- /dev/null
+++ b/crm/search_criteria/so_pending_items_3/so_pending_items_3.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order Detail\x01Description,Sales Order Detail\x01Quantity,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'SO Pending items 3',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Company':'Alpha Company','Sales Order\x01Fiscal Year':'2010-2011'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-20 16:20:50',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'so_pending_items_3',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/target_variance_report/__init__.py b/crm/search_criteria/target_variance_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/target_variance_report/__init__.py
diff --git a/crm/search_criteria/target_variance_report/target_variance_report.js b/crm/search_criteria/target_variance_report/target_variance_report.js
new file mode 100644
index 0000000..8a717b0
--- /dev/null
+++ b/crm/search_criteria/target_variance_report/target_variance_report.js
@@ -0,0 +1,27 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Cost Center'+NEWLINE+'Sales Person'+NEWLINE+'Sales Partner',report_default:'Cost Center',ignore : 1,parent:'Target Detail'});
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item Group',ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Receivable Voucher',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
+
+}
+
+report.get_query = function() {
+  group_by = '';
+  group_by = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Group By'].get_value();
+  based_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Based On'].get_value();
+  sel_fields = '`tabTarget Detail`.parent AS "' + cstr(based_on)+'"';
+  cond = ' and ifnull(`tabTarget Detail`.item_group, "") = ""'
+  if (group_by == 'Item Group'){
+    sel_fields = cstr(sel_fields) + ', `tabTarget Detail`.item_group';
+    cond =  ' and ifnull(`tabTarget Detail`.item_group,"") != ""'
+  }
+  sel_fields = cstr(sel_fields) + ', `tabTarget Detail`.target_amount, `tabTarget Detail`.distribution_id';
+  var q = 'SELECT '+ cstr(sel_fields) +' FROM `tabTarget Detail` WHERE `tabTarget Detail`.parenttype = "' + cstr(based_on) + '"'+ cstr(cond);
+  return q
+}
+
+this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/crm/search_criteria/target_variance_report/target_variance_report.py b/crm/search_criteria/target_variance_report/target_variance_report.py
new file mode 100644
index 0000000..44016ee
--- /dev/null
+++ b/crm/search_criteria/target_variance_report/target_variance_report.py
@@ -0,0 +1,110 @@
+# validate Filters
+flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'company':'Company', 'under' : 'Under', 'based_on' : 'Based On'}
+for f in flt_dict:
+  if not filter_values.get(f):
+    msgprint("Please Select " + cstr(flt_dict[f]))
+    raise Exception
+
+# Get Values from fliters
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+under = filter_values.get('under')
+based_on = filter_values.get('based_on')
+group_by = filter_values.get('group_by')
+
+# Set required field names 
+based_on_fn = (based_on == 'Cost Center') and 'cost_center' or (based_on == 'Sales Partner') and 'sales_partner' or (based_on == 'Sales Person') and 'sales_person'
+date_fn  = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date' 
+
+mon_list = []
+data = {'start_date':0, 'end_date':1}
+
+def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
+  count = 1
+  if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
+  for m in range(12):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+    
+    # make mon_list for Monthly Period
+    if period == 'Monthly' :
+      mon_list.append([start_date, last_date])
+      # add months as Column names
+      month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+      append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
+      
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+    
+    # make mon_list for Quaterly Period
+    if period == 'Quarterly' and count % 3 == 0: 
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column names
+      append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    
+    # make mon_list for Half Yearly Period
+    if period == 'Half Yearly' and count % 6 == 0 :
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+
+    # make mon_list for Annual Period
+    if period == 'Annual' and count % 12 == 0:
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
+    count = count +1
+
+def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
+  col = ['Budget', 'Actual', 'Variance']
+  for c in col:
+    colnames.append(str(c) + ' (' + str(name) +')' )
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(c) + ' (' + str(name) +')' ] = len(colnames) - 1
+
+# make default columns
+coltypes[col_idx[based_on]] = 'Link'
+coloptions[col_idx[based_on]]= based_on 
+
+# get start date
+start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
+if not start_date:
+  msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
+  raise Exception
+start_date = start_date.strftime('%Y-%m-%d')
+
+# make month list and columns
+make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
+
+bc_obj = get_obj('Budget Control')
+for r in res:
+  count = 0
+  for idx in range((group_by == 'Item Group') and 4 or 3, len(colnames), 3):
+    cidx = (group_by == 'Item Group') and 3 or 2
+    # ================= Calculate Target ==========================================
+    r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
+    
+    #================== Actual Amount =============================================
+    actual = 0
+    if based_on == 'Cost Center' or based_on == 'Sales Partner':
+      if group_by =='Item Group':
+        actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = flt(actual[0][0])
+      else:
+        actual = sql("select sum(ifnull(net_total,0)) from `tab%s` where %s = '%s' and docstatus = 1 and %s between '%s' and '%s' " % (under, based_on_fn, r[0], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = flt(actual[0][0])
+    elif based_on == 'Sales Person':
+      if group_by =='Item Group':
+        actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = flt(actual[0][0])
+      else:
+        actual = sql("select sum(ifnull(t2.allocated_amount,0)) from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and t1.%s between '%s' and '%s'"%(under, based_on_fn, r[0], under, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = flt(actual[0][0])
+    r.append(actual)
+    # ================ Variance ===================================================
+    r.append(r[idx] - r[idx + 1])
+    count = count +1
\ No newline at end of file
diff --git a/crm/search_criteria/target_variance_report/target_variance_report.txt b/crm/search_criteria/target_variance_report/target_variance_report.txt
new file mode 100644
index 0000000..5264f63
--- /dev/null
+++ b/crm/search_criteria/target_variance_report/target_variance_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Sales Person\x01ID,Sales Person\x01Owner,Sales Person\x01Sales Person,Sales Person\x01Country,Sales Person\x01State,Target Detail\x01Item Group,Target Detail\x01Fiscal Year,Target Detail\x01Target  Amount',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Target Variance Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 0,
+		'doc_type': 'Target Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-23 12:27:37',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'target_variance_report',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Person',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/territories_target_variance_item_group_wise/__init__.py b/crm/search_criteria/territories_target_variance_item_group_wise/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/territories_target_variance_item_group_wise/__init__.py
diff --git a/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js b/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
new file mode 100644
index 0000000..1843632
--- /dev/null
+++ b/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
@@ -0,0 +1,45 @@
+report.customize_filters = function() {
+
+  this.hide_all_filters();
+
+  this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory',ignore : 1,parent:'Target Detail'});
+  
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
+ 
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
+  
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
+  
+  this.add_filter({fieldname : 'target_on', label:'Target On', fieldtype:'Select', options:'Quantity'+NEWLINE+'Amount',report_default:'Quantity',ignore : 1,parent:'Target Detail'});
+  this.filter_fields_dict['Target Detail'+FILTER_SEP +'Territory'].df.in_first_page = 1;
+}
+this.mytabs.items['Select Columns'].hide();
+report.get_query = function() {
+
+  territory = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Territory'].get_value();
+  target_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Target On'].get_value();   
+  under = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Under'].get_value();   
+  if(under == 'Sales Invoice') under = 'Receivable Voucher';
+
+  if(target_on == 'Quantity'){
+    q1 = 't1.target_qty AS "Target Quantity"';
+    q2 = '0 AS "Target Quantity"';
+    cond1 = 'ifnull(t1.target_qty,"")!=""';
+    cond2 = 'ifnull(t5.target_qty,"")!=""';
+  }  
+  else{
+    q1 = 't1.target_amount AS "Target Amount"';
+    q2 = '0 AS "Target Amount"';
+    cond1 = 'ifnull(t1.target_amount,"")!=""';
+    cond2 = 'ifnull(t5.target_amount,"")!=""';
+  }
+  if(under =='Receivable Voucher')
+    tab = 'RV';
+  else
+    tab = under;
+
+  var q ='SELECT distinct t1.item_group AS "Item Group", '+q1+', t2.distribution_id AS "Distribution Id" FROM `tabTarget Detail` t1, `tabTerritory` t2 WHERE t1.parenttype = "Territory" AND t1.parent = "'+territory+'" AND t1.parent=t2.name AND ifnull(t1.item_group,"")!="" AND '+cond1+' UNION SELECT distinct t3.item_group AS "Item Group", '+q2+',"" AS "Distribution Id" FROM `tab'+tab+' Detail` t3,`tab'+under+'` t4 where t3.item_group NOT IN (SELECT t5.item_group FROM `tabTarget Detail` t5, `tabTerritory` t6 WHERE t5.parenttype = "Territory" AND t5.parent = "'+territory+'" AND t5.parent=t6.name AND '+cond2+') AND t4.territory = "'+territory+'" AND t3.parent = t4.name AND t4.docstatus = 1';
+
+  return q;
+
+}
\ No newline at end of file
diff --git a/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py b/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
new file mode 100644
index 0000000..41e9e16
--- /dev/null
+++ b/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
@@ -0,0 +1,127 @@
+# validate Filters
+flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'territory':'Territory', 'target_on':'Target On'}
+for f in flt_dict:
+  if not filter_values.get(f):
+    msgprint("Please Select " + cstr(flt_dict[f]))
+    raise Exception
+
+# Get Values from fliters
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+under = filter_values.get('under')
+if under == 'Sales Invoice': under = 'Receivable Voucher'
+territory = filter_values.get('territory')
+target_on = filter_values.get('target_on')
+
+
+# Set required field names 
+based_on_fn = 'territory'
+
+date_fn  = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date' 
+
+mon_list = []
+
+data = {'start_date':0, 'end_date':1}
+
+def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
+  count = 1
+  if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
+  for m in range(12):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+    
+    # make mon_list for Monthly Period
+    if period == 'Monthly' :
+      mon_list.append([start_date, last_date])
+      # add months as Column names
+      month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+      append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
+      
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+    
+    # make mon_list for Quaterly Period
+    if period == 'Quarterly' and count % 3 == 0: 
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column names
+      append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    
+    # make mon_list for Half Yearly Period
+    if period == 'Half Yearly' and count % 6 == 0 :
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+
+    # make mon_list for Annual Period
+    if period == 'Annual' and count % 12 == 0:
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
+    count = count +1
+
+def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
+  col = ['Target', 'Actual', 'Variance']
+  for c in col:
+    n = str(name) and ' (' + str(name) +')' or ''
+    colnames.append(str(c) + n )
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(c) + n ] = len(colnames) - 1
+
+
+
+# make default columns
+#coltypes[col_idx['Item Group']] = 'Link'
+#coloptions[col_idx['Item Group']]= 'Sales '
+
+# get start date
+start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
+if not start_date:
+  msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
+  raise Exception
+start_date = start_date.strftime('%Y-%m-%d')
+
+# make month list and columns
+make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
+
+
+
+bc_obj = get_obj('Budget Control')
+for r in res:
+
+  count = 0
+
+  for idx in range(3, len(colnames), 3):
+
+    cidx = 2
+    # ================= Calculate Target ==========================================
+    r.append(bc_obj.get_monthly_budget(r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
+
+    #================== Actual Amount =============================================
+    actual = 0
+
+
+
+    #----------------------------------------------------------    
+    if target_on == "Quantity":
+
+      actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+      
+    
+    #----------------------------------------------------------  
+    if target_on == "Amount":
+
+      actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+
+    #----------------------------------------------------------
+
+    actual = actual and flt(actual[0][0]) or 0 
+    r.append(actual)
+    # ================ Variance ===================================================
+
+    r.append(r[idx] - r[idx + 1])
+
+    count = count +1
\ No newline at end of file
diff --git a/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt b/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
new file mode 100644
index 0000000..497bc13
--- /dev/null
+++ b/crm/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Territories Target Variance (Item Group wise)',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Target Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-25 13:18:22',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'territories_target_variance_item_group_wise',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Person',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabTarget Detail`.`target_amount`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/territory_item_group_wise_gp/__init__.py b/crm/search_criteria/territory_item_group_wise_gp/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/territory_item_group_wise_gp/__init__.py
diff --git a/crm/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.py b/crm/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.py
new file mode 100644
index 0000000..3c513df
--- /dev/null
+++ b/crm/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.py
@@ -0,0 +1,107 @@
+# Add Columns
+# ------------
+based_on = filter_values.get('based_on')
+
+columns = [[based_on,'Data','150px',''],
+           ['Total Qty','Currency','150px',''],
+           ['Revenue','Currency','150px',''],
+           ['Valuation Amount','Currency','150px',''],
+           ['Gross Profit (%)','Currrency','150px',''],
+           ['Gross Profit','Currency','150px','']]           
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+
+
+
+def make_child_lst(based_on,name):
+  rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
+  ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
+  chl ='('
+  flag = 1
+  for c in ch_name:
+    if flag == 1:
+     chl += "'%s'"%c[0]
+     flag = 2
+    else:
+      chl +=",'%s'"%c[0]
+
+  chl +=")"
+  return chl
+
+
+
+for r in res:
+
+  qty, rate, amt, tot_val_rate, val_amount = 0, 0, 0, 0,0
+  cn = make_child_lst(based_on,r[0].strip())
+
+
+
+  if based_on == 'Item Group':
+  
+    dn = sql("select name from `tabItem` where item_group in %s"%(cn))
+    for n in dn:
+      
+      dt = sql("select sum(qty),sum(amount) from `tabDelivery Note Detail` where item_code ='%s' and docstatus = 1"%n[0])  
+          
+      qty += dt[0][0] and dt[0][0] or 0
+      amt += dt[0][1] and dt[0][1] or 0  
+      prt = sql("select distinct t1.name from `tabDelivery Note` t1, `tabDelivery Note Detail` t2 where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t2.docstatus =1 order by t1.name"%n[0])
+      for p in prt:
+        d1 = sql("select qty from `tabDelivery Note Detail` where parent = '%s' and parenttype ='Delivery Note' and docstatus =1 and item_code = '%s'"%(p[0],n[0]))
+        for t in d1:
+          tot_val_rate = 0
+          packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Detail` where parent = '%s' and parent_item = '%s' and docstatus = 1 order by item_code, warehouse, qty"%(p[0],n[0]))
+                           
+          for d in packing_list_items:
+            if d[1]:
+              val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = '%s' and warehouse = '%s' and voucher_type = 'Delivery Note' and voucher_no = '%s' and is_cancelled = 'No'"%(d[0], d[1], p[0]))
+              
+              val_rate = val_rate and val_rate[0][0] or 0
+              
+              tot_val_rate += t[0] and (flt(val_rate) * flt(d[2]) / flt(t[0])) or 0
+          val_amount += flt(tot_val_rate) * flt(t[0])  
+  elif based_on == 'Territory':
+    
+
+    dn = sql("select name from `tabDelivery Note` where territory in %s and docstatus =1 order by name"%(cn))
+
+    for n in dn:
+
+      dt = sql("select sum(qty), sum(amount) from `tabDelivery Note Detail` where parent = '%s' and docstatus = 1"%n[0])
+      qty += dt[0][0] and dt[0][0] or 0
+      amt += dt[0][1] and dt[0][1] or 0
+
+      d1 = sql("select item_code,qty from `tabDelivery Note Detail` where parent = '%s' and parenttype ='Delivery Note' and docstatus =1"%n[0])
+
+      for t in d1:
+        tot_val_rate = 0
+        packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Detail` where parent = '%s' and parent_item = '%s' and docstatus = 1 order by item_code, warehouse,qty"%(n[0],t[0]))
+       
+        for d in packing_list_items:
+          if d[1]:
+            
+            val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = '%s' and warehouse = '%s' and voucher_type = 'Delivery Note' and voucher_no = '%s' and is_cancelled = 'No'"%(d[0], d[1], n[0]))
+            val_rate = val_rate and val_rate[0][0] or 0
+            
+            tot_val_rate += t[1] and (flt(val_rate) * flt(d[2]) / flt(t[1])) or 0
+        val_amount += flt(tot_val_rate) * flt(t[1])
+  r.append(fmt_money(qty))
+
+  r.append(fmt_money(amt))
+  gp = flt(r[col_idx['Revenue']]) - flt(val_amount)
+  
+  if val_amount: gp_percent = gp * 100 / flt(val_amount)
+  else: gp_percent = gp
+  gp_percent = '%0.2f'%gp_percent
+
+      
+
+  r.append(fmt_money(val_amount))
+  r.append(fmt_money(gp_percent))
+  r.append(fmt_money(gp))
\ No newline at end of file
diff --git a/crm/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.txt b/crm/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.txt
new file mode 100644
index 0000000..ff29d1d
--- /dev/null
+++ b/crm/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': None,
+		'creation': '2010-12-14 17:52:48',
+		'criteria_name': 'Territory, Item Group wise GP',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 14:40:26',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'territory_item_group_wise_gp',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': None,
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/territory_sales___variance_report/__init__.py b/crm/search_criteria/territory_sales___variance_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/territory_sales___variance_report/__init__.py
diff --git a/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js b/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
new file mode 100644
index 0000000..b589c25
--- /dev/null
+++ b/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
@@ -0,0 +1,6 @@
+report.customize_filters = function() {
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Receivable Voucher',report_default:'Sales Order',ignore : 1, parent:'Territory'});
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Territory'});
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Territory'});
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Territory'});
+}
\ No newline at end of file
diff --git a/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py b/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py
new file mode 100644
index 0000000..3d0fbe2
--- /dev/null
+++ b/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py
@@ -0,0 +1,188 @@
+if filter_values.get('period'):
+  period_values = filter_values['period']
+  if len(period_values.split(NEWLINE))>1:
+    msgprint("You can view report only for one period. Please select only one value in period.")
+    raise Exception
+  else:
+    period = period_values.split(NEWLINE)[0]
+
+if filter_values.get('based_on'):
+  based_on = filter_values['based_on']
+  if len(based_on.split(NEWLINE)) > 1:
+    msgprint("You can view report based on only one criteria. Please select only one value in Based On.")
+    raise Exception
+  else:
+    based_on = based_on.split(NEWLINE)[0]
+
+if not filter_values.get('fiscal_year'):
+  msgprint("Please Select Fiscal Year")
+  raise Exception
+elif not filter_values.get('period'):
+  msgprint("Please Select Period")
+  raise Exception
+elif not filter_values.get('based_on'):
+  msgprint("Please Select the Criteria on which you want your report to be based")
+  raise Exception
+
+fiscal_year = filter_values.get('fiscal_year')
+
+# get fiscal year start date and start month
+# ---------------------------------------------------------  
+year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
+start_date = year_start_date and year_start_date[0][0] or ''
+start_month = year_start_date and year_start_date[0][1] or ''
+month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+
+# Add columns based on period
+# --------------------------------
+columns = []
+# ================ Annual ======================
+if period == 'Annual':
+  columns.append(['Target','Currency','120px',''])
+  columns.append(['Actual','Currency','120px',''])
+
+# =========== Half Yearly ======================
+elif period == 'Half Yearly':
+  columns.append(['Target (H1)','Currency','120px','']) # first half
+  columns.append(['Actual (H1)','Currency','120px','']) # first half
+  if start_month == 1:  # this is case when fiscal year starts with JAN
+    columns.append(['Target (H2)','Currency','120px',''])
+    columns.append(['Actual (H2)','Currency','120px',''])
+  else:  #this is case when fiscal year starts with other than JAN
+    columns.append(['Target (H2)','Currency','120px',''])
+    columns.append(['Actual (H2)','Currency','120px',''])
+  
+# ================ Quarterly ===================
+elif period == 'Quarterly':
+  length_1 = (len(month_name) - start_month + 1) / 3  #this gives the total no. of times we need to iterate for quarter
+  val = length_1 % 4
+  q_no = 1
+  for i in range(length_1):
+    value = 3*i + val
+    columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
+    columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
+    q_no += 1
+  length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
+  for i in range(length_2):
+    columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
+    columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
+    q_no += 1;
+
+  
+# =============== Monthly ======================
+elif period == 'Monthly':
+  for i in range(start_month-1,len(month_name)):
+    columns.append(['Target ('+month_name[i]+')','Currency','120px',''])
+    columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
+
+  for i  in range(start_month-1):
+    columns.append(['Target('+month_name[i]+')','Currency','120px',''])
+    columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
+
+
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+
+
+condition = ' docstatus = 1 and fiscal_year = "'+fiscal_year+'"'
+
+
+for r in res:
+  query = ''
+
+  # ================= Annual Report =============== 
+  if period == 'Annual':
+
+    target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s ",(r[col_idx['ID']],fiscal_year))
+    target = target and flt(target[0][0]) or 0
+    r.append(target)
+
+  
+    so = sql("select sum(net_total) from `tab%s` where territory = '%s' and %s" % (based_on, r[col_idx['ID']],condition))
+    so = so and flt(so[0][0]) or 0
+    r.append(so)
+
+  # ================= Half Yearly Report =============== 
+  elif period == 'Half Yearly':
+    target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s",(r[col_idx['ID']],fiscal_year))
+    target = target and flt(flt(target[0][0])/2) or 0
+    r.append(target)
+
+    query += ' MONTH(transaction_date) BETWEEN '+cstr(start_month)+' and '+cstr(start_month+5)
+    so = sql("select sum(net_total) from `tab%s` where territory = '%s'  and %s and %s" % (based_on, r[col_idx['ID']],condition,query))
+    so = so and flt(so[0][0]) or 0
+    r.append(so)
+    
+    r.append(target)
+
+    query =''
+    query += 'MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' and '+cstr(start_month+5)
+    so = sql("select sum(net_total) from `tab%s` where territory = '%s'  and %s and %s" % (based_on, r[col_idx['ID']],condition,query))
+    so = so and flt(so[0][0]) or 0
+    r.append(so)
+    query = ''
+
+  # =============== Quarterly Report ==============  
+  elif period == 'Quarterly':
+    query = ''
+    length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
+    val = length_1 % 4;
+    for i in range(length_1):
+      value = 3*i + val;
+      query +='SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
+    length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
+    for i in range(length_2):
+      query += 'SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END)';
+
+    target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s",(r[col_idx['ID']],fiscal_year))
+    target = target and flt(flt(target[0][0])/4) or 0
+
+
+    so = sql("SELECT %s from `tab%s` where territory ='%s' and %s " %(query,based_on,r[col_idx['ID']],condition))
+    i = 0
+    length_l = 0
+    for c in columns:
+      if length_l == 0:
+        r.append(target)
+        length_l += 1
+      else:
+        so_total = so and flt(so[0][i]) or 0
+        r.append(so_total)
+        i +=1
+        length_l = 0
+
+  # ================ Monthly Report =============== 
+  elif period == 'Monthly':
+    query =''
+    target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s",(r[col_idx['ID']],fiscal_year))
+    #msgprint(target)
+    target = target and flt(flt(target[0][0])/12) or 0
+
+
+    # for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
+    for i in range(start_month-1,len(month_name)):
+      query += 'SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
+
+    for i  in range(start_month-1):
+      if i != (start_month-2):
+        query += 'SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
+      else:
+        query += 'SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END)';
+    so = sql("SELECT %s from `tab%s` where territory ='%s' and %s " %(query,based_on,r[col_idx['ID']],condition))
+
+    i = 0
+    length_l = 0
+    for c in columns:
+      if length_l == 0:
+        r.append(target)
+        length_l += 1
+      else:
+        so_total = so and flt(so[0][i]) or 0
+        r.append(so_total)
+        i +=1
+        length_l = 0
\ No newline at end of file
diff --git a/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt b/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
new file mode 100644
index 0000000..3268c52
--- /dev/null
+++ b/crm/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Territory\x01ID',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Territory Sales - Variance Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Territory',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Territory\x01State':'','Territory\x01Based On':'Sales Order','Territory\x01Fiscal Year':'2009-2010','Territory\x01Company':'Alpha Company','Territory\x01Period':'Quarterly'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '',
+		'idx': None,
+		'modified': '2010-03-30 16:48:42',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'territory_sales_-_variance_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/total_target_variance_report/__init__.py b/crm/search_criteria/total_target_variance_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/total_target_variance_report/__init__.py
diff --git a/crm/search_criteria/total_target_variance_report/total_target_variance_report.js b/crm/search_criteria/total_target_variance_report/total_target_variance_report.js
new file mode 100644
index 0000000..d5ec9de
--- /dev/null
+++ b/crm/search_criteria/total_target_variance_report/total_target_variance_report.js
@@ -0,0 +1,12 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Sales Person',report_default:'Territory',ignore : 1,parent:'Target Detail', single_select :1});
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail', single_select :1});
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail', single_select :1});
+  this.add_filter({fieldname : 'target_on', label:'Target On', fieldtype:'Select', options:'Quantity'+NEWLINE+'Amount',report_default:'Quantity',ignore : 1,parent:'Target Detail', single_select :1});
+}
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
+this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/crm/search_criteria/total_target_variance_report/total_target_variance_report.py b/crm/search_criteria/total_target_variance_report/total_target_variance_report.py
new file mode 100644
index 0000000..ff26227
--- /dev/null
+++ b/crm/search_criteria/total_target_variance_report/total_target_variance_report.py
@@ -0,0 +1,206 @@
+# validate Filters
+flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'based_on' : 'Based On','target_on':'Target On'}
+for f in flt_dict:
+  if not filter_values.get(f):
+    msgprint("Please Select " + cstr(flt_dict[f]))
+    raise Exception
+
+# Get Values from fliters
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+under = filter_values.get('under')
+if under == 'Sales Invoice': under = 'Receivable Voucher'
+based_on = filter_values.get('based_on')
+target_on = filter_values.get('target_on')
+
+#add distributed id field
+col = []
+col.append([based_on,'Date','150px',''])
+if target_on == 'Quantity':
+  col.append(['Target Quantity','Currency','150px',''])
+else:
+  col.append(['Target Amount','Currency','150px',''])
+col.append(['Distribution Id','Date','150px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  
+  col_idx[c[0]] = len(colnames)-1
+
+def make_child_lst(based_on,name):
+  rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
+  ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
+  chl ='('
+  flag = 1
+  for c in ch_name:
+    if flag == 1:
+     chl += "'%s'"%c[0]
+     flag = 2
+    else:
+      chl +=",'%s'"%c[0]
+
+  chl +=")"
+  return chl
+
+
+def get_target(target_on,based_on,fiscal_year,r):
+
+  if target_on == 'Quantity':
+    q1 = "select t1.target_qty "
+    q2 = "select sum(t1.target_qty)"
+  if target_on == 'Amount':
+    q1 = "select t1.target_amount "
+    q2 = "select sum(t1.target_amount)"
+    
+  cond1 =" t1.fiscal_year ='%s' and t1.parent=t2.name and t1.parenttype = '%s' and t1.docstatus !=2"
+  #----------------------------------------------------------------  
+  q = "select t1.name from `tabTarget Detail` t1, `tab%s` t2 where "+cond1+" and t2.name = '%s'"
+  ch = sql(q%(based_on,fiscal_year,based_on,r))
+
+  return {'q1':q1,'q2':q2,'cond1':cond1,'ch':ch}
+
+for r in res:
+  
+  tt = get_target(target_on,based_on,fiscal_year,r[0].strip())
+  
+  if tt['ch']:
+    
+    cond2 = " ifnull(t1.item_group,'')='' and"
+    qur = tt['q1']+"from `tabTarget Detail` t1, `tab%s` t2 where "+cond2+tt['cond1']+" and t2.name = '%s'"
+    ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
+    
+    #----------------------------------------------------------------  
+    if not ret_amt:
+      qur = tt['q2']+"from `tabTarget Detail` t1, `tab%s` t2 where "+tt['cond1']+" and t2.name = '%s'"
+      ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))  
+
+  #----------------------------------------------------------------      
+  else:
+    node_lst = make_child_lst(based_on,r[0].strip())
+    qur = tt['q2']+"from `tabTarget Detail` t1, `tab%s` t2 where "+tt['cond1']+" and t2.name in %s"
+    ret_amt = sql(qur%(based_on,fiscal_year,based_on,node_lst))    
+
+  #----------------------------------------------------------------  
+  ret_dis_id = sql("select distribution_id from `tab%s` where name = '%s'"%(based_on,r[0].strip()))
+
+  target_amt = ret_amt and flt(ret_amt[0][0]) or 0
+  dis_id = ret_dis_id and ret_dis_id[0][0] or ''
+
+  r.append(target_amt)
+  r.append(dis_id)
+
+
+# Set required field names 
+based_on_fn = (based_on == 'Territory') and 'territory' or 'sales_person'
+
+date_fn  = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date' 
+
+mon_list = []
+
+data = {'start_date':0, 'end_date':1}
+
+def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
+  count = 1
+  if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
+  for m in range(12):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+    
+    # make mon_list for Monthly Period
+    if period == 'Monthly' :
+      mon_list.append([start_date, last_date])
+      # add months as Column names
+      month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+      append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
+      
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+    
+    # make mon_list for Quaterly Period
+    if period == 'Quarterly' and count % 3 == 0: 
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column names
+      append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+    
+    # make mon_list for Half Yearly Period
+    if period == 'Half Yearly' and count % 6 == 0 :
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
+      if count != 12: mon_list.append([start_date])
+
+    # make mon_list for Annual Period
+    if period == 'Annual' and count % 12 == 0:
+      mon_list[len(mon_list) - 1 ].append(last_date)
+      # add Column Names
+      append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
+    count = count +1
+
+def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
+  col = ['Target', 'Actual', 'Variance']
+  for c in col:
+    n = str(name) and ' (' + str(name) +')' or ''
+    colnames.append(str(c) + n)
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(c) + n ] = len(colnames) - 1
+
+
+
+# make default columns
+#coltypes[col_idx[based_on]] = 'Link'
+#coloptions[col_idx[based_on]]= based_on
+
+# get start date
+start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
+if not start_date:
+  msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
+  raise Exception
+start_date = start_date.strftime('%Y-%m-%d')
+
+# make month list and columns
+make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
+
+
+bc_obj = get_obj('Budget Control')
+for r in res:
+  count = 0
+
+  for idx in range(3, len(colnames), 3):
+    cidx = 2
+
+    # ================= Calculate Target ==========================================
+    r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
+    
+    #================== Actual Amount =============================================
+    actual = 0
+
+    ch = make_child_lst(based_on,r[0].strip())
+
+    #----------------------------------------------------------    
+    if target_on == "Quantity":
+      if based_on == "Territory":
+        actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s in %s and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+      
+      elif based_on == 'Sales Person':
+        actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s in %s and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+    
+    #----------------------------------------------------------  
+    if target_on == "Amount":
+      if based_on == 'Territory':    
+        
+        actual = sql("select sum(ifnull(net_total,0)) from `tab%s` where %s in %s and docstatus = 1 and %s between '%s' and '%s' " % (under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+    
+      elif based_on == 'Sales Person':
+        actual = sql("select sum(ifnull(t2.allocated_amount,0)) from `tab%s` t1, `tabSales Team` t2 where t2.%s in %s and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and t1.%s between '%s' and '%s'"%(under, based_on_fn, ch, under, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+    #----------------------------------------------------------
+    actual = flt(actual[0][0])
+    r.append(actual)
+    # ================ Variance ===================================================
+    r.append(r[idx] - r[idx + 1])
+    count = count +1
\ No newline at end of file
diff --git a/crm/search_criteria/total_target_variance_report/total_target_variance_report.sql b/crm/search_criteria/total_target_variance_report/total_target_variance_report.sql
new file mode 100644
index 0000000..ebd7ae8
--- /dev/null
+++ b/crm/search_criteria/total_target_variance_report/total_target_variance_report.sql
@@ -0,0 +1 @@
+SELECT CONCAT(REPEAT('     ', COUNT(parent.name) - 1), node.name) AS name FROM `tab%(based_on)s` AS node,`tab%(based_on)s` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
\ No newline at end of file
diff --git a/crm/search_criteria/total_target_variance_report/total_target_variance_report.txt b/crm/search_criteria/total_target_variance_report/total_target_variance_report.txt
new file mode 100644
index 0000000..27ea80c
--- /dev/null
+++ b/crm/search_criteria/total_target_variance_report/total_target_variance_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Sales Person\x01ID,Sales Person\x01Owner,Sales Person\x01Sales Person,Sales Person\x01Country,Sales Person\x01State,Sales Person\x01lft,Sales Person\x01rgt,Target Detail\x01Item Group,Target Detail\x01Fiscal Year,Target Detail\x01Target  Amount',
+		'creation': '2010-12-14 10:33:08',
+		'criteria_name': 'Total Target Variance Report',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Target Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-30 15:15:34',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'total_target_variance_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Person',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Person`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/crm/search_criteria/variance_report/__init__.py b/crm/search_criteria/variance_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crm/search_criteria/variance_report/__init__.py
diff --git a/crm/search_criteria/variance_report/variance_report.js b/crm/search_criteria/variance_report/variance_report.js
new file mode 100644
index 0000000..e1f67d6
--- /dev/null
+++ b/crm/search_criteria/variance_report/variance_report.js
@@ -0,0 +1,12 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Sales Person'+NEWLINE+'Sales Partner',report_default:'Territory',ignore : 1,parent:'Target Detail'});
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
+//  this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item Group',ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Receivable Voucher',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
+}  
+
+//this.mytabs.items['Select Columns'].hide()
diff --git a/crm/search_criteria/variance_report/variance_report.py b/crm/search_criteria/variance_report/variance_report.py
new file mode 100644
index 0000000..3c26745
--- /dev/null
+++ b/crm/search_criteria/variance_report/variance_report.py
@@ -0,0 +1,503 @@
+# Add columns
+# -----------
+row_list = [['ID','Data','150px','']]
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+if not filter_values.get('fiscal_year'):
+  msgprint("Please Select Fiscal Year")
+  raise Exception
+elif not filter_values.get('period'):
+  msgprint("Please Select Period")
+  raise Exception
+elif not filter_values.get('based_on'):
+  msgprint("Please Select the Criteria on which you want your report to be based")
+  raise Exception
+elif not filter_values.get('group_by') and filter_values.get('item_group'):
+  msgprint("Item Group cannot be selected if Group By is not Item Group")
+  raise Exception
+
+fiscal_year = filter_values.get('fiscal_year')
+period = filter_values.get('period')
+based_on = filter_values.get('based_on')
+group_by = filter_values.get('group_by')
+item_group = filter_values.get('item_group')
+msgprint(item_group)
+company = filter_values.get('company')
+under = filter_values.get('under')
+
+#if filter_values.get('item_group'):
+#  itm_grp = filter_values.get('item_group')
+  
+if based_on == 'Territory':
+  based = 'territory'
+elif based_on == 'Sales Person':
+  based = 'sales_person'
+elif based_on == 'Sales Partner':
+  based = 'sales_partner'
+
+
+if under == 'Receivable Voucher':
+  under_detail = 'RV'
+  dt = 'voucher_date'
+else:
+  under_detail = under
+  dt = "transaction_date"
+  
+# get fiscal year start date and start month
+year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
+start_date = year_start_date and year_start_date[0][0] or ''
+start_month = year_start_date and year_start_date[0][1] or ''
+month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+
+# Add columns based on period
+# --------------------------------
+columns = []
+if group_by == 'Item Group':
+  columns.append(['Item Group','Data','120px',''])
+# ================ Annual ======================
+if period == 'Annual':
+  columns.append(['Target','Currency','120px',''])
+  columns.append(['Actual','Currency','120px',''])
+
+# =========== Half Yearly ======================
+elif period == 'Half Yearly':
+  columns.append(['Target (H1)','Currency','120px','']) # first half
+  columns.append(['Actual (H1)','Currency','120px','']) # first half
+  columns.append(['Target (H2)','Currency','120px',''])
+  columns.append(['Actual (H2)','Currency','120px','']) 
+  
+# ================ Quarterly ===================
+elif period == 'Quarterly':
+  length_1 = (len(month_name) - start_month + 1) / 3  #this gives the total no. of times we need to iterate for quarter
+  val = length_1 % 4
+  q_no = 1
+  for i in range(length_1):
+    value = 3*i + val
+    columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
+    columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
+    q_no += 1
+  length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
+  for i in range(length_2):
+    columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
+    columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
+    q_no += 1;
+
+# =============== Monthly ======================
+elif period == 'Monthly':
+  for i in range(start_month-1,len(month_name)):
+    columns.append(['Target ('+month_name[i]+')','Currency','120px',''])
+    columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
+
+  for i  in range(start_month-1):
+    columns.append(['Target('+month_name[i]+')','Currency','120px',''])
+    columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+
+out = []
+if company:
+  condition = ' fiscal_year = "'+fiscal_year+'" and company = "'+company+'"'
+else:
+  condition = ' fiscal_year = "'+fiscal_year+'"'
+
+#=================== function for fetching  allocated percentage in Distribution id according to period=============
+def get_budget_distribution(period,dist_id,fiscal_year):
+  query = ''
+  id1 = 1
+  if period == 'Half Yearly':
+    id2 = 6
+    for i in range(2):
+      query += 'SUM(CASE WHEN t2.idx BETWEEN '+str(id1)+' AND '+str(id2)+' THEN t2.percentage_allocation ELSE NULL END)'
+      id1 += 6
+      id2 += 6
+      if i < 1 :
+        query += ','
+
+  elif period == 'Quarterly':
+    id2 = 3
+    for i in range(4):
+      query += 'SUM(CASE WHEN t2.idx BETWEEN '+str(id1)+' AND '+str(id2)+' THEN t2.percentage_allocation ELSE NULL END)'
+      id1 += 3
+      id2 += 3
+      if i < 3 :
+        query += ','
+    
+  elif period == 'Monthly':
+    for i in range(12):
+      query += 'SUM(CASE WHEN t2.idx ='+str(id1)+' THEN t2.percentage_allocation ELSE NULL END)'
+      id1 += 1
+      if i < 11 :
+        query += ','
+    
+#  msgprint(query) 
+   
+  # Main Query
+  dist = sql("select %s from `tabBudget Distribution` t1, `tabBudget Distribution Detail` t2 where t1.name = '%s' and t2.parent = t1.name and t1.fiscal_year = '%s'"%(query,dist_id,fiscal_year))
+  dist = dist and dist[0] or 0
+#  msgprint(dist)
+  bug = []
+  for i in dist:
+    i = i and float(i) or 0
+    bug.append(i)
+#  msgprint(bug)
+  return bug
+
+
+#============ function for appending target amt and actual amt in a proper order ======================= 
+def appending_func(ran,tl,lst,actual,flt):
+
+  c = 2
+  for i in range(ran):
+    #==== for each itemgroup their actual amt is appended/inserted between target amt  
+    if tl == 0:
+      lst.insert(c,actual and flt(actual[0][i]) or 0)
+    #======== here actual amt is appended/inserted b/w target amt for a particular territory/sales person/sales partner only if target is not zero 
+    elif tl == 1:
+#      msgprint(lst)
+      lst.insert(c,actual and flt(actual[0][i]) or 0)
+    c += 2
+  return lst
+
+def get_target(tar_det,group_by,period,fiscal_year,rng,r,get_budget_distribution,flt):
+
+  grp,lst = [],[]
+  list_range,tl = 0,0
+  if group_by == 'Item Group':
+    for i in tar_det:
+      if i[0] != '':
+        igrp = [i[0]]
+        if i[2]:
+          dist_id = i[2]
+          dist = get_budget_distribution(period,dist_id,fiscal_year)
+          for d in dist:
+            t = flt(flt(flt(i[1]) * flt(d))/ 100)
+            igrp.append(t)            
+        else:
+          t = i and flt(i[1]/rng) or 0
+          for i in range(rng):
+            igrp.append(t)
+            
+        grp.append(igrp)
+        list_range +=1
+    lst = [1,grp,list_range]
+    
+    #============== Total target(on basis of whole target ) ============
+  else:
+    for i in tar_det:
+      if i[0] == '':
+        if i[2]:
+          dist_id = i[2]
+          dist = get_budget_distribution(period,dist_id,fiscal_year)
+          for d in dist:
+            t = flt((flt(i[1]) * flt(d))/ 100)
+            r.append(t)
+        else:
+          tot_target = i and flt(i[1]/rng) or 0
+          for i in range(rng):
+            r.append(tot_target)
+        tl = 1
+    lst = [0,r,tl]
+  return lst
+#============ report display function =====================
+for r in res:
+  query = ''
+  grp=[]
+  list_range, count, ap, tot_target, tl = 0,0,0,0,0
+    
+  #============= ANNUAL REPORT ===================
+  if period == 'Annual':
+    tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year))
+#    msgprint(tar_det)
+
+    #================ Target based on individual item group ==============
+    if group_by == 'Item Group':
+      for i in tar_det:
+        if i[0] != '':
+          grp_target = i and flt(i[1]) or 0
+          igrp = [i[0],grp_target]
+          grp.append(igrp)
+#          msgprint(grp)
+          list_range +=1
+          count = 3
+
+    #============== Total target(will be displayed only if target is specified by the user) ============
+    else:
+      for i in tar_det:
+        # ======= here target is considered and not sum of target of item groups
+        if i[0] == '':
+          tot_target = tar_det and flt(i[1]) or 0
+#          msgprint(tot_target)
+    
+   #================== Actual Amount =============================================
+    if based_on == 'Territory' or based_on == 'Sales Partner':
+
+      if group_by =='Item Group':
+
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select sum(t2.amount) from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(under,under_detail,based,r[col_idx['ID']],item_group,condition))
+          msgprint(actual)
+          actual = actual and flt(actual[0][0]) or 0
+          i.append(actual)
+          
+      else:
+        actual = sql("select sum(net_total) from `tab%s` where %s = '%s' and docstatus = 1 and  %s" % (under, based, r[col_idx['ID']],condition))
+        actual = actual and flt(actual[0][0]) or 0
+        
+    elif based_on == 'Sales Person':
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select sum(t2.amount) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and  %s"%(under,under_detail,based,r[col_idx['ID']],item_group,condition))
+          actual = actual and flt(actual[0][0]) or 0
+#          msgprint(actual)
+          i.append(actual)
+
+      else:
+        actual = sql("select sum(t1.net_total) from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(under,based,r[col_idx['ID']],under,condition))
+        actual = actual and flt(actual[0][0]) or 0
+#        msgprint(actual)
+
+  # ================= Half Yearly Report =============== 
+  elif period == 'Half Yearly':
+    tl = 0
+    grp_target = []
+
+    tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year)) 
+#    msgprint(tar_det)
+    
+    tar = get_target(tar_det,group_by,period,fiscal_year,2,r,get_budget_distribution,flt)
+    if tar[0] == 1:
+      grp = tar[1]
+      list_range = tar[2]
+      count = 5
+    else:
+      r = tar[1]
+      tl = tar[2]
+      
+    #============= Actual Amount======================
+    if group_by == 'Item Group':
+      # first half
+      query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t2.amount ELSE NULL END),'
+      # second half
+      query += 'SUM(CASE WHEN MONTH(t1.'+dt+') NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t2.amount ELSE NULL END)';
+
+    elif based_on != 'Sales Person':
+      # first half
+      query += 'SUM(CASE WHEN MONTH('+dt+') BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
+      # second half
+      query += 'SUM(CASE WHEN MONTH('+dt+') NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END)';
+
+    else:
+      # first half
+      query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t1.net_total ELSE NULL END),'
+      # second half
+      query += 'SUM(CASE WHEN MONTH(t1.'+dt+') NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t1.net_total ELSE NULL END)';
+
+    #=========== Main Query ===============
+    if based_on == 'Territory' or based_on == 'Sales Partner':
+
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
+#          msgprint(actual)        
+          i = appending_func(2,tl,i,actual,flt)
+                    
+      else:
+        actual = sql("select %s from `tab%s` where %s = '%s' and docstatus = 1 and  %s" % (query,under, based, r[col_idx['ID']],condition))
+#        msgprint(actual)
+
+    elif based_on == 'Sales Person':
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
+#          msgprint(actual)
+          i = appending_func(2,tl,i,actual,flt)
+      else:
+        actual = sql("select %s from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(query,under,based,r[col_idx['ID']],under,condition))
+#        msgprint(actual)
+
+    if tl == 1:
+      r = appending_func(2,tl,r,actual,flt)
+#      msgprint(r)
+
+  #============== Quarterly Report =========================
+  elif period == 'Quarterly':
+    tl = 0
+    grp_target = []
+    tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year)) 
+
+    tar = get_target(tar_det,group_by,period,fiscal_year,4,r,get_budget_distribution,flt)
+    if tar[0] == 1:
+      grp = tar[1]
+      list_range = tar[2]
+      count = 9
+    else:
+      r = tar[1]
+      tl = tar[2]
+      
+    #======= Actual Amt ==================
+    length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
+    val = length_1 % 4;
+    for i in range(length_1):
+      value = 3*i + val;
+
+      if group_by == 'Item Group':
+        query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN t2.amount ELSE NULL END),'
+
+      elif based_on != 'Sales Person':
+        query += 'SUM(CASE WHEN MONTH('+dt+') BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
+
+      else:
+        query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN t1.net_total ELSE NULL END),'
+
+    length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
+    for i in range(length_2):
+      if group_by == 'Item Group':
+        query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN t2.amount ELSE NULL END)';
+
+      elif based_on != 'Sales Person':
+        query += 'SUM(CASE WHEN MONTH('+dt+') BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END)';
+
+      else:
+        query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN t1.net_total ELSE NULL END)';
+
+    #=========== Main Query ===============
+    if based_on == 'Territory' or based_on == 'Sales Partner':
+
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
+#          msgprint(actual)
+          #================common function          
+          i = appending_func(4,tl,i,actual,flt)
+          
+      else:
+        actual = sql("select %s from `tab%s` where %s = '%s' and docstatus = 1 and  %s" % (query,under, based, r[col_idx['ID']],condition))
+#        msgprint(actual)
+        
+    elif based_on == 'Sales Person':
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
+#          msgprint(actual)
+          i = appending_func(4,tl,i,actual,flt)
+      else:
+        actual = sql("select %s from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(query,under,based,r[col_idx['ID']],under,condition))
+#        msgprint(actual)
+
+    if tl == 1:
+      r = appending_func(4,tl,r,actual,flt)
+#      msgprint(r)
+
+  #================ Monthly Report ===========================
+  elif period == 'Monthly':
+    tl = 0
+    grp_target = []
+    tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year)) 
+
+    tar = get_target(tar_det,group_by,period,fiscal_year,12,r,get_budget_distribution,flt)
+    if tar[0] == 1:
+      grp = tar[1]
+      list_range = tar[2]
+      count = 25
+    else:
+      r = tar[1]
+      tl = tar[2]
+      
+    #======= Actual Amt ==================
+    # for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
+    for i in range(start_month-1,len(month_name)):
+      if group_by == 'Item Group':
+        query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
+
+      elif based_on != 'Sales Person':
+        query += 'SUM(CASE WHEN MONTH('+dt+') = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
+
+      else:
+        query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t1.net_total ELSE NULL END),'
+
+    for i  in range(start_month-1):
+      if i != (start_month-1):
+        if group_by == 'Item Group':
+          query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END)'
+
+        elif based_on != 'Sales Person':
+          query += 'SUM(CASE WHEN MONTH('+dt+') = '+cstr(i+1)+' THEN net_total ELSE NULL END)'
+
+        else:
+          query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t1.net_total ELSE NULL END)'
+
+        if i < (start_month -2):
+          query += ','
+
+    #=========== Main Query ===============
+    if based_on == 'Territory' or based_on == 'Sales Partner':
+
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
+#          msgprint(actual)
+          #===============common function=====================         
+          i = appending_func(12,tl,i,actual,flt)
+          
+      else:
+        actual = sql("select %s from `tab%s` where %s = '%s' and docstatus = 1 and  %s" % (query,under, based, r[col_idx['ID']],condition))
+#        msgprint(actual)
+        
+    elif based_on == 'Sales Person':
+      if group_by =='Item Group':
+        for i in grp:
+          item_group = i[0]
+          actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
+#          msgprint(actual)
+          i = appending_func(12,tl,i,actual,flt)
+      else:
+        actual = sql("select %s from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(query,under,based,r[col_idx['ID']],under,condition))
+#        msgprint(actual)
+
+    if tl == 1:
+      r = appending_func(12,tl,r,actual,flt)
+#      msgprint(r)
+
+#-------------DISPLAY OF TARGET vs ACTUAL ON BASIS OF TOTAL TARGET / ITEM GROUP 
+
+  if group_by == 'Item Group':
+    for col in range(len(colnames)-1): # this would make all first row blank. just for look
+      r.append('')
+
+    for des in range(list_range):
+      if ap == 0:
+        out.append(r)
+        ap = 1
+      t_row = ['' for i in range(len(colnames))]
+
+      for v in range(count):
+        t_row[col_idx[colnames[v+1]]] = grp[des][v]
+#        msgprint(t_row)
+      out.append(t_row)
+
+  elif tot_target != 0 and period =='Annual':
+    r.append(tot_target)
+    r.append(actual)
+    out.append(r)
+    tot_target = 0
+
+  elif tl == 1:
+    out.append(r)
\ No newline at end of file
diff --git a/crm/search_criteria/variance_report/variance_report.sql b/crm/search_criteria/variance_report/variance_report.sql
new file mode 100644
index 0000000..89becb7
--- /dev/null
+++ b/crm/search_criteria/variance_report/variance_report.sql
@@ -0,0 +1 @@
+SELECT DISTINCT t1.`name` FROM `tab%(based_on)s` t1, `tabTarget Detail` t2 WHERE t2.parent = t1.name  and (t2.target_amount != 0 or t2.target_amount is not null)
\ No newline at end of file
diff --git a/crm/search_criteria/variance_report/variance_report.txt b/crm/search_criteria/variance_report/variance_report.txt
new file mode 100644
index 0000000..5ca7ea6
--- /dev/null
+++ b/crm/search_criteria/variance_report/variance_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Variance Report',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Target Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Territory\x01State':'','Target Detail\x01Fiscal Year':'2009-2010','Target Detail\x01Based On':'Territory','Target Detail\x01Company':'Alpha Company','Target Detail\x01Period':'Quarterly','Target Detail\x01Under':'Sales Order'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-05 11:13:12',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'variance_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Territory',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_handlers.py b/event_handlers.py
new file mode 100644
index 0000000..2bd8fae
--- /dev/null
+++ b/event_handlers.py
@@ -0,0 +1,83 @@
+import webnotes
+from webnotes.utils import cint
+
+#
+# alias the current user
+#
+def on_login(login_manager):
+
+	# login as
+	if login_manager.user == 'Administrator':
+		user = webnotes.form.getvalue('login_as')
+	   
+		if user:
+			# create if missing (due to some bug)
+			login_as(user, login_manager)
+
+			# alisaing here... so check if the user is disabled
+			if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]:
+				# throw execption
+				raise Exception, "Authentication Failed"
+			
+			login_manager.user = user
+
+#
+# update account details
+#
+def update_account_details():
+	# additional details (if from gateway)
+	if webnotes.form_dict.get('is_trial'):
+		webnotes.conn.set_global('is_trial', cint(webnotes.form_dict.get('is_trial')))
+
+	if webnotes.form_dict.get('days_to_expiry'):
+		webnotes.conn.set_global('days_to_expiry', webnotes.form_dict.get('days_to_expiry'))
+
+	if webnotes.form_dict.get('first_name'):
+		from server_tools.server_tools.gateway_utils import update_user_details
+		update_user_details()
+		
+#
+# save (login from)
+#
+def on_login_post_session(login_manager):
+	# login from
+	if webnotes.form_dict.get('login_from'):
+		webnotes.session['data']['login_from'] = webnotes.form.getvalue('login_from')
+
+	update_account_details()
+
+#
+# logout the user from SSO
+#
+def on_logout(login_manager):
+	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
+		from server_tools.server_tools.gateway_utils import logout_sso
+		logout_sso()
+
+#
+# create a profile (if logs in for the first time)
+#
+def login_as(user, login_manager):
+	import os
+	import webnotes
+	webnotes.session = {'user': user}
+	ip = os.environ.get('REMOTE_ADDR')
+
+	# validate if user is from SSO
+	if ip == '72.55.168.105' or 1:
+		# if user does not exist, create it
+		if not webnotes.conn.sql("select name from tabProfile where name=%s", user):
+			from webnotes.model.doc import Document
+			
+			import webnotes
+			import webnotes.utils.webservice    
+
+			p = Document('Profile')
+			p.first_name = webnotes.form_dict.get('first_name')
+			p.last_name = webnotes.form_dict.get('last_name')
+			p.email = user
+			p.name = user
+			p.enabled = 1
+			p.owner = user
+			p.save(1)
+			
\ No newline at end of file
diff --git a/event_updates/Module Def/Event Updates/Event Updates.txt b/event_updates/Module Def/Event Updates/Event Updates.txt
new file mode 100644
index 0000000..3bc62f0
--- /dev/null
+++ b/event_updates/Module Def/Event Updates/Event Updates.txt
@@ -0,0 +1,330 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:40:49',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2010-09-25 15:53:18',
+		'modified_by': 'Administrator',
+		'module_desc': '<p>This module contains</p>\n<ul>\n<li>Feeds</li>\n<li>To Do List</li>\n<li>Events</li>\n</ul>',
+		'module_icon': 'star_full.png',
+		'module_label': 'Home',
+		'module_name': 'Event Updates',
+		'module_page': 'Event Updates',
+		'module_seq': 0,
+		'name': 'Event Updates',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:40:49',
+		'description': None,
+		'display_name': 'Comment Widget Record',
+		'doc_name': 'Comment Widget Record',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDI00108',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:40:49',
+		'description': None,
+		'display_name': 'Feed',
+		'doc_name': 'Feed',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDI00109',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:40:49',
+		'description': None,
+		'display_name': 'Home',
+		'doc_name': 'Home',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDI00111',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00014',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00015',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts User'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00016',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00017',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'HR User'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 5,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00018',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'HR Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 6,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00019',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material User'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 7,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00020',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 8,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00021',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 9,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00022',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase User'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 10,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00023',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 11,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00024',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 12,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00025',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Production User'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 13,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00026',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Production Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 14,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00027',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'System Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 15,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00028',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales User'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 16,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00029',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:40:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 17,
+		'modified': '2010-11-30 22:40:49',
+		'modified_by': 'Administrator',
+		'name': 'MDR00030',
+		'owner': 'Administrator',
+		'parent': 'Event Updates',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Manager'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/__init__.py b/event_updates/__init__.py
new file mode 100644
index 0000000..d1f79c7
--- /dev/null
+++ b/event_updates/__init__.py
@@ -0,0 +1,52 @@
+import webnotes
+
+feed_dict = {
+	# Project
+	'Ticket':			['[%(status)s] %(subject)s', '#000080'],
+
+	# Sales
+	'Lead':				['%(lead_name)s', '#000080'],
+	'Quotation':		['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
+	'Sales Order':		['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
+
+	# Purchase
+	'Supplier':			['%(supplier_name)s, %(supplier_type)s', '#6495ED'],
+	'Purchase Order':	['[%(status)s] %(name)s To %(supplier_name)s for %(currency)s  %(grand_total_import)s', '#4169E1'],
+
+	# Stock
+	'Delivery Note':	['[%(status)s] To %(customer_name)s', '#4169E1'],
+
+	# Accounts
+	'Journal Voucher':	['[%(voucher_type)s] %(name)s', '#4169E1'],
+	'Payable Voucher':	['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
+	'Receivable Voucher':['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
+
+	# HR
+	'Expense Voucher':	['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
+	'Salary Slip':		['%(employee_name)s for %(month)s %(fiscal_year)s', '#4169E1'],
+	'Leave Transaction':['%(leave_type)s for %(employee)s', '#4169E1'],
+
+	# Support
+	'Customer Issue':	['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
+	'Maintenance Visit':['To %(customer_name)s', '#4169E1'],
+	'Support Ticket':	['[%(status)s] %(subject)s', '#000080']
+}
+
+def make_feed(doc, subject, color):
+	"makes a new Feed record"
+	from webnotes.model.doc import Document
+	webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
+	f = Document('Feed')
+	f.doc_type = doc.doctype
+	f.doc_name = doc.name
+	f.subject = subject
+	f.color = color
+	f.save(1)
+	
+def update_feed(doc):	
+	"adds a new feed"
+	subject, color = feed_dict.get(doc.doctype, [None, None])
+	if subject:
+		subject = subject % doc.fields
+		make_feed(doc, subject, color)
+	
diff --git a/event_updates/doctype/__init__.py b/event_updates/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/doctype/__init__.py
diff --git a/event_updates/doctype/feed/__init__.py b/event_updates/doctype/feed/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/doctype/feed/__init__.py
diff --git a/event_updates/doctype/feed/feed.py b/event_updates/doctype/feed/feed.py
new file mode 100644
index 0000000..dca0c35
--- /dev/null
+++ b/event_updates/doctype/feed/feed.py
@@ -0,0 +1,22 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/event_updates/doctype/feed/feed.txt b/event_updates/doctype/feed/feed.txt
new file mode 100644
index 0000000..33a47d0
--- /dev/null
+++ b/event_updates/doctype/feed/feed.txt
@@ -0,0 +1,196 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': '_FEED.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 11:04:25',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-05 09:16:57',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'Feed',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'doc_type',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Doc Type',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000400',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Feed',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'doc_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Doc Name',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000401',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Feed',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'subject',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Subject',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000402',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Feed',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'color',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Color',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000403',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Feed',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/event_updates/doctype/home_control/__init__.py b/event_updates/doctype/home_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/doctype/home_control/__init__.py
diff --git a/event_updates/doctype/home_control/home_control.js b/event_updates/doctype/home_control/home_control.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/doctype/home_control/home_control.js
diff --git a/event_updates/doctype/home_control/home_control.py b/event_updates/doctype/home_control/home_control.py
new file mode 100644
index 0000000..213a35d
--- /dev/null
+++ b/event_updates/doctype/home_control/home_control.py
@@ -0,0 +1,387 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes import session, msgprint, errprint
+
+sql = webnotes.conn.sql
+convert_to_lists = webnotes.conn.convert_to_lists
+
+try: import json
+except: import simplejson as json
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d,dl
+
+# --------------------------------------------------------------------------------------------------------
+# ------------------------------------- Home page module details -----------------------------------------
+	
+	def delete_cache(self):
+		sql("delete from __DocTypeCache")
+		com = sql("select abbr, name from tabCompany")
+		for d in com:
+			sql("update `tabCompany` set receivables_group = '%s' where (receivables_group = '%s' or receivables_group = '' or receivables_group is null) and name = '%s'" % ('Accounts Receivable - '+cstr(d[0]), 'Accounts Receivables - '+cstr(d[0]), d[1]))
+			sql("update `tabCompany` set payables_group = '%s' where (payables_group = '%s' or payables_group = '' or payables_group is null) and name = '%s'" % ('Accounts Payable - '+cstr(d[0]), 'Accounts Payables - '+cstr(d[0]), d[1]))
+
+	def get_modules(self):
+		rl = webnotes.user.get_roles()
+		ml = sql("select distinct t1.name, t1.module_icon, t1.module_label, t1.module_desc, t1.module_page from  `tabModule Def` t1, `tabModule Def Role` t2 where t2.role in ('%s') and t1.disabled !='Yes' and ifnull(t1.is_hidden, 'No') != 'Yes' and t1.name = t2.parent order by t1.module_seq asc" % "','".join(rl), as_dict=1)
+		return ml
+
+	def get_login_url(self):
+		return session['data'].get('login_from', '')
+
+	def get_module_details(self,m):
+		ret = {}
+		ret['il'] = sql('select doc_type, doc_name, display_name, icon, description, fields, click_function, idx from `tabModule Def Item` where parent=%s and ifnull(`hide`,0)=0 order by idx asc', m, as_dict=1)
+		ret['wl'] = sql('select widget_code from `tabModule Def` where name =%s', m)[0][0] or ''
+		ret['custom_reports'] = sql('''
+			SELECT DISTINCT t1.criteria_name AS `display_name`, t1.description, t1.doc_type AS `doc_name`, 'Custom Reports' AS `doc_type` 
+			FROM `tabSearch Criteria` t1, `tabDocPerm` t2 
+			WHERE t1.module = "%s" 
+			AND IFNULL(t1.disabled,0) = 0 
+			AND (t1.doc_type=t2.parent OR t1.parent_doc_type = t2.parent) 
+			AND t2.permlevel = 0 
+			AND t2.read=1 
+			AND t2.role IN ("%s") 
+			AND ifnull(standard,"No")="No"''' % (m, '", "'.join(webnotes.user.get_roles())), as_dict=1)
+		return ret
+
+	# ----------------------------------------------------------------------------------------------------------------
+	# ----------------------------------------------- Home page updates ----------------------------------------------
+	
+	def get_events_list(self):
+		import webnotes, webnotes.utils
+		from webnotes.widgets.event import get_cal_events
+		
+		dl = get_cal_events(nowdate(), add_days(nowdate(), 7))
+		el = []
+		for d in dl:
+			#el.append([d.name, d.event_date, d.event_hour, d.event_name, d.description or '', d.ref_type or '', d.ref_name or '', d.owner])
+			dict = {
+				'name': d.name,
+				'event_date': d.event_date,
+				'event_hour': d.event_hour,
+				'event_name': d.event_name,
+				'description': d.description,
+				'notes': d.notes,
+				'event_type': d.event_type,
+				'ref_type': d.ref_type,
+				'ref_name': d.ref_name,
+				'owner' : d.owner
+			}
+			
+			el.append(dict)
+		return el
+
+		
+	def get_activity_list(self):
+		out = {}
+		import webnotes
+		rt = webnotes.user.can_read
+    
+		dt_list = [d[0] for d in sql("select distinct t2.name from tabDocField t1, tabDocType t2 where t1.fieldname='status' and t1.docstatus=0 and (t2.istable is null or t2.istable = 0) and t1.parent = t2.name")]
+		if not dt_list:
+			return out
+
+		# get list of activity dt
+		for dt in dt_list:
+			if dt in rt:
+				out[dt] = {}
+				# get status list
+				sl = sql("select distinct status from `tab%s`" % dt)
+			
+				for s in sl:
+					if s[0]:
+						# get count
+						cnt = sql("select count(*) from `tab%s` where status = '%s' and modified > '%s'" % (dt, s[0], add_days(nowdate(), -7)))[0][0]
+						out[dt][s[0]] = cint(cnt)
+		return out
+		
+	def send_feedback(self, args):
+		args = json.loads(args)
+		
+		fb_sender = sql("select concat_ws(' ',first_name, last_name), email from tabProfile where name=%s", session['user'])
+		fb_subject = 'Feedback : ' + args['subject']
+
+
+		fb_msg = '''
+			<div style="font-size:14px; padding:8px; border:1px solid #DDF">
+			<div style="margin-bottom:16px">%s wrote,</div>
+			<div>%s</div>
+			</div>
+		''' % (fb_sender[0][0], args['feedback'])
+		
+		sendmail('info@webnotestech.com', fb_sender[0][1], msg = fb_msg, subject=args['subject'],parts=[], cc=[], attach=[])
+
+	def get_dt_help(self,dt):
+		return sql("select description from tabDocType where name=%s",dt)[0][0] or ''
+		
+	# ----------------------------------------------------------------------------------------
+	def welcome_done(self):
+		if cint(get_defaults().get('welcome_done')):
+			return 'Yes'
+		else:
+			return 'No'
+
+	def set_welcome_done(self):
+		set_default('welcome_done', '1')
+
+	# Check Complete Registration
+	# ----------------------
+	def registration_complete(self):
+		if cint(get_defaults().get('registration_complete')):
+			return 'Yes'
+		else:
+			return 'No'
+
+	# get dashboard counts
+	# --------------------
+	def get_wip_counts(self):
+		#dtl = ['Lead', 'Enquiries', 'Sales Order', 'Invoices', 'Indent', 'Purchase Order', 'Bills', 'Tasks', 'Delivery Note', 'Maintenance']
+		can_read_dt = ['Lead', 'Enquiry', 'Sales Order', 'Receivable Voucher', 'Indent', 'Purchase Order', 'Payable Voucher', 'Delivery Note', 'Task', 'Serial No']
+		dt = {}
+		for d in can_read_dt:
+			args = {}
+			
+			# if Lead
+			if d=='Lead':
+				args = {'To follow up':sql("select count(name) from tabLead where status!='Converted' and status!='Lead Lost' and status!='Not Interested'")}
+
+			# if Enquiry
+			elif d=='Enquiry':
+				args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no!=t2.name and t2.docstatus=1")
+				args['To follow up'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no=t2.name and t2.docstatus=1 and t1.docstatus=1")
+
+			# if Sales Order
+			elif d=='Sales Order':
+				args['To be delivered'] = sql("select count(name) from `tabSales Order` where ifnull(per_delivered,0)<100 and delivery_date>now() and docstatus=1")
+				args['To be billed'] = sql("select count(name) from `tabSales Order` where ifnull(per_billed,0)<100 and docstatus=1")
+				args['Overdue'] = sql("select count(name) from `tabSales Order` where ifnull(per_delivered,0)<100 and delivery_date<now() and docstatus=1")
+				args['To be submitted'] = sql("select count(name) from `tabSales Order` where docstatus=0 and status='Draft'")      #Draft
+
+			# if Receivable Voucher
+			elif d=='Receivable Voucher':
+				args['To receive payment'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date>now() and outstanding_amount!=0")
+				args['Overdue'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date<now() and outstanding_amount!=0")  
+				args['To be submitted'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=0")       #Draft
+
+			# if Indent 
+			elif d=='Indent':
+				args['Purchase Order to be made'] = sql("select count(name) from `tabIndent` where ifnull(per_ordered,0)<100 and docstatus=1")
+				args['To be submitted'] = sql("select count(name) from `tabIndent` where status='Draft'")      #Draft
+
+			# if Purchase Order    
+			elif d=='Purchase Order':
+				args['To receive items'] = sql("select count(name) from `tabPurchase Order` where ifnull(per_received,0)<100 and docstatus=1")
+				args['To be billed'] = sql("select count(name) from `tabPurchase Order` where ifnull(per_billed,0)<100 and docstatus=1")
+				args['To be submitted'] = sql("select count(name) from `tabPurchase Order` where status='Draft'")        #Draft
+
+			# if Payable Voucher
+			elif d=='Payable Voucher':
+				args['To be paid'] = sql("select count(name) from `tabPayable Voucher` where docstatus=1 and outstanding_amount!=0")
+				args['To be submitted'] = sql("select count(name) from `tabPayable Voucher` where docstatus=0")       #Draft
+
+			# if Delivery Note
+			elif d=='Delivery Note':
+				args['To be submitted'] = sql("select count(name) from `tabDelivery Note` where status='Draft' and docstatus=0")
+				args['To be billed'] = sql("select count(name) from `tabDelivery Note` where docstatus=1 and docstatus=1 and ifnull(per_billed,0)<100")
+			
+			# if Tasks
+			elif d=='Task':
+				args = {'Open': sql("select count(name) from `tabTicket` where status='Open'")}
+
+			# if Serial No
+			elif d=='Serial No':
+				args['AMC expiring this month'] = sql("select count(name) from `tabSerial No` where docstatus!=2 and maintenance_status = 'Under AMC' and status!='Scrapped' and status!='Not in Use' and month(now()) = month(amc_expiry_date) and year(now()) = year(amc_expiry_date)")
+				args['Warranty expiring this month'] = sql("select count(name) from `tabSerial No` where docstatus!=2 and maintenance_status = 'Under Warranty' and status!='Scrapped' and status!='Not in Use' and month(now()) = month(ifnull(warranty_expiry_date,0)) and year(now())=year(ifnull(warranty_expiry_date,0))")
+			
+			for a in args:
+				args[a] = args[a] and args[a][0][0] or 0
+			
+			dt[d] = args
+		return dt
+
+	# -------------------------------------------------------------------------------------------------------
+	
+	def get_todo_count(self):
+		count = sql("select count(distinct name) from `tabToDo Item` where owner=%s", session['user'])
+		count = count and count[0][0] or 0
+		return count
+		
+	def get_todo_list(self):
+		return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo Item` where owner=%s order by field(priority,'High','Medium','Low') asc, date asc", session['user']))
+		
+	def add_todo_item(self,args):
+		args = json.loads(args)
+
+		d = Document('ToDo Item', args.get('name') or None)
+		d.description = args['description']
+		d.date = args['date']
+		d.priority = args['priority']
+		d.checked = args.get('checked', 0)
+		d.owner = session['user']
+		d.save(not args.get('name') and 1 or 0)
+
+		return d.name
+
+	def remove_todo_item(self,nm):
+		sql("delete from `tabToDo Item` where name = %s",nm)
+
+	# -------------------------------------------------------------------------------------------------------
+
+	def get_status_details(self, arg=''):
+		# no of users online
+		count = sql("select count(distinct user) from tabSessions t2 where user not in ('Guest','Administrator') and TIMESTAMPDIFF(HOUR,t2.lastupdate,NOW()) <= 1")
+
+		# unread messages
+		unread = sql("select count(t1.name) from `tabMail` t1, `tabMail Participant Details` t2 where t2.participant_name = '%s' and t2.parent = t1.name and (t2.read_status = 'No' or t2.read_status is NULL) and (t2.delete_status = 'No' or t2.delete_status is NULL) and t1.last_updated_by != t2.participant_name" % arg)
+		
+		# system messages
+		msg_id = webnotes.conn.get_global('system_message_id')
+		msg = ''
+				
+		if msg_id and msg_id != webnotes.conn.get_global('system_message_id', session['user']):
+			msg = webnotes.conn.get_global('system_message')
+		
+		return {'user_count': count and cint(count[0][0]) or 0, 'unread': unread and cint(unread[0][0]) or 0, 'system_message':msg}
+				
+	# -------------------------------------------------------------------------------------------------------
+
+	def dismiss_message(self, arg=''):
+		msg_id = webnotes.conn.get_global('system_message_id')
+		webnotes.conn.set_global('system_message_id', msg_id, session['user'])
+		
+	# -------------------------------------------------------------------------------------------------------
+
+	def get_todo_reminder(self):
+		return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo Item` where owner=%s and date=%s and checked=1 order by priority, date", (session['user'], nowdate())))
+		
+	# get user details
+	def get_users(self):
+		ret = {}
+		ret['usr'] = convert_to_lists(sql("select distinct name, concat_ws(' ', first_name, last_name), ifnull(messanger_status,'Available') from tabProfile where name=%s", session['user']))
+		ret['on'] = convert_to_lists(sql("select distinct t1.name, concat_ws(' ', t1.first_name, t1.last_name), ifnull(t1.messanger_status,'Available') from tabProfile t1, tabSessions t2 where t1.name = t2.user and t1.name not in('Guest',%s) and TIMESTAMPDIFF(HOUR,t2.lastupdate,NOW()) <= 1", session['user']))
+		ret['off'] = convert_to_lists(sql("select distinct t1.name, concat_ws(' ', t1.first_name, t1.last_name), ifnull(t1.messanger_status,'Offline') from tabProfile t1, tabSessions t2 where t1.name != t2.user and t1.name not in('Guest',%s) and t1.name not in(select distinct t1.name from tabProfile t1, tabSessions t2 where t1.name = t2.user and t1.name not in('Guest',%s) and (t1.messanger_status !='Invisible' or t1.messanger_status is null) and TIMESTAMPDIFF(HOUR,t2.lastupdate,NOW()) <= 1)", (session['user'], session['user'])))
+
+		return ret
+		
+	# Delete event
+	def delete_event(self,id):
+		sql("delete from tabEvent where name=%s", id)
+		
+	# edit event
+	def edit_event(self,arg):
+		arg = json.loads(arg)
+		d = Document('Event', arg.get('name') or None)
+		for k in arg:
+			d.fields[k] = str(arg[k])
+		d.save(not arg.get('name') and 1 or 0)
+	
+	# -------------------------------------------------------------------------------------------------------
+	# module settings
+	# -------------------------------------------------------------------------------------------------------
+	def get_module_order(self):
+		show_list = ['Event Updates','My Company','Setup','Accounts','CRM','SRM','Maintenance','Material Management','Payroll','Projects','Analysis','Production']
+		ml = filter(lambda x: x[0] in show_list, \
+			sql("select name, module_label, module_seq, is_hidden from `tabModule Def` where docstatus<2 order by module_seq asc, module_label asc"))
+		return convert_to_lists(ml)
+			
+	def set_module_order(self,arg):
+		arg = eval(arg)
+		for k in arg:
+			sql("update `tabModule Def` set module_seq = %s, is_hidden = %s where name = %s", (cint(arg[k]['module_seq']) + 1, arg[k]['is_hidden'], k))
+
+	# -------------------------------------------------------------------------------------------------------
+
+	def get_bd_list(self):
+		bl = convert_to_lists(sql("select name,concat_ws(' ',first_name,last_name),birth_date from tabProfile where (birth_date is not null and birth_date != '') and (enabled is not null and enabled !='')"))
+
+		nd = nowdate().split('-')
+		d = cint(nd[2])
+		m = cint(nd[1])
+
+		tb = []
+		for b in bl:
+			if b[2] and b[2].find('-') != -1:
+				if cint(b[2].split('-')[2]) == d and cint(b[2].split('-')[1]) == m:
+					tb.append(b)
+
+		return tb
+
+	# obtain account id for webforms
+	def get_acc_id(self):
+		acc_id = sql("select value from `tabSingles` where field='account_id' and doctype='Control Panel'")
+		acc_id = acc_id and acc_id[0][0] or ''
+		if acc_id:
+			return cstr(acc_id)
+		else:
+			msgprint("Account Id not specified")
+			raise Exception
+  
+	#update serial no status
+	def update_serial_status(self, lst, status):
+		lst11=[]
+		for y1 in lst:
+			sql("update `tabSerial No` set maintenance_status = %s where name=%s", (status,y1))
+			lst11.append(y1)
+			msgprint("Status updated as '"+status+"' for "+cstr(lst11))
+
+	# chk to set serial no status as 'Out of warranty'
+	def set_for_out_of_warranty(self):
+		chk_for_out_of_wrnty = sql("select name from `tabSerial No` where ifnull(warranty_expiry_date, '2200-12-12') < CURDATE() and ifnull(warranty_expiry_date, '0000-00-00') != '0000-00-00' and ifnull(amc_expiry_date, '0000-00-00') ='0000-00-00' and ifnull(maintenance_status, '') != 'Out of Warranty'")
+		if chk_for_out_of_wrnty:
+			lst1 = [x1[0] for x1 in chk_for_out_of_wrnty]
+			self.update_serial_status(lst1, 'Out Of Warranty')
+        
+	# chk to set serial no status as 'Out of amc'
+	def set_for_out_of_amc(self):
+		chk_for_out_of_amc = sql("select name from `tabSerial No` where ifnull(warranty_expiry_date, '0000-00-00')< CURDATE() and ifnull(amc_expiry_date, '2200-12-12') < CURDATE() and ifnull(amc_expiry_date, '0000-00-00') !='0000-00-00' and ifnull(maintenance_status, '') !='Out of AMC'")
+		if chk_for_out_of_amc:
+			lst2 = [x2[0] for x2 in chk_for_out_of_amc]
+			self.update_serial_status(lst2, 'Out Of AMC')
+         
+	# chk to set serial no status as 'under amc'
+	def set_for_under_amc(self):
+		chk_for_under_amc = sql("select name from `tabSerial No` where ifnull(warranty_expiry_date, '0000-00-00')< CURDATE() and ifnull(amc_expiry_date, '2200-12-12') >= CURDATE() and ifnull(amc_expiry_date, '0000-00-00') !='0000-00-00' and ifnull(maintenance_status, '') !='Under AMC'")
+		if chk_for_under_amc:
+			lst3 = [x3[0] for x3 in chk_for_under_amc]
+			self.update_serial_status(lst3, 'Under AMC')
+
+	# chk to set serial no status as 'under warranty'
+	def set_for_under_warranty(self):
+		chk_for_under_wrnty = sql("select name from `tabSerial No` where ifnull(warranty_expiry_date, '2200-12-12') >= CURDATE() and ifnull(warranty_expiry_date, '0000-00-00') != '0000-00-00' and ifnull(amc_expiry_date, '0000-00-00') ='0000-00-00' and ifnull(maintenance_status, '') != 'Under Warranty'")
+		if chk_for_under_wrnty:
+			lst4 = [x4[0] for x4 in chk_for_under_wrnty]
+			self.update_serial_status(lst4, 'Under Warranty')
+  
+	# check maintenance status for all serial nos only for 1st login each day
+	def set_serial_no_status(self):
+
+		chk_serial_no_update_date = webnotes.conn.get_global('maintenance_status_update_date')
+
+		# check status only for 1st login each day.... if maintenance date already updated means it is checked
+		if getdate(chk_serial_no_update_date) != nowdate():
+			# chk to set serial no status as 'Out of warranty'
+			self.set_for_out_of_warranty()                        
+
+			# chk to set serial no status as 'Out of amc'
+			self.set_for_out_of_amc()
+
+			# chk to set serial no status as 'under amc'
+			self.set_for_under_amc()
+
+			# chk to set serial no status as 'under warranty'
+			self.set_for_under_warranty()
+
+			#set maintenance_status_update_date
+			webnotes.conn.set_global('maintenance_status_update_date', nowdate())
+			
+	# get user fullname
+	def get_user_fullname(self,usr):	
+		return sql("select concat_ws(' ',first_name, last_name) from tabProfile where name=%s", usr)[0][0] or ''
diff --git a/event_updates/doctype/home_control/home_control.txt b/event_updates/doctype/home_control/home_control.txt
new file mode 100644
index 0000000..d23fb3d
--- /dev/null
+++ b/event_updates/doctype/home_control/home_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-09 16:32:49', 'search_fields': None, 'module': 'Event Updates', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Home Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-21 16:46:44', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/event_updates/doctype/widget_control/__init__.py b/event_updates/doctype/widget_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/doctype/widget_control/__init__.py
diff --git a/event_updates/doctype/widget_control/widget_control.py b/event_updates/doctype/widget_control/widget_control.py
new file mode 100644
index 0000000..fa41cc9
--- /dev/null
+++ b/event_updates/doctype/widget_control/widget_control.py
@@ -0,0 +1,45 @@
+import webnotes
+
+from webnotes.utils import nowdate
+from webnotes.model.doc import Document
+from webnotes.model.code import get_obj
+from webnotes import session, form, msgprint 
+
+sql = webnotes.conn.sql
+
+try: import json
+except: import simplejson as json
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+      
+  def add_comment(self,args):
+    import time
+    args = eval(args)
+    if(args['comment']):
+      cmt = Document('Comment Widget Record')
+      for arg in args:
+        cmt.fields[arg] = args[arg]
+      cmt.comment_date = nowdate()
+      cmt.comment_time = time.strftime('%H:%M')
+      cmt.save(1)
+      
+      try:
+        get_obj('Feed Control').upate_comment_in_feed(args['comment_doctype'], args['comment_docname'])
+      except:
+        pass
+	      
+    else:
+      raise Exception
+        
+  def remove_comment(self, args):
+    args = json.loads(args)
+    sql("delete from `tabComment Widget Record` where name=%s",args['id'])
+
+    try:
+      get_obj('Feed Control').upate_comment_in_feed(args['dt'], args['dn'])
+    except: pass
diff --git a/event_updates/doctype/widget_control/widget_control.txt b/event_updates/doctype/widget_control/widget_control.txt
new file mode 100644
index 0000000..184eb24
--- /dev/null
+++ b/event_updates/doctype/widget_control/widget_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 13:06:24', 'search_fields': None, 'module': 'Event Updates', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 27, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Widget Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/event_updates/page/__init__.py b/event_updates/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/page/__init__.py
diff --git a/event_updates/page/event_updates/__init__.py b/event_updates/page/event_updates/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/page/event_updates/__init__.py
diff --git a/event_updates/page/event_updates/event_updates.comp.js b/event_updates/page/event_updates/event_updates.comp.js
new file mode 100644
index 0000000..3af8868
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates.comp.js
@@ -0,0 +1,111 @@
+
+pscript['onload_Event Updates']=function(){if(user=='Guest'){loadpage('Login Page');return;}
+pscript.home_make_body();pscript.home_make_status();pscript.home_pre_process();pscript.home_make_widgets();}
+pscript.home_make_body=function(){var wrapper=page_body.pages['Event Updates'];wrapper.main_tab=make_table(wrapper,1,2,'100%',['70%','30%']);$y(wrapper.main_tab,{tableLayout:'fixed'});wrapper.body=$a($td(wrapper.main_tab,0,0),'div','layout_wrapper');wrapper.head=$a(wrapper.body,'div');wrapper.banner_area=$a(wrapper.head,'div');wrapper.toolbar_area=$a(wrapper.head,'div');wrapper.system_message_area=$a(wrapper.body,'div','',{marginBottom:'16px',padding:'8px',backgroundColor:'#FFD',border:'1px dashed #AA6',display:'none'})}
+pscript.home_pre_process=function(wrapper){var wrapper=page_body.pages['Event Updates'];var cp=locals['Control Panel']['Control Panel'];if(cp.client_name){var banner=$a(wrapper.banner_area,'div','',{paddingBottom:'4px'})
+banner.innerHTML=cp.client_name;}
+if(in_list(user_roles,'System Manager')){pscript.complete_registration();}}
+pscript.home_make_widgets=function(){var wrapper=page_body.pages['Event Updates'];var cell=$td(wrapper.main_tab,0,1);sidebar=new wn.widgets.PageSidebar(cell,{sections:[{title:'Calendar',display:function(){return!has_common(user_roles,['Guest','Customer','Vendor'])},render:function(wrapper){new HomeCalendar(new HomeWidget(wrapper,'Calendar','Event'),wrapper);}},{title:'To Do',display:function(){return!has_common(user_roles,['Guest','Customer','Vendor'])},render:function(wrapper){new HomeToDo(new HomeWidget(wrapper,'To Do','Item'));}},{title:'Online Users',display:function(){return!has_common(user_roles,['Guest','Customer','Vendor'])},render:function(wrapper){pscript.online_users_obj=new OnlineUsers(wrapper);}}]})
+sidebar.refresh()
+new FeedList(wrapper.body);}
+OnlineUsers=function(wrapper){var me=this;this.wrapper=wrapper;this.my_company_link=function(){$a($a(wrapper,'div','',{marginBottom:'7px'}),'span','link_type',{color:'#777','color:hover':'#FFF',fontSize:'11px'},'See all users',function(){loadpage('My Company');});}
+this.render=function(online_users){me.my_company_link();if(online_users.length){var max=online_users.length;max=(max>10?10:max)
+for(var i=0;i<max;i++){new OneOnlineUser(me.wrapper,online_users[i]);}}else{$a(wrapper,'div','',{'color':'#888'},'No user online!')}}}
+OneOnlineUser=function(wrapper,det){var name=cstr(det[1])+' '+cstr(det[2]);if(det[1]==user)name='You'
+var div=$a(wrapper,'div','',{padding:'3px 0px'});$a(div,'div','',{width:'7px',height:'7px',cssFloat:'left',margin:'5px',backgroundColor:'green'});$a(div,'div','',{marginLeft:'3px'},name);}
+HomeWidget=function(parent,heading,item){var me=this;this.item=item;this.wrapper=$a(parent,'div');this.body=$a(this.wrapper,'div','',{paddingBottom:'16px'});this.footer=$a(this.wrapper,'div');this.add_btn=$btn(this.footer,'+ Add '+item,function(){me.add()});this.refresh_btn=$ln(this.footer,'Refresh',function(){me.refresh();},{fontSize:'11px',marginLeft:'7px',color:'#888'});}
+HomeWidget.prototype.refresh=function(){var me=this;$di(this.working_img);var callback=function(r,rt){$dh(me.working_img);me.body.innerHTML='';if(me.decorator.setup_body)me.decorator.setup_body();for(var i=0;i<r.message.length;i++){new HomeWidgetItem(me,r.message[i]);}
+if(!r.message.length){$a(me.body,'div','',{color:'#777'},me.no_items_message);}}
+$c_obj('Home Control',this.get_list_method,'',callback);}
+HomeWidget.prototype.make_dialog=function(){var me=this;if(!this.dialog){this.dialog=new wn.widgets.Dialog();this.dialog.make({width:480,title:'New '+this.item,fields:this.dialog_fields});this.dialog.fields_dict.save.input.onclick=function(){this.set_working();me.decorator.save(this);}}}
+HomeWidget.prototype.add=function(){this.make_dialog();this.decorator.clear_dialog();this.dialog.show();}
+HomeWidgetItem=function(widget,det){var me=this;this.det=det;this.widget=widget;this.widget=widget;this.det=det;if(widget.decorator.get_item_parent)parent=widget.decorator.get_item_parent(det);else parent=widget.body;if(!parent)return;this.wrapper=$a(parent,'div');this.tab=make_table(this.wrapper,1,3,'100%',['90%','5%','5%'],{paddingRight:'4px'});this.edit_btn=$a($td(this.tab,0,1),'div','wn-icon '+'ic-doc_edit',{cursor:'pointer'});this.edit_btn.onclick=function(){me.edit();}
+this.del_btn=$a($td(this.tab,0,2),'div','wn-icon '+'ic-trash',{cursor:'pointer'});this.del_btn.onclick=function(){me.delete_item();}
+widget.decorator.render_item(this,det);}
+HomeWidgetItem.prototype.edit=function(){this.widget.make_dialog();this.widget.decorator.set_dialog_values(this.det);this.widget.dialog.show();}
+HomeWidgetItem.prototype.delete_item=function(){var me=this;this.wrapper.innerHTML='<span style="color:#888">Deleting...</span>';var callback=function(r,rt){$(me.wrapper).slideUp();}
+$c_obj('Home Control',this.widget.delete_method,this.widget.get_item_id(this.det),callback);}
+HomeCalendar=function(widget,wrapper){$ln(widget.footer,'Full Calendar',function(){loadpage('_calendar');},{marginLeft:'7px',fontSize:'11px',color:'#888'})
+this.widget=widget;this.widget.get_list_method='get_events_list'
+this.widget.delete_method='delete_event';this.widget.no_items_message='You have no events in the next 7 days';this.widget.get_item_id=function(det){return det.name;}
+this.widget.decorator=this;var hl=[];for(var i=0;i<24;i++){hl.push(((i+8)%24)+':00');}
+this.widget.dialog_fields=[{fieldtype:'Date',fieldname:'event_date',label:'Event Date',reqd:1},{fieldtype:'Time',fieldname:'event_hour',label:'Event Time',reqd:1},{fieldtype:'Text',fieldname:'description',label:'Description',reqd:1},{fieldtype:'Button',fieldname:'save',label:'Save'}];this.widget.refresh();}
+HomeCalendar.prototype.setup_body=function(){var w=this.widget;w.date_blocks={};for(var i=0;i<7;i++){var dt=dateutil.obj_to_str(dateutil.add_days(new Date(),i));var div=$a(w.body,'div','',{padding:'4px 0px',borderBottom:'1px solid #AAA',display:'none'});div.head=$a(div,'div','',{fontWeight:'bold',paddingBottom:'4px'});div.head.innerHTML=(i==0?'Today':(i==1?'Tomorrow':dateutil.str_to_user(dt)))
+w.date_blocks[dt]=div;}}
+HomeCalendar.prototype.get_item_parent=function(det){var d=this.widget.date_blocks[det.event_date];$ds(d);return d;}
+HomeCalendar.prototype.render_item=function(item,det){var tab=make_table($td(item.tab,0,0),1,2,'100%',['48px',null],{padding:'2px',lineHeight:'1.5em'});$y(tab,{tableLayout:'fixed'});$td(tab,0,0).innerHTML='<span style="color:#888">'+det.event_hour+':</span> ';$a($td(tab,0,1),'span','social',{},replace_newlines(det.description));if(det.ref_type&&det.ref_name&&det.ref_name!='None'){var span=$a($a($td(tab,0,1),'div'),'span','link_type');span.innerHTML=det.ref_name;span.dt=det.ref_type;span.onclick=function(){loaddoc(this.dt,this.innerHTML);}}}
+HomeCalendar.prototype.clear_dialog=function(){this.set_dialog_values({event_date:get_today(),event_hour:'8:00',description:''});}
+HomeCalendar.prototype.set_dialog_values=function(det){var d=this.widget.dialog;d.set_values(det);d.det=det;}
+HomeCalendar.prototype.save=function(btn){var d=this.widget.dialog;var me=this;var det=d.get_values();if(!det){btn.done_working();return;}
+det.name=d.det.name;det.owner=user;if(!det.event_type)
+det.event_type='Private';var callback=function(r,rt){btn.done_working();me.widget.dialog.hide();me.widget.refresh();}
+$c_obj('Home Control','edit_event',JSON.stringify(det),callback);}
+HomeToDo=function(widget){this.widget=widget;this.widget.get_list_method='get_todo_list';this.widget.delete_method='remove_todo_item';this.widget.no_items_message='Nothing to do?';this.widget.get_item_id=function(det){return det[0];}
+this.widget.decorator=this;this.widget.dialog_fields=[{fieldtype:'Date',fieldname:'date',label:'Event Date',reqd:1},{fieldtype:'Text',fieldname:'description',label:'Description',reqd:1},{fieldtype:'Check',fieldname:'checked',label:'Completed'},{fieldtype:'Select',fieldname:'priority',label:'Priority',reqd:1,'options':['Medium','High','Low'].join('\n')},{fieldtype:'Button',fieldname:'save',label:'Save'}];this.widget.refresh();}
+HomeToDo.prototype.render_item=function(item,det){var tab=make_table($td(item.tab,0,0),1,2,'100%',['48px',null],{padding:'2px'});$y(tab,{tableLayout:'fixed'});var span=$a($td(tab,0,0),'span','',{padding:'2px',color:'#FFF',fontSize:'10px',backgroundColor:(det[3]=='Low'?'#888':(det[3]=='High'?'#EDA857':'#687FD3'))});$(span).css('-moz-border-radius','3px').css('-webkit-border-radius','3px');span.innerHTML=det[3];var span=$a($td(tab,0,1),'span','social',{lineHeight:'1.5em'},replace_newlines(det[1]));if(det[4])$y(span,{textDecoration:'line-through'});if(!det[4]&&dateutil.str_to_obj(det[2])<new Date()){$y(span,{color:'RED'});$a($td(tab,0,1),'div','',{fontSize:'10px',color:'#666'},dateutil.str_to_user(det[2])+' (Overdue)');}else{$a($td(tab,0,1),'div','',{fontSize:'10px',color:'#666'},dateutil.str_to_user(det[2]));}}
+HomeToDo.prototype.clear_dialog=function(){this.set_dialog_values(['','',get_today(),'Medium',0]);}
+HomeToDo.prototype.set_dialog_values=function(det){var d=this.widget.dialog;d.set_values({date:det[2],priority:det[3],description:det[1],checked:det[4]});d.det=det;}
+HomeToDo.prototype.save=function(btn){var d=this.widget.dialog;var me=this;var det=d.get_values()
+if(!det){btn.done_working();return;}
+det.name=d.det?d.det[0]:'';var callback=function(r,rt){btn.done_working();me.widget.dialog.hide();me.widget.refresh();}
+$c_obj('Home Control','add_todo_item',JSON.stringify(det),callback);}
+FeedList=function(parent){this.auto_feed_off=cint(sys_defaults.auto_feed_off);this.wrapper=$a(parent,'div');this.make_head();this.make_list();this.list.run();}
+FeedList.prototype.make_head=function(){var me=this;this.head=$a(this.wrapper,'div','',{marginBottom:'8px'});$a(this.head,'h1','',{display:'inline'},'Home');$a(this.head,'span','link_type',{marginLeft:'7px'},'[?]',function(){msgprint('<b>What appears here?</b> This is where you get updates of everything you are allowed to access and generates an update')})
+$a(this.head,'span','link_type',{cursor:'pointer',marginLeft:'7px',fontSize:'11px'},'refresh',function(){me.run();});}
+FeedList.prototype.run=function(){this.prev_date=null;this.list.run();}
+FeedList.prototype.make_list=function(){this.list_area=$a(this.wrapper,'div')
+this.no_result=$a(this.wrapper,'div','help_box',{display:'none'},'Nothing to show yet. Your feed will be updated as you start your activities')
+var l=new Listing('Feed List',1);var me=this;l.colwidths=['100%'];l.page_len=20;l.opts.cell_style={padding:'0px'};l.opts.hide_rec_label=1;l.get_query=function(){this.query=repl('select \
+   distinct t1.name, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
+   concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")), t1.modified, t1.color \
+   from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \
+   where t1.doc_type = t4.parent \
+   and t2.name = t1.owner \
+   and t3.parent = "%(user)s" \
+   and t4.role = t3.role \
+   and ifnull(t4.`read`,0) = 1 \
+   order by t1.modified desc',{user:user})
+this.query_max=''}
+l.show_cell=function(cell,ri,ci,d){me.render_feed(cell,ri,ci,d);}
+l.onrun=function(){$(me.wrapper).fadeIn();if(me.after_run)me.after_run();}
+l.make(this.list_area);$dh(l.btn_area);this.list=l;}
+FeedList.prototype.after_run=function(){this.list.has_data()?$dh(this.no_result):$ds(this.no_result)}
+FeedList.prototype.render_feed=function(cell,ri,ci,d){new FeedItem(cell,d[ri],this);}
+FeedItem=function(cell,det,feedlist){var me=this;this.det=det;this.feedlist=feedlist;this.wrapper=$a(cell,'div','',{paddingBottom:'4px'});this.head=$a(this.wrapper,'div');this.tab=make_table(this.wrapper,1,2,'100%',[(100/7)+'%',(600/7)+'%']);$y(this.tab,{tableLayout:'fixed'})
+$y($td(this.tab,0,0),{textAlign:'right',paddingRight:'4px'});this.text_area=$a($td(this.tab,0,1),'div');this.render_references(this.text_area,det);this.render_tag(det);this.add_day_sep(det);}
+FeedItem.prototype.add_day_sep=function(det){var me=this;var prev_date=det[6].split(' ')[0];var make_div=function(){var div=$a(me.head,'div','',{borderBottom:'1px solid #888',margin:'8px 0px',padding:'2px 0px',color:'#888',fontSize:'11px'});div.innerHTML=comment_when(det[6],1);if(prev_date==get_today()){div.innerHTML='';span=$a(div,'span','',{padding:'2px',color:'#000',fontWeight:'bold'});span.innerHTML='Today';}}
+if(this.feedlist.prev_date&&this.feedlist.prev_date!=prev_date){make_div();}
+if(!this.feedlist.prev_date){make_div();}
+this.feedlist.prev_date=prev_date;}
+FeedItem.prototype.render_tag=function(det){tag=$a($td(this.tab,0,0),'div','',{color:'#FFF',padding:'3px',textAlign:'right',fontSize:'11px',whiteSpace:'nowrap',overflow:'hidden',cursor:'pointer'});$br(tag,'3px');$y(tag,{backgroundColor:(det[7]?det[7]:'#273')});tag.innerHTML=get_doctype_label(det[1]);tag.dt=det[1]
+tag.onclick=function(){loaddocbrowser(this.dt);}}
+FeedItem.prototype.render_references=function(div,det){div.tab=make_table(div,1,2,'100%',[null,'15%'])
+var dt=det[1];var dn=det[2]
+var allow=in_list(profile.can_read,dt);var span=$a($td(div.tab,0,0),'span',(allow?'link_type':''),null,det[2]);span.dt=dt;span.dn=dn;if(allow)span.onclick=function(){loaddoc(this.dt,this.dn);}
+if(det[3]){$a($td(div.tab,0,0),'span','',{marginLeft:'7px',color:'#444'},det[3]);}
+$y($td(div.tab,0,1),{fontSize:'11px'}).innerHTML=(strip(det[5])?det[5]:det[4]);}
+HomeStatusBar=function(){var me=this;var parent=page_body.pages['Event Updates'];this.wrapper=$a($td(parent.main_tab,0,1),'div','home-status',{},'Loading...');$br(this.wrapper,'3px');this.render=function(r){this.wrapper.innerHTML='';this.span=$a(this.wrapper,'span','home-status-link')
+this.span.onclick=function(){loadpage('My Company')}
+if(r.unread_messages){this.span.innerHTML='<span class="home-status-unread">'+r.unread_messages+'</span> unread message'+(cint(r.unread_messages)>1?'s':'');}else{this.span.innerHTML='No unread messages.';}}}
+pscript.home_make_status=function(){var home_status_bar=new HomeStatusBar()
+var wrapper=page_body.pages['Event Updates'];$c_page('event_updates','event_updates','get_status_details',user,function(r,rt){home_status_bar.render(r.message);if(r.message.system_message)
+pscript.show_system_message(wrapper,r.message.system_message);if(pscript.is_erpnext_saas&&cint(r.message.is_trial)&&in_list(user_roles,'System Manager')){pscript.trial_box=$a(div,'div','help_box',{margin:'2px 8px 2px 0px'},"Your Free Trial expires in "+
+r.message.days_to_expiry+" days. When you are satisfied, please <span class='link_type' onclick='pscript.convert_to_paid()'>please click here</span> to convert to a paid account."+"<br>To get help, view <a href='http://erpnext.blogspot.com/2011/02/getting-started-with-your-erpnext.html' target='_blank'>Getting Started with Your System</a> (opens in a new page)");}
+pscript.online_users_obj.render(r.message.online_users);pscript.online_users=r.message.online_users;});}
+pscript.convert_to_paid=function(){var callback=function(r,rt){if(r.exc){msgprint(r.exc);return;}
+$(pscript.trial_box).slideUp();}
+$c_page('event_updates','event_updates','convert_to_paid','',callback)}
+pscript.show_system_message=function(wrapper,msg){$ds(wrapper.system_message_area);var txt=$a(wrapper.system_message_area,'div','',{lineHeight:'1.6em'});txt.innerHTML=msg;var span=$ln($a(wrapper.system_message_area,'div'),'Dismiss',function(me){me.set_working();$c_obj('Home Control','dismiss_message','',function(r,rt){me.done_working();$(wrapper.system_message_area).slideUp();});},{fontSize:'11px'})}
+pscript.complete_registration=function()
+{var reg_callback=function(r,rt){if(r.message=='No'){var d=new Dialog(400,200,"Please Complete Your Registration");if(user!='Administrator'){d.no_cancel();$dh(page_body.wntoolbar.wrapper);}
+$($a(d.body,'div','',{margin:'8px',color:'#888'})).html('<b>Company Name : </b>'+locals['Control Panel']['Control Panel'].company_name);d.make_body([['Data','Company Abbreviation'],['Select','Fiscal Year Start Date'],['Select','Default Currency'],['Button','Save'],]);pscript.make_dialog_field(d);d.widgets['Save'].onclick=function()
+{d.widgets['Save'].set_working();flag=pscript.validate_fields(d);if(flag)
+{var args=[locals['Control Panel']['Control Panel'].company_name,d.widgets['Company Abbreviation'].value,d.widgets['Fiscal Year Start Date'].value,d.widgets['Default Currency'].value];$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r,rt){sys_defaults=r.message;d.hide();$ds(page_body.wntoolbar.wrapper);});}}
+d.show();}}
+$c_obj('Home Control','registration_complete','',reg_callback);}
+pscript.make_dialog_field=function(d)
+{fisc_format=d.widgets['Fiscal Year Start Date'];add_sel_options(fisc_format,['','1st Jan','1st Apr','1st Jul','1st Oct']);currency_list=['','AED','AFN','ALL','AMD','ANG','AOA','ARS','AUD','AZN','BAM','BBD','BDT','BGN','BHD','BIF','BMD','BND','BOB','BRL','BSD','BTN','BYR','BZD','CAD','CDF','CFA','CFP','CHF','CLP','CNY','COP','CRC','CUC','CZK','DJF','DKK','DOP','DZD','EEK','EGP','ERN','ETB','EUR','EURO','FJD','FKP','FMG','GBP','GEL','GHS','GIP','GMD','GNF','GQE','GTQ','GYD','HKD','HNL','HRK','HTG','HUF','IDR','ILS','INR','IQD','IRR','ISK','JMD','JOD','JPY','KES','KGS','KHR','KMF','KPW','KRW','KWD','KYD','KZT','LAK','LBP','LKR','LRD','LSL','LTL','LVL','LYD','MAD','MDL','MGA','MKD','MMK','MNT','MOP','MRO','MUR','MVR','MWK','MXN','MYR','MZM','NAD','NGN','NIO','NOK','NPR','NRs','NZD','OMR','PAB','PEN','PGK','PHP','PKR','PLN','PYG','QAR','RMB','RON','RSD','RUB','RWF','SAR','SCR','SDG','SDR','SEK','SGD','SHP','SOS','SRD','STD','SYP','SZL','THB','TJS','TMT','TND','TRY','TTD','TWD','TZS','UAE','UAH','UGX','USD','USh','UYU','UZS','VEB','VND','VUV','WST','XAF','XCD','XDR','XOF','XPF','YEN','YER','YTL','ZAR','ZMK','ZWR'];currency=d.widgets['Default Currency'];add_sel_options(currency,currency_list);}
+pscript.validate_fields=function(d)
+{var lst=['Company Abbreviation','Fiscal Year Start Date','Default Currency'];var msg='Please enter the following fields';var flag=1;for(var i=0;i<lst.length;i++)
+{if(!d.widgets[lst[i]].value){flag=0;msg=msg+NEWLINE+lst[i];}}
+if(!flag)alert(msg);return flag;}
\ No newline at end of file
diff --git a/event_updates/page/event_updates/event_updates.css b/event_updates/page/event_updates/event_updates.css
new file mode 100644
index 0000000..ed50351
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates.css
@@ -0,0 +1,17 @@
+div.home-status {
+	margin: 7px;
+	padding: 5px;
+	color: #666;
+}
+
+span.home-status-link {
+	cursor: pointer;
+	text-decoration: underline;
+}
+
+span.home-status-unread {
+	padding: 2px 3px;
+	font-size: 11px;
+	color: #FFF;
+	background-color: RED;
+}
\ No newline at end of file
diff --git a/event_updates/page/event_updates/event_updates.html b/event_updates/page/event_updates/event_updates.html
new file mode 100644
index 0000000..41ae9a5
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates.html
@@ -0,0 +1 @@
+<div id="updates_div"></div>
\ No newline at end of file
diff --git a/event_updates/page/event_updates/event_updates.js b/event_updates/page/event_updates/event_updates.js
new file mode 100644
index 0000000..7a401de
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates.js
@@ -0,0 +1,748 @@
+pscript['onload_Event Updates'] = function() {
+	if(user=='Guest') {
+		loadpage('Login Page');
+		return;
+	}
+			
+	pscript.home_make_body();
+	pscript.home_make_status();
+	pscript.home_pre_process();
+	pscript.home_make_widgets();
+}
+
+// ==================================
+
+pscript.home_make_body = function() {
+	var wrapper = page_body.pages['Event Updates'];
+	
+	// body
+	wrapper.main_tab = make_table(wrapper,1,2,'100%',['70%','30%']);
+	$y(wrapper.main_tab, {tableLayout:'fixed'});
+
+	wrapper.body = $a($td(wrapper.main_tab, 0, 0), 'div', 'layout_wrapper');
+
+	wrapper.head = $a(wrapper.body, 'div');
+	
+	wrapper.banner_area = $a(wrapper.head, 'div');
+	wrapper.toolbar_area = $a(wrapper.head, 'div');
+
+
+	wrapper.system_message_area = $a(wrapper.body, 'div', '', 
+		{marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'})
+	
+	
+}
+
+// ==================================
+
+pscript.home_pre_process = function(wrapper) {
+	var wrapper = page_body.pages['Event Updates'];
+	var cp = locals['Control Panel']['Control Panel'];
+
+	// banner
+	if(cp.client_name) {
+		var banner = $a(wrapper.banner_area, 'div', '', {paddingBottom:'4px'})
+		banner.innerHTML = cp.client_name;
+	}
+
+	// complete registration
+	if(in_list(user_roles,'System Manager')) { pscript.complete_registration(); }	
+}
+
+// Widgets
+// ==================================
+
+pscript.home_make_widgets = function() {
+	var wrapper = page_body.pages['Event Updates'];
+	var cell = $td(wrapper.main_tab, 0, 1);
+
+	// sidebar
+	sidebar = new wn.widgets.PageSidebar(cell, {
+		sections:[
+			{
+				title: 'Calendar',
+				display: function() { return !has_common(user_roles, ['Guest','Customer','Vendor'])},
+				render: function(wrapper) {
+					new HomeCalendar(new HomeWidget(wrapper, 'Calendar', 'Event'), wrapper);
+				}		
+			},
+			
+			{
+				title: 'To Do',
+				display: function() { return !has_common(user_roles, ['Guest','Customer','Vendor'])},
+				render: function(wrapper) {
+					new HomeToDo(new HomeWidget(wrapper, 'To Do', 'Item'));
+				}		
+			},
+
+			{
+				title: 'Online Users',
+				display: function() { return !has_common(user_roles, ['Guest','Customer','Vendor'])},
+				render: function(wrapper) {
+					pscript.online_users_obj = new OnlineUsers(wrapper);
+				}		
+			}
+		]
+	})
+	sidebar.refresh()
+
+	/*$y(cell,{padding:'0px 8px'});
+
+	new HomeCalendar(new HomeWidget(cell, 'Calendar', 'Event'));
+	
+	
+	new HomeToDo(new HomeWidget(cell, 'To Do', 'Item'));*/
+	
+	new FeedList(wrapper.body);
+}
+
+OnlineUsers = function(wrapper) {
+	var me = this;
+	this.wrapper = wrapper;
+	
+	this.my_company_link = function() {
+		$a($a(wrapper, 'div', '', {marginBottom:'7px'}), 'span', 'link_type', 
+			{color:'#777', 'color:hover':'#FFF', fontSize:'11px'}, 
+			'See all users', function() {loadpage('My Company'); });
+	}
+	
+	this.render = function(online_users) {
+		me.my_company_link();
+		
+		if(online_users.length) {
+			var max = online_users.length; max = (max > 10 ? 10 : max)
+			for(var i=0; i<max; i++) {
+				new OneOnlineUser(me.wrapper, online_users[i]);
+			}
+		} else {
+			$a(wrapper, 'div', '', {'color':'#888'}, 'No user online!')
+		}
+	}
+}
+
+OneOnlineUser = function(wrapper, det) {
+	var name = cstr(det[1]) + ' ' + cstr(det[2]);
+	if(det[1]==user) name = 'You'
+	var div = $a(wrapper, 'div', '', {padding:'3px 0px'});
+	$a(div, 'div', '', {width:'7px', height:'7px', cssFloat:'left', margin:'5px', backgroundColor:'green'});
+	$a(div, 'div', '', {marginLeft:'3px'}, name);
+}
+
+HomeWidget = function(parent, heading, item) {
+	var me = this; this.item = item;
+	
+	this.wrapper = $a(parent, 'div');
+	
+	
+	// body
+	this.body = $a(this.wrapper,'div','',{paddingBottom:'16px'});
+	this.footer = $a(this.wrapper,'div');
+	
+	// add button
+	this.add_btn = $btn(this.footer,'+ Add ' + item,function(){me.add()});
+
+	// refresh
+	this.refresh_btn = $ln(this.footer,'Refresh',function() { me.refresh(); },{fontSize:'11px',marginLeft:'7px',color:'#888'});
+}
+
+HomeWidget.prototype.refresh = function() {
+	var me = this;
+	$di(this.working_img);
+		
+	var callback = function(r,rt) {
+		$dh(me.working_img);
+		me.body.innerHTML = '';
+
+		// prepare (for calendar?)
+		if(me.decorator.setup_body) me.decorator.setup_body();
+
+		for(var i=0;i<r.message.length;i++) {
+			new HomeWidgetItem(me, r.message[i]);
+		}
+		if(!r.message.length) {
+			$a(me.body,'div','',{color:'#777'}, me.no_items_message);
+		}
+	}
+	$c_obj('Home Control',this.get_list_method,'',callback);
+}
+
+HomeWidget.prototype.make_dialog = function() {
+	var me = this;
+	if(!this.dialog) {
+		this.dialog = new wn.widgets.Dialog();
+		this.dialog.make({
+			width: 480,
+			title: 'New ' + this.item, 
+			fields:this.dialog_fields
+		});
+		
+		this.dialog.fields_dict.save.input.onclick = function() {
+			this.set_working();
+			me.decorator.save(this);	
+		}
+	}
+}
+
+HomeWidget.prototype.add = function() {
+	this.make_dialog();
+	this.decorator.clear_dialog();
+	this.dialog.show();
+}
+
+// Item
+// --------
+
+HomeWidgetItem = function(widget, det) {
+	var me = this; this.det = det; this.widget = widget;
+	this.widget = widget; this.det = det;
+	
+	// parent
+	if(widget.decorator.get_item_parent) parent = widget.decorator.get_item_parent(det);
+	else parent = widget.body;
+	
+	if(!parent) return;
+	
+	// wrapper
+	this.wrapper = $a(parent, 'div');
+	this.tab = make_table(this.wrapper, 1, 3, '100%', ['90%', '5%', '5%'],{paddingRight:'4px'});
+
+	// buttons
+	this.edit_btn = $a($td(this.tab,0,1),'div','wn-icon ' + 'ic-doc_edit', {cursor:'pointer'});
+	this.edit_btn.onclick = function() { me.edit(); }
+
+	this.del_btn = $a($td(this.tab,0,2),'div','wn-icon ' + 'ic-trash', {cursor:'pointer'});
+	this.del_btn.onclick = function() { me.delete_item(); }
+
+	widget.decorator.render_item(this, det);
+}
+
+HomeWidgetItem.prototype.edit = function() {
+	this.widget.make_dialog();
+	this.widget.decorator.set_dialog_values(this.det);
+	this.widget.dialog.show();
+}
+
+HomeWidgetItem.prototype.delete_item = function() {
+	var me = this;
+	this.wrapper.innerHTML = '<span style="color:#888">Deleting...</span>';
+	var callback = function(r,rt) {
+		$(me.wrapper).slideUp();
+	}
+	$c_obj('Home Control',this.widget.delete_method, this.widget.get_item_id(this.det) ,callback);
+		
+}
+
+// Calendar
+// ===========================
+
+HomeCalendar = function(widget, wrapper) {
+	// calendar link
+	$ln(widget.footer,'Full Calendar',function() { loadpage('_calendar'); },{marginLeft:'7px', fontSize:'11px', color:'#888'})
+
+	this.widget = widget;
+
+	// methods
+	this.widget.get_list_method = 'get_events_list'
+	this.widget.delete_method = 'delete_event';
+	this.widget.no_items_message = 'You have no events in the next 7 days';
+	this.widget.get_item_id = function(det) { return det.name; }
+
+	this.widget.decorator = this;
+
+	var hl = [];
+	for(var i=0; i<24; i++) {
+		hl.push(((i+8) % 24) + ':00');
+	}
+
+	this.widget.dialog_fields = [
+		{fieldtype:'Date', fieldname:'event_date', label:'Event Date', reqd:1},
+		{fieldtype:'Time', fieldname:'event_hour', label:'Event Time', reqd:1},
+		{fieldtype:'Text', fieldname:'description', label:'Description', reqd:1},
+		{fieldtype:'Button', fieldname:'save', label:'Save'}
+	];
+
+	this.widget.refresh();
+}
+
+// create calendar grid
+// --------------------
+HomeCalendar.prototype.setup_body = function() {
+	var w = this.widget;
+	w.date_blocks = {};
+	for(var i=0; i<7; i++) {
+		var dt = dateutil.obj_to_str(dateutil.add_days(new Date(),i));
+		var div = $a(w.body, 'div', '', {padding:'4px 0px', borderBottom:'1px solid #AAA',display:'none'});
+		div.head = $a(div, 'div', '', {fontWeight:'bold', paddingBottom:'4px'});
+		div.head.innerHTML  = (i==0 ? 'Today' : (i==1 ? 'Tomorrow' : dateutil.str_to_user(dt)))
+		w.date_blocks[dt] = div;
+	}
+}
+
+HomeCalendar.prototype.get_item_parent = function(det) {
+	var d = this.widget.date_blocks[det.event_date]; $ds(d);
+	return d;
+}
+
+HomeCalendar.prototype.render_item = function(item, det) {	
+	var tab = make_table($td(item.tab, 0, 0), 1, 2, '100%', ['48px', null], {padding:'2px', lineHeight:'1.5em'});
+	$y(tab, {tableLayout:'fixed'});
+
+	$td(tab, 0, 0).innerHTML = '<span style="color:#888">' + det.event_hour + ':</span> ';
+	$a($td(tab, 0, 1), 'span', 'social', {}, replace_newlines(det.description));
+
+	if(det.ref_type && det.ref_name && det.ref_name != 'None') {
+		var span=$a($a($td(tab, 0, 1),'div'),'span','link_type');
+		span.innerHTML = det.ref_name; span.dt = det.ref_type;
+		span.onclick = function() { loaddoc(this.dt, this.innerHTML); }
+	}
+}
+
+HomeCalendar.prototype.clear_dialog = function() {
+	this.set_dialog_values({event_date:get_today(), event_hour:'8:00', description:''});
+}
+
+HomeCalendar.prototype.set_dialog_values = function(det) {
+	var d = this.widget.dialog;
+	d.set_values(det);
+	d.det = det;
+}
+
+HomeCalendar.prototype.save = function(btn) {
+	var d = this.widget.dialog;
+	var me = this;
+	var det = d.get_values();
+	
+	if(!det) {
+		btn.done_working();
+	 	return;
+	}
+	
+	det.name = d.det.name;
+	det.owner = user;
+	if(!det.event_type)
+		det.event_type = 'Private';
+	
+	var callback = function(r,rt) {
+		btn.done_working();
+		me.widget.dialog.hide();
+		me.widget.refresh();
+	}
+	$c_obj('Home Control','edit_event',JSON.stringify(det),callback);	
+}
+
+// Todo
+// ===========================
+
+HomeToDo = function(widget) {
+	this.widget = widget;
+
+	// methods
+	this.widget.get_list_method = 'get_todo_list';
+	this.widget.delete_method = 'remove_todo_item';
+	this.widget.no_items_message = 'Nothing to do?';
+	this.widget.get_item_id = function(det) { return det[0]; }
+
+	this.widget.decorator = this;
+
+	this.widget.dialog_fields = [
+		{fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1},
+		{fieldtype:'Text', fieldname:'description', label:'Description', reqd:1},
+		{fieldtype:'Check', fieldname:'checked', label:'Completed'},
+		{fieldtype:'Select', fieldname:'priority', label:'Priority', reqd:1, 'options':['Medium','High','Low'].join('\n')},
+		{fieldtype:'Button', fieldname:'save', label:'Save'}
+	];
+
+	this.widget.refresh();	
+}
+
+HomeToDo.prototype.render_item = function(item, det) {
+	
+	// priority tag
+	var tab = make_table($td(item.tab, 0, 0), 1, 2, '100%', ['48px', null], {padding:'2px'});
+	$y(tab, {tableLayout:'fixed'});
+
+	var span = $a($td(tab, 0, 0), 'span', '', {padding:'2px',color:'#FFF',fontSize:'10px'
+		,backgroundColor:(det[3]=='Low' ? '#888' : (det[3]=='High' ? '#EDA857' : '#687FD3'))});
+		
+	$(span).css('-moz-border-radius','3px').css('-webkit-border-radius','3px');
+	span.innerHTML = det[3];
+
+	// text
+	var span = $a($td(tab, 0, 1), 'span', 'social', {lineHeight:'1.5em'}, replace_newlines(det[1]));
+	if(det[4]) $y(span,{textDecoration:'line-through'});
+	
+	// if expired & open, then in red
+	if(!det[4] && dateutil.str_to_obj(det[2]) < new Date()) {
+		$y(span,{color:'RED'}); 
+		$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]) + ' (Overdue)');
+	} else {
+		$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]));		
+	}
+}
+
+HomeToDo.prototype.clear_dialog = function() {
+	this.set_dialog_values(['','',get_today(),'Medium',0]);
+}
+
+HomeToDo.prototype.set_dialog_values = function(det) {
+	var d = this.widget.dialog;
+	d.set_values({
+		date: det[2],
+		priority: det[3],
+		description: det[1],
+		checked: det[4]
+	});
+	d.det = det;
+}
+
+HomeToDo.prototype.save = function(btn) {
+	var d = this.widget.dialog;
+	var me = this;
+	
+	var det = d.get_values()
+	if(!det) {
+		btn.done_working();
+	 	return;	
+	}
+
+	det.name = d.det ? d.det[0] : '';
+	
+	var callback = function(r,rt) {
+		btn.done_working();
+		me.widget.dialog.hide();
+		me.widget.refresh();
+	}
+	$c_obj('Home Control','add_todo_item',JSON.stringify(det),callback);	
+}
+
+// Feed
+// ==================================
+
+
+FeedList = function(parent) {
+	// settings
+	this.auto_feed_off = cint(sys_defaults.auto_feed_off);
+	
+	this.wrapper = $a(parent, 'div');
+	this.make_head();
+	this.make_list();
+	this.list.run();
+}
+
+FeedList.prototype.make_head = function() {
+	var me = this;
+	this.head = $a(this.wrapper, 'div', '', {marginBottom:'8px'});
+	
+	// head
+
+	$a(this.head,'h1','', {display:'inline'}, 'Home'); 
+	$a(this.head,'span','link_type', {marginLeft:'7px'}, '[?]', function() {
+		msgprint('<b>What appears here?</b> This is where you get updates of everything you are allowed to access and generates an update')
+	})
+
+	// refresh
+	$a(this.head,'span','link_type', 
+		{cursor:'pointer', marginLeft:'7px', fontSize:'11px'}, 'refresh',
+		function() { me.run(); }
+	);
+}
+
+FeedList.prototype.run = function() {
+	this.prev_date = null;
+	this.list.run();
+}
+
+FeedList.prototype.make_list = function() {
+	this.list_area = $a(this.wrapper,'div')
+	this.no_result = $a(this.wrapper, 'div','help_box',{display:'none'},'Nothing to show yet. Your feed will be updated as you start your activities')
+	
+	var l = new Listing('Feed List',1);
+	var me = this;
+
+	// style
+	l.colwidths = ['100%']; l.page_len = 20;	
+	l.opts.cell_style = {padding:'0px'};
+	l.opts.hide_rec_label = 1;
+	
+	// build query
+	l.get_query = function(){
+		this.query = repl('select \
+			distinct t1.name, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
+			concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")), t1.modified, t1.color \
+			from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \
+			where t1.doc_type = t4.parent \
+			and t2.name = t1.owner \
+			and t3.parent = "%(user)s" \
+			and t4.role = t3.role \
+			and ifnull(t4.`read`,0) = 1 \
+			order by t1.modified desc', {user:user})
+		this.query_max = ''
+	}
+	
+	// render list ui
+	l.show_cell = function(cell,ri,ci,d){ me.render_feed(cell,ri,ci,d); }
+	
+	// onrun
+	l.onrun = function(){ $(me.wrapper).fadeIn(); if(me.after_run) me.after_run(); }
+	
+	// make
+	l.make(this.list_area);
+	$dh(l.btn_area);
+
+	this.list = l;
+}
+
+FeedList.prototype.after_run = function() {
+	this.list.has_data() ? $dh(this.no_result) : $ds(this.no_result)
+}
+
+FeedList.prototype.render_feed = function(cell,ri,ci,d) {
+	new FeedItem(cell, d[ri], this);
+}
+
+// Item
+// -------------------------------
+
+FeedItem = function(cell, det, feedlist) {
+	var me = this;
+	
+	this.det = det; this.feedlist = feedlist;
+	this.wrapper = $a(cell,'div','',{paddingBottom:'4px'});
+	this.head = $a(this.wrapper,'div');
+
+	this.tab = make_table(this.wrapper, 1, 2, '100%', [(100/7)+'%', (600/7)+'%']);
+	$y(this.tab,{tableLayout:'fixed'})
+
+	// image
+	$y($td(this.tab,0,0),{textAlign:'right',paddingRight:'4px'});
+	
+	// text
+	this.text_area = $a($td(this.tab,0,1), 'div');
+	this.render_references(this.text_area, det);
+	
+	this.render_tag(det);
+	
+	// add day separator
+	this.add_day_sep(det);
+}
+
+// Day separator
+// -------------------------------------------------
+
+FeedItem.prototype.add_day_sep = function(det) {
+	var me = this;
+	var prev_date = det[6].split(' ')[0];
+	
+	var make_div = function() {
+		var div = $a(me.head, 'div', '', 
+			{borderBottom:'1px solid #888', margin:'8px 0px', padding:'2px 0px', color:'#888', fontSize:'11px'});
+		div.innerHTML = comment_when(det[6], 1);
+		
+		// today?
+		if(prev_date==get_today()) {
+			div.innerHTML = '';
+			span = $a(div, 'span', '', {padding:'2px', color:'#000', fontWeight:'bold'});
+			span.innerHTML = 'Today';
+		}
+	}
+	
+	if(this.feedlist.prev_date && this.feedlist.prev_date != prev_date) { make_div(); }
+	if(!this.feedlist.prev_date) { make_div(); }
+	this.feedlist.prev_date = prev_date;
+}
+
+// Tag
+// -------------------------------------------------
+
+FeedItem.prototype.render_tag = function(det) {
+	tag = $a($td(this.tab,0,0), 'div', '', 
+		{color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px', whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'});
+	$br(tag,'3px');
+	$y(tag, {backgroundColor:(det[7] ? det[7] : '#273')});
+	tag.innerHTML = get_doctype_label(det[1]);
+	tag.dt = det[1]
+	tag.onclick = function() { loaddocbrowser(this.dt); }
+}
+
+FeedItem.prototype.render_references = function(div, det) {
+	// name
+	div.tab = make_table(div, 1, 2, '100%', [null, '15%'])
+	//div.innerHTML = '<b>' + (strip(det[11]) ? det[11] : det[2]) + ' (' + cint(det[12]) + '): </b> has ' + det[7] + ' ';
+	
+	var dt = det[1]; var dn = det[2]
+	
+	// link
+	var allow = in_list(profile.can_read, dt);
+	var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null, det[2]);
+	span.dt = dt; span.dn = dn;
+	if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); }
+	
+	// subject
+	if(det[3]) {
+		$a($td(div.tab,0,0), 'span', '', {marginLeft:'7px', color:'#444'}, det[3]);
+	}
+	
+	// by
+	$y($td(div.tab,0,1), {fontSize:'11px'}).innerHTML = (strip(det[5]) ? det[5] : det[4]);
+}
+
+HomeStatusBar = function() {
+	var me = this;
+	var parent = page_body.pages['Event Updates'];
+	this.wrapper = $a($td(parent.main_tab, 0, 1), 'div', 'home-status', {}, 'Loading...');
+	$br(this.wrapper, '3px');
+	
+	this.render = function(r) {
+		this.wrapper.innerHTML = '';
+		this.span = $a(this.wrapper, 'span', 'home-status-link')
+		this.span.onclick = function() { loadpage('My Company')	}
+		
+		if(r.unread_messages) {
+			this.span.innerHTML = '<span class="home-status-unread">' + r.unread_messages + '</span> unread message' + (cint(r.unread_messages) > 1 ? 's' : '');
+		} else {
+			this.span.innerHTML = 'No unread messages.';
+		}
+	}
+}
+
+pscript.home_make_status = function() {
+	var home_status_bar = new HomeStatusBar()
+	var wrapper = page_body.pages['Event Updates'];
+
+	// get values
+	$c_page('event_updates', 'event_updates', 'get_status_details', user,
+		function(r,rt) { 
+			
+			home_status_bar.render(r.message);
+			
+			// system_messages
+			if(r.message.system_message)
+				pscript.show_system_message(wrapper, r.message.system_message);
+				
+			// trial
+			if(pscript.is_erpnext_saas && cint(r.message.is_trial) && in_list(user_roles, 'System Manager')) {
+				pscript.trial_box = $a(div, 'div', 'help_box', {margin:'2px 8px 2px 0px'}, "Your Free Trial expires in " +
+				r.message.days_to_expiry + " days. When you are satisfied, please <span class='link_type' onclick='pscript.convert_to_paid()'>please click here</span> to convert to a paid account." + 
+				"<br>To get help, view <a href='http://erpnext.blogspot.com/2011/02/getting-started-with-your-erpnext.html' target='_blank'>Getting Started with Your System</a> (opens in a new page)");
+			}
+			
+			// render online users
+			pscript.online_users_obj.render(r.message.online_users);
+			pscript.online_users = r.message.online_users;
+		}
+	);	
+}
+
+// show system message
+// -------------------
+pscript.convert_to_paid = function() {
+	var callback = function(r,rt) {
+		if(r.exc) { msgprint(r.exc); return; }
+		$(pscript.trial_box).slideUp();
+	}
+	$c_page('event_updates','event_updates','convert_to_paid','',callback)	
+}
+
+// show system message
+// -------------------
+pscript.show_system_message = function(wrapper, msg) {
+	$ds(wrapper.system_message_area);
+	var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'});
+	txt.innerHTML = msg;
+	
+	var span = $ln($a(wrapper.system_message_area, 'div'), 'Dismiss', 
+		function(me) { 
+			me.set_working();
+			$c_obj('Home Control', 'dismiss_message', '', function(r,rt) { 
+				me.done_working(); 
+				$(wrapper.system_message_area).slideUp(); 
+			});
+		}, {fontSize:'11px'}
+	)
+}
+
+// complete my company registration
+// --------------------------------
+pscript.complete_registration = function()
+{
+	var reg_callback = function(r, rt){
+		if(r.message == 'No'){
+			var d = new Dialog(400, 200, "Please Complete Your Registration");
+			if(user != 'Administrator'){
+				d.no_cancel(); // Hide close image
+				$dh(page_body.wntoolbar.wrapper);
+			}
+			$($a(d.body,'div','', {margin:'8px', color:'#888'})).html('<b>Company Name : </b>'+locals['Control Panel']['Control Panel'].company_name);      
+
+			d.make_body(
+		  [
+		  	['Data','Company Abbreviation'],
+		  	['Select','Fiscal Year Start Date'],
+		  	['Select','Default Currency'],
+		  	['Button','Save'],
+			]);
+
+			//d.widgets['Save'].disabled = true;      // disable Save button
+			pscript.make_dialog_field(d);
+
+			// submit details
+			d.widgets['Save'].onclick = function()
+			{
+				d.widgets['Save'].set_working();
+				
+				flag = pscript.validate_fields(d);
+				if(flag)
+				{
+					var args = [
+						locals['Control Panel']['Control Panel'].company_name,
+						d.widgets['Company Abbreviation'].value,
+						d.widgets['Fiscal Year Start Date'].value,
+						d.widgets['Default Currency'].value
+					];
+					
+					$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
+						sys_defaults = r.message;
+						d.hide();
+						$ds(page_body.wntoolbar.wrapper);
+					});
+				}
+			}
+			d.show();
+		}
+	}
+	$c_obj('Home Control','registration_complete','',reg_callback);
+}
+
+// make dialog fields
+// ------------------
+pscript.make_dialog_field = function(d)
+{
+	// fiscal year format 
+	fisc_format = d.widgets['Fiscal Year Start Date'];
+	add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
+  
+	// default currency
+	currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
+	currency = d.widgets['Default Currency'];
+	add_sel_options(currency, currency_list);
+}
+
+
+// validate fields
+// ---------------
+pscript.validate_fields = function(d)
+{
+	var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
+	var msg = 'Please enter the following fields';
+	var flag = 1;
+	for(var i=0; i<lst.length; i++)
+	{
+		if(!d.widgets[lst[i]].value){
+			flag = 0;
+			msg = msg + NEWLINE + lst[i];
+		}
+	}
+
+	if(!flag)  alert(msg);
+	return flag;
+}
diff --git a/event_updates/page/event_updates/event_updates.py b/event_updates/page/event_updates/event_updates.py
new file mode 100644
index 0000000..8f5068c
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates.py
@@ -0,0 +1,56 @@
+import webnotes
+from webnotes.utils import cint
+
+def get_online_users():
+	# get users
+	return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name 
+		from tabSessions t1, tabProfile t2
+		where t1.user = t2.name
+		and t1.user not in ('Guest','Administrator')
+		and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
+
+#
+# get unread messages
+#
+def get_unread_messages():
+	"returns unread (docstatus-0 messages for a user)"
+	return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record`
+	WHERE comment_doctype='My Company'
+	AND comment_docname = %s
+	AND ifnull(docstatus,0)=0
+	""", webnotes.user.name)[0][0])
+
+#
+# Get toolbar items
+#	
+def get_status_details(arg=None):
+	from webnotes.utils import cint, date_diff, nowdate
+		
+	online = get_online_users()
+			
+	# system messages
+	msg_id = webnotes.conn.get_global('system_message_id')
+	msg = ''
+				
+	if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']):
+		msg = webnotes.conn.get_global('system_message')
+			
+	return {
+		'user_count': len(online) or 0, 
+		'unread_messages': get_unread_messages(),
+		'online_users': online or [],
+		'system_message':msg,
+		'is_trial': webnotes.conn.get_global('is_trial'),
+		'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0')
+	}
+
+#
+# Convert to a paid account
+#	
+def convert_to_paid():
+	from server_tools.server_tools.gateway_utils import convert_to_paid_gateway
+	r = convert_to_paid_gateway()
+	if r['exc']:
+		webnotes.msgprint(r['exc'])
+		raise Exception, r['exc']
+	webnotes.msgprint('Thank you for choosing to convert to a Paid Account!')	
diff --git a/event_updates/page/event_updates/event_updates.txt b/event_updates/page/event_updates/event_updates.txt
new file mode 100644
index 0000000..6cb8513
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates.txt
@@ -0,0 +1 @@
+[{'creation': '2010-07-13 12:51:53', 'module': 'Event Updates', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Event Updates', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Event Updates', 'idx': None, 'static_content': None, 'modified': '2010-11-27 14:59:10', 'parenttype': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/event_updates/page/event_updates/event_updates_static.html b/event_updates/page/event_updates/event_updates_static.html
new file mode 100644
index 0000000..682f1b2
--- /dev/null
+++ b/event_updates/page/event_updates/event_updates_static.html
@@ -0,0 +1 @@
+Event Updates
\ No newline at end of file
diff --git a/event_updates/page/profile_settings/__init__.py b/event_updates/page/profile_settings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/page/profile_settings/__init__.py
diff --git a/event_updates/page/profile_settings/profile_settings.comp.js b/event_updates/page/profile_settings/profile_settings.comp.js
new file mode 100644
index 0000000..e2c189d
--- /dev/null
+++ b/event_updates/page/profile_settings/profile_settings.comp.js
@@ -0,0 +1,19 @@
+
+pscript['onload_profile-settings']=function(){var wrapper=page_body.pages['profile-settings'];pscript.myprofile=new MyProfile(wrapper)}
+MyProfile=function(wrapper){this.wrapper=wrapper;var me=this;this.make=function(){this.head=new PageHeader(this.wrapper,'My Profile Settings');this.head.add_button('Change Password',this.change_password)
+this.tab=make_table($a(this.wrapper,'div','',{marginTop:'19px'}),1,2,'90%',['50%','50%'],{padding:'11px'})
+this.img=$a($td(this.tab,0,0),'img');set_user_img(this.img,user);$btn($a($td(this.tab,0,0),'div','',{marginTop:'11px'}),'Change Image',this.change_image)
+this.make_form();this.load_details();}
+this.load_details=function(){$c_page('event_updates','profile_settings','get_user_details','',function(r,rt){me.form.set_values(r.message);})}
+this.make_form=function(){var div=$a($td(this.tab,0,1),'div');this.form=new wn.widgets.FieldGroup()
+this.form.make_fields(div,[{fieldname:'first_name',fieldtype:'Data',label:'First Name',reqd:1},{fieldname:'last_name',fieldtype:'Data',label:'Last Name',reqd:1},{fieldname:'bio',fieldtype:'Text',label:'Bio'},{fieldname:'update',fieldtype:'Button',label:'Update'}]);this.form.fields_dict.update.input.onclick=function(){var v=me.form.get_values();if(v){this.set_working();var btn=this;$c_page('event_updates','profile_settings','set_user_details',v,function(r,rt){btn.done_working();})}}}
+this.change_password=function(){var d=new wn.widgets.Dialog({title:'Change Password',width:400,fields:[{fieldname:'old_password',fieldtype:'Password',label:'Old Password',reqd:1},{fieldname:'new_password',fieldtype:'Password',label:'New Password',reqd:1},{fieldname:'new_password1',fieldtype:'Password',label:'Re-type New Password',reqd:1},{fieldname:'change',fieldtype:'Button',label:'Change'}]})
+d.make();d.fields_dict.change.input.onclick=function(){var v=d.get_values();if(v){if(v.new_password!=v.new_password1){msgprint('Passwords must match');return;}
+this.set_working();$c_page('event_updates','profile_settings','change_password',v,function(r,rt){if(!r.message&&r.exc){msgprint(r.exc);return;}
+d.hide();})}}
+d.show();}
+this.change_image=function(){if(!me.change_dialog){var d=new Dialog(400,200,'Set Your Profile Image');d.make_body([['HTML','wrapper']]);var w=d.widgets['wrapper'];me.uploader=new Uploader(w,{thumbnail:'80px',server_obj:'Company Control',method:'update_profile_image'},pscript.user_image_upload)
+me.change_dialog=d;}
+me.change_dialog.show();}
+this.make();}
+pscript.user_image_upload=function(fid){msgprint('File Uploaded');if(fid){pscript.myprofile.change_dialog.hide();set_user_img(pscript.myprofile.img,user,null,fid);}}
\ No newline at end of file
diff --git a/event_updates/page/profile_settings/profile_settings.html b/event_updates/page/profile_settings/profile_settings.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/page/profile_settings/profile_settings.html
diff --git a/event_updates/page/profile_settings/profile_settings.js b/event_updates/page/profile_settings/profile_settings.js
new file mode 100644
index 0000000..573be41
--- /dev/null
+++ b/event_updates/page/profile_settings/profile_settings.js
@@ -0,0 +1,114 @@
+pscript['onload_profile-settings'] = function() {
+	var wrapper = page_body.pages['profile-settings'];
+	pscript.myprofile = new MyProfile(wrapper)
+}
+
+MyProfile = function(wrapper) {
+	this.wrapper = wrapper;
+	var me = this;
+	
+	this.make = function() {
+		this.head = new PageHeader(this.wrapper, 'My Profile Settings');
+		this.head.add_button('Change Password', this.change_password)
+		this.tab = make_table($a(this.wrapper, 'div', '', {marginTop:'19px'}), 
+			1, 2, '90%', ['50%', '50%'], {padding:'11px'})
+		this.img = $a($td(this.tab, 0, 0), 'img');
+		set_user_img(this.img, user);
+
+		$btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image)
+
+		this.make_form();
+		this.load_details();
+	}
+	
+	this.load_details = function() {
+		$c_page('event_updates','profile_settings','get_user_details','',function(r, rt) {
+			me.form.set_values(r.message);
+		})
+	}
+	
+	//
+	// form
+	//
+	this.make_form = function() {
+		var div = $a($td(this.tab, 0, 1), 'div');
+		this.form = new wn.widgets.FieldGroup()
+		this.form.make_fields(div, [
+			{fieldname:'first_name', fieldtype:'Data',label:'First Name',reqd:1},
+			{fieldname:'last_name', fieldtype:'Data',label:'Last Name',reqd:1},
+			{fieldname:'bio', fieldtype:'Text',label:'Bio'},
+			{fieldname:'update', fieldtype:'Button',label:'Update'}
+		]);
+		
+		this.form.fields_dict.update.input.onclick = function() {
+			var v = me.form.get_values();
+			if(v) {
+				this.set_working();
+				var btn = this;
+				$c_page('event_updates','profile_settings','set_user_details',v,function(r, rt) {
+					btn.done_working();
+				})
+			}
+		}
+	}
+	
+	//
+	// change password
+	//
+	this.change_password = function() {
+		var d = new wn.widgets.Dialog({
+			title:'Change Password',
+			width: 400,
+			fields: [
+				{fieldname:'old_password', fieldtype:'Password', label:'Old Password', reqd:1 },
+				{fieldname:'new_password', fieldtype:'Password', label:'New Password', reqd:1 },
+				{fieldname:'new_password1', fieldtype:'Password', label:'Re-type New Password', reqd:1 },
+				{fieldname:'change', fieldtype:'Button', label:'Change'}
+			]
+		})
+		d.make();
+		d.fields_dict.change.input.onclick = function() {
+			var v = d.get_values();
+			if(v) {
+				if(v.new_password != v.new_password1) {
+					msgprint('Passwords must match'); return;
+				}
+				this.set_working();
+				$c_page('event_updates','profile_settings','change_password',v,function(r,rt) {
+					if(!r.message && r.exc) { msgprint(r.exc); return; }
+					d.hide();
+				})
+			}
+		}
+		d.show();
+	}
+	
+	//
+	// change image
+	//
+	
+	this.change_image = function() {
+		if(!me.change_dialog) {
+
+			var d = new Dialog(400,200,'Set Your Profile Image');
+			d.make_body([
+				['HTML','wrapper']
+			]);	
+
+			var w = d.widgets['wrapper'];
+			me.uploader = new Uploader(w, {thumbnail:'80px', server_obj:'Company Control', method:'update_profile_image'}, pscript.user_image_upload)
+			me.change_dialog = d;
+		}
+		me.change_dialog.show();
+	}
+	this.make();
+}
+
+pscript.user_image_upload = function(fid) {
+	msgprint('File Uploaded');
+	
+	if(fid) {
+		pscript.myprofile.change_dialog.hide();
+		set_user_img(pscript.myprofile.img, user, null, fid);
+	}
+}
\ No newline at end of file
diff --git a/event_updates/page/profile_settings/profile_settings.py b/event_updates/page/profile_settings/profile_settings.py
new file mode 100644
index 0000000..3703d27
--- /dev/null
+++ b/event_updates/page/profile_settings/profile_settings.py
@@ -0,0 +1,34 @@
+import webnotes
+
+from webnotes.utils import load_json, cint, nowdate
+
+#
+# change profile (remote)
+#
+def change_password(arg):
+	arg = load_json(arg)
+	
+	if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
+		import server_tools.server_tools.gateway_utils
+		webnotes.msgprint(server_tools.server_tools.gateway_utils.change_password(arg['old_password'], arg['new_password'])['message'])
+	else:
+		if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
+			webnotes.msgprint('Old password is not correct', raise_exception=1)
+			
+		from webnotes.utils import nowdate
+		webnotes.conn.sql("update tabProfile set password=password(%s), password_last_updated=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
+		webnotes.msgprint('Password Updated');
+
+def get_user_details(arg=None):
+	"Returns user first name, last name and bio"
+	
+	return webnotes.conn.sql("select first_name, last_name, bio from tabProfile where name=%s", webnotes.user.name, as_dict=1)[0]
+	
+def set_user_details(arg=None):
+	"updates user details given in argument"
+	from webnotes.model.doc import Document
+	
+	p = Document('Profile', webnotes.user.name)
+	p.fields.update(load_json(arg))
+	p.save()
+	webnotes.msgprint('Updated')
diff --git a/event_updates/page/profile_settings/profile_settings.txt b/event_updates/page/profile_settings/profile_settings.txt
new file mode 100644
index 0000000..881cb12
--- /dev/null
+++ b/event_updates/page/profile_settings/profile_settings.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-05-09 11:04:27',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-04-13 12:08:59',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'Profile Settings',
+		'owner': 'Administrator',
+		'page_name': 'Profile Settings',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/__init__.py b/event_updates/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/__init__.py
diff --git a/event_updates/search_criteria/bills_to_be_paid/__init__.py b/event_updates/search_criteria/bills_to_be_paid/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/bills_to_be_paid/__init__.py
diff --git a/event_updates/search_criteria/bills_to_be_paid/bills_to_be_paid.txt b/event_updates/search_criteria/bills_to_be_paid/bills_to_be_paid.txt
new file mode 100644
index 0000000..e454f49
--- /dev/null
+++ b/event_updates/search_criteria/bills_to_be_paid/bills_to_be_paid.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '`tabPayable Voucher`.outstanding_amount!=0\n`tabPayable Voucher`.docstatus=1',
+		'add_tab': None,
+		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Due Date,Payable Voucher\x01Credit To,Payable Voucher\x01Bill Date,Payable Voucher\x01Outstanding Amount',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Bills-To be paid',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Payable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:26:48',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'bills-to_be_paid',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabPayable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/bills_to_be_submitted/__init__.py b/event_updates/search_criteria/bills_to_be_submitted/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/bills_to_be_submitted/__init__.py
diff --git a/event_updates/search_criteria/bills_to_be_submitted/bills_to_be_submitted.txt b/event_updates/search_criteria/bills_to_be_submitted/bills_to_be_submitted.txt
new file mode 100644
index 0000000..f45a040
--- /dev/null
+++ b/event_updates/search_criteria/bills_to_be_submitted/bills_to_be_submitted.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Due Date,Payable Voucher\x01Credit To,Payable Voucher\x01Bill No,Payable Voucher\x01Bill Date,Payable Voucher\x01Outstanding Amount',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Bills-To be submitted',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Payable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Payable Voucher\x01Saved':1,'Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-03 12:24:43',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'bills-to_be_submitted',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabPayable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/delivery_note_to_be_billed/__init__.py b/event_updates/search_criteria/delivery_note_to_be_billed/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/delivery_note_to_be_billed/__init__.py
diff --git a/event_updates/search_criteria/delivery_note_to_be_billed/delivery_note_to_be_billed.txt b/event_updates/search_criteria/delivery_note_to_be_billed/delivery_note_to_be_billed.txt
new file mode 100644
index 0000000..ec64dcb
--- /dev/null
+++ b/event_updates/search_criteria/delivery_note_to_be_billed/delivery_note_to_be_billed.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': 'ifnull(`tabDelivery Note`.per_billed, 0) < 100',
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Customer Name,Delivery Note\x01% Billed,Delivery Note\x01Company',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Delivery Note-To be billed',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:24:34',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'delivery_note-to_be_billed',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/delivery_note_to_be_submitted/__init__.py b/event_updates/search_criteria/delivery_note_to_be_submitted/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/delivery_note_to_be_submitted/__init__.py
diff --git a/event_updates/search_criteria/delivery_note_to_be_submitted/delivery_note_to_be_submitted.txt b/event_updates/search_criteria/delivery_note_to_be_submitted/delivery_note_to_be_submitted.txt
new file mode 100644
index 0000000..90ce8c6
--- /dev/null
+++ b/event_updates/search_criteria/delivery_note_to_be_submitted/delivery_note_to_be_submitted.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Customer Name,Delivery Note\x01Posting Date,Delivery Note\x01Company',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Delivery Note-To be submitted',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Status':'Draft','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:17:58',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'delivery_note-to_be_submitted',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/enquiry_quotations_to_be_sent/__init__.py b/event_updates/search_criteria/enquiry_quotations_to_be_sent/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/enquiry_quotations_to_be_sent/__init__.py
diff --git a/event_updates/search_criteria/enquiry_quotations_to_be_sent/enquiry_quotations_to_be_sent.txt b/event_updates/search_criteria/enquiry_quotations_to_be_sent/enquiry_quotations_to_be_sent.txt
new file mode 100644
index 0000000..82491c4
--- /dev/null
+++ b/event_updates/search_criteria/enquiry_quotations_to_be_sent/enquiry_quotations_to_be_sent.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '`tabQuotation`.enq_no!=`tabEnquiry`.name\n',
+		'add_tab': 'tabQuotation',
+		'columns': 'Enquiry\x01ID,Enquiry\x01Owner',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Enquiry-Quotations to be sent',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Enquiry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': '{}',
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-07-16 13:29:58',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'enquiry-quotations_to_be_sent',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabEnquiry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/enquiry_to_follow_up/__init__.py b/event_updates/search_criteria/enquiry_to_follow_up/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/enquiry_to_follow_up/__init__.py
diff --git a/event_updates/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.js b/event_updates/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.js
new file mode 100644
index 0000000..bb0e9e5
--- /dev/null
+++ b/event_updates/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.js
@@ -0,0 +1,5 @@
+report.customize_filters = function() {
+
+  this.filter_fields_dict['Enquiry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Enquiry'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/event_updates/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.txt b/event_updates/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.txt
new file mode 100644
index 0000000..96574b6
--- /dev/null
+++ b/event_updates/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '',
+		'add_cond': "`tabEnquiry`.name=`tabQuotation`.enq_no\n`tabEnquiry`.docstatus=1\n`tabQuotation`.status='Submitted'",
+		'add_tab': None,
+		'columns': 'Enquiry\x01ID,Enquiry\x01Owner,Enquiry\x01Company,Enquiry\x01Fiscal Year',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Enquiry-To follow up',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Enquiry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Enquiry\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 12:08:00',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'enquiry-to_follow_up',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabEnquiry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/indent_purchase_order_to_be_made/__init__.py b/event_updates/search_criteria/indent_purchase_order_to_be_made/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/indent_purchase_order_to_be_made/__init__.py
diff --git a/event_updates/search_criteria/indent_purchase_order_to_be_made/indent_purchase_order_to_be_made.txt b/event_updates/search_criteria/indent_purchase_order_to_be_made/indent_purchase_order_to_be_made.txt
new file mode 100644
index 0000000..00b17a1
--- /dev/null
+++ b/event_updates/search_criteria/indent_purchase_order_to_be_made/indent_purchase_order_to_be_made.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabIndent`.status='Submitted'\nifnull(`tabIndent`.per_ordered,0)<100",
+		'add_tab': '',
+		'columns': 'Indent\x01ID,Indent\x01Indent Date,Indent\x01Requested By,Indent\x01Owner,Indent\x01% Ordered',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Indent-Purchase Order to be made',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Indent',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Indent\x01Submitted':1,'Indent\x01Status':'Submitted','Indent\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:37:18',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'indent-purchase_order_to_be_made',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabIndent`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/indent_to_be_submitted/__init__.py b/event_updates/search_criteria/indent_to_be_submitted/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/indent_to_be_submitted/__init__.py
diff --git a/event_updates/search_criteria/indent_to_be_submitted/indent_to_be_submitted.txt b/event_updates/search_criteria/indent_to_be_submitted/indent_to_be_submitted.txt
new file mode 100644
index 0000000..475aadd
--- /dev/null
+++ b/event_updates/search_criteria/indent_to_be_submitted/indent_to_be_submitted.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabIndent`.status='Draft'",
+		'add_tab': None,
+		'columns': 'Indent\x01ID,Indent\x01Owner,Indent\x01Indent Date,Indent\x01Remarks',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Indent-To be submitted',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Indent',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Indent\x01Saved':1,'Indent\x01Status':'Draft','Indent\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:38:49',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'indent-to_be_submitted',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabIndent`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/invoices_overdue/__init__.py b/event_updates/search_criteria/invoices_overdue/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/invoices_overdue/__init__.py
diff --git a/event_updates/search_criteria/invoices_overdue/invoices_overdue.txt b/event_updates/search_criteria/invoices_overdue/invoices_overdue.txt
new file mode 100644
index 0000000..6830537
--- /dev/null
+++ b/event_updates/search_criteria/invoices_overdue/invoices_overdue.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '`tabReceivable Voucher`.due_date<now()\n`tabReceivable Voucher`.outstanding_amount!=0\n`tabReceivable Voucher`.docstatus=1',
+		'add_tab': None,
+		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Debit To,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Due Date,Receivable Voucher\x01Outstanding Amount',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Invoices-Overdue',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Saved':1,'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-30 17:08:52',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'invoices-overdue',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabReceivable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/invoices_to_be_submitted/__init__.py b/event_updates/search_criteria/invoices_to_be_submitted/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/invoices_to_be_submitted/__init__.py
diff --git a/event_updates/search_criteria/invoices_to_be_submitted/invoices_to_be_submitted.txt b/event_updates/search_criteria/invoices_to_be_submitted/invoices_to_be_submitted.txt
new file mode 100644
index 0000000..652cf5e
--- /dev/null
+++ b/event_updates/search_criteria/invoices_to_be_submitted/invoices_to_be_submitted.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': None,
+		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Debit To,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Due Date',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Invoices-To be submitted',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Saved':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-03 10:18:56',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'invoices-to_be_submitted',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabReceivable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/invoices_to_receive_payment/__init__.py b/event_updates/search_criteria/invoices_to_receive_payment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/invoices_to_receive_payment/__init__.py
diff --git a/event_updates/search_criteria/invoices_to_receive_payment/invoices_to_receive_payment.txt b/event_updates/search_criteria/invoices_to_receive_payment/invoices_to_receive_payment.txt
new file mode 100644
index 0000000..322f04e
--- /dev/null
+++ b/event_updates/search_criteria/invoices_to_receive_payment/invoices_to_receive_payment.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '`tabReceivable Voucher`.due_date>now() \n`tabReceivable Voucher`.outstanding_amount!=0\n`tabReceivable Voucher`.docstatus=1',
+		'add_tab': None,
+		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Owner,Receivable Voucher\x01Debit To,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Due Date,Receivable Voucher\x01Outstanding Amount',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Invoices-To receive payment',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Receivable Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-30 16:54:26',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'invoices-to_receive_payment',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabReceivable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/lead_to_follow_up/__init__.py b/event_updates/search_criteria/lead_to_follow_up/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/lead_to_follow_up/__init__.py
diff --git a/event_updates/search_criteria/lead_to_follow_up/lead_to_follow_up.js b/event_updates/search_criteria/lead_to_follow_up/lead_to_follow_up.js
new file mode 100644
index 0000000..ff22521
--- /dev/null
+++ b/event_updates/search_criteria/lead_to_follow_up/lead_to_follow_up.js
@@ -0,0 +1,5 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Lead'+FILTER_SEP +'Status'].df.filter_hide = 1;
+  this.filter_fields_dict['Lead'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
+  
\ No newline at end of file
diff --git a/event_updates/search_criteria/lead_to_follow_up/lead_to_follow_up.txt b/event_updates/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
new file mode 100644
index 0000000..e1536eb
--- /dev/null
+++ b/event_updates/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabLead`.status!='Converted' \n`tabLead`.status!='Lead Lost' \n`tabLead`.status!='Not Interested'",
+		'add_tab': None,
+		'columns': 'Lead\x01ID,Lead\x01Status,Lead\x01Lead Name,Lead\x01Lead Date,Lead\x01Lead Owner,Lead\x01Next Contact Date',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Lead-To follow up',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Lead',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Lead\x01Status':'','Lead\x01Source':'','Lead\x01Expected Month':'','Lead\x01Industry':'','Lead\x01Market Segment':'','Lead\x01Rating':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 12:01:19',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'lead-to_follow_up',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabLead`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/purchase_order_to_be_billed/__init__.py b/event_updates/search_criteria/purchase_order_to_be_billed/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/purchase_order_to_be_billed/__init__.py
diff --git a/event_updates/search_criteria/purchase_order_to_be_billed/purchase_order_to_be_billed.txt b/event_updates/search_criteria/purchase_order_to_be_billed/purchase_order_to_be_billed.txt
new file mode 100644
index 0000000..c84afa7
--- /dev/null
+++ b/event_updates/search_criteria/purchase_order_to_be_billed/purchase_order_to_be_billed.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "ifnull(`tabPurchase Order`.per_billed,0)<100\n`tabPurchase Order`.status='Submitted'",
+		'add_tab': None,
+		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01PO Date,Purchase Order\x01Company,Purchase Order\x01Grand Total',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Purchase Order-To be billed',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Purchase Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'Submitted','Purchase Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:31:42',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'purchase_order-to_be_billed',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabPurchase Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/purchase_order_to_be_submitted/__init__.py b/event_updates/search_criteria/purchase_order_to_be_submitted/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/purchase_order_to_be_submitted/__init__.py
diff --git a/event_updates/search_criteria/purchase_order_to_be_submitted/purchase_order_to_be_submitted.txt b/event_updates/search_criteria/purchase_order_to_be_submitted/purchase_order_to_be_submitted.txt
new file mode 100644
index 0000000..41f1d7f
--- /dev/null
+++ b/event_updates/search_criteria/purchase_order_to_be_submitted/purchase_order_to_be_submitted.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01PO Date,Purchase Order\x01Company,Purchase Order\x01Grand Total',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Purchase Order-To be submitted',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Purchase Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':0,'Purchase Order\x01Status':'Draft','Purchase Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-03 11:19:23',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'purchase_order-to_be_submitted',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabPurchase Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/purchase_order_to_receive_items/__init__.py b/event_updates/search_criteria/purchase_order_to_receive_items/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/purchase_order_to_receive_items/__init__.py
diff --git a/event_updates/search_criteria/purchase_order_to_receive_items/purchase_order_to_receive_items.txt b/event_updates/search_criteria/purchase_order_to_receive_items/purchase_order_to_receive_items.txt
new file mode 100644
index 0000000..51f5144
--- /dev/null
+++ b/event_updates/search_criteria/purchase_order_to_receive_items/purchase_order_to_receive_items.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "ifnull(`tabPurchase Order`.per_received,0)<100\n`tabPurchase Order`.status='Submitted'",
+		'add_tab': None,
+		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01PO Date,Purchase Order\x01Company,Purchase Order\x01% Received,Purchase Order\x01Grand Total',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Purchase Order-To receive items',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Purchase Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'Submitted','Purchase Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:34:22',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'purchase_order-to_receive_items',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabPurchase Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/sales_order_overdue/__init__.py b/event_updates/search_criteria/sales_order_overdue/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_overdue/__init__.py
diff --git a/event_updates/search_criteria/sales_order_overdue/sales_order_overdue.js b/event_updates/search_criteria/sales_order_overdue/sales_order_overdue.js
new file mode 100644
index 0000000..0f86a56
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_overdue/sales_order_overdue.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'ID'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Quotation No'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df.filter_hide = 0;
+}
\ No newline at end of file
diff --git a/event_updates/search_criteria/sales_order_overdue/sales_order_overdue.txt b/event_updates/search_criteria/sales_order_overdue/sales_order_overdue.txt
new file mode 100644
index 0000000..5e216cc
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_overdue/sales_order_overdue.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '`tabSales Order`.delivery_date<now()\nifnull(`tabSales Order`.per_delivered,0)<100',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No,Sales Order\x01Company,Sales Order\x01%  Delivered',
+		'creation': '2010-08-26 11:52:27',
+		'criteria_name': 'Sales Order-Overdue',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-26 11:52:09',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'sales_order-overdue',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/sales_order_to_be_billed/__init__.py b/event_updates/search_criteria/sales_order_to_be_billed/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_to_be_billed/__init__.py
diff --git a/event_updates/search_criteria/sales_order_to_be_billed/sales_order_to_be_billed.txt b/event_updates/search_criteria/sales_order_to_be_billed/sales_order_to_be_billed.txt
new file mode 100644
index 0000000..b9d942b
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_to_be_billed/sales_order_to_be_billed.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "ifnull(`tabSales Order`.per_billed,0)<100\n`tabSales Order`.status='Submitted'",
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Quotation No,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01% Billed,Sales Order\x01Customer',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Sales Order-To be billed',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:45:37',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'sales_order-to_be_billed',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/sales_order_to_be_delivered/__init__.py b/event_updates/search_criteria/sales_order_to_be_delivered/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_to_be_delivered/__init__.py
diff --git a/event_updates/search_criteria/sales_order_to_be_delivered/sales_order_to_be_delivered.txt b/event_updates/search_criteria/sales_order_to_be_delivered/sales_order_to_be_delivered.txt
new file mode 100644
index 0000000..0e9f737
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_to_be_delivered/sales_order_to_be_delivered.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "ifnull(`tabSales Order`.per_delivered,0)<100\n`tabSales Order`.status = 'Submitted'\n`tabSales Order`. delivery_date > now()",
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Owner,Sales Order\x01Status,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Sales Order-To be delivered',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:53:29',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'sales_order-to_be_delivered',
+		'owner': 'Administrator',
+		'page_len': 100,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': '',
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/sales_order_to_be_submitted/__init__.py b/event_updates/search_criteria/sales_order_to_be_submitted/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_to_be_submitted/__init__.py
diff --git a/event_updates/search_criteria/sales_order_to_be_submitted/sales_order_to_be_submitted.txt b/event_updates/search_criteria/sales_order_to_be_submitted/sales_order_to_be_submitted.txt
new file mode 100644
index 0000000..0e1a4ee
--- /dev/null
+++ b/event_updates/search_criteria/sales_order_to_be_submitted/sales_order_to_be_submitted.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabSales Order`.status='Draft'",
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Quotation No',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Sales Order-To be submitted',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-05-13 17:47:45',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'sales_order-to_be_submitted',
+		'owner': 'Administrator',
+		'page_len': 100,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/serial_no_amc_expiring_this_month/__init__.py b/event_updates/search_criteria/serial_no_amc_expiring_this_month/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/serial_no_amc_expiring_this_month/__init__.py
diff --git a/event_updates/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt b/event_updates/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
new file mode 100644
index 0000000..c43ce7d
--- /dev/null
+++ b/event_updates/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '',
+		'add_cond': '`tab Serial No`.month(amc_expiry_date)=month(now()) \n`tab Serial No`.year(amc_expiry_date)=year(now())',
+		'add_tab': None,
+		'columns': 'Serial No\x01ID,Serial No\x01Status,Serial No\x01AMC Expiry Date,Serial No\x01Customer Name',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Serial No-AMC expiring this month',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'','Serial No\x01Warranty Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-07-29 15:01:33',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'serial_no-amc_expiring_this_month',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSerial No`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/serial_no_warranty_expiring_this_month/__init__.py b/event_updates/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
diff --git a/event_updates/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt b/event_updates/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
new file mode 100644
index 0000000..1b74d94
--- /dev/null
+++ b/event_updates/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '',
+		'add_cond': "`tab Serial No`.docstatus!=2\n`tab Serial No`.maintenance_status='Under Warranty'\n`tab Serial No`.status!='Scrapped'\n`tab Serial No`.status!='Not in Use'\n`tab Serial No`.month(ifnull(warranty_expiry_date,0)) = month(now()) \n`tab Serial No`.yearmonth(ifnull(warranty_expiry_date,0)) = year(now())",
+		'add_tab': None,
+		'columns': 'Serial No\x01ID,Serial No\x01Status,Serial No\x01Warranty Expiry Date,Serial No\x01Customer Name',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Serial No-Warranty expiring this month',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'Issued','Serial No\x01Maintenance Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-07-23 09:57:51',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'serial_no-warranty_expiring_this_month',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSerial No`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/event_updates/search_criteria/task_open/__init__.py b/event_updates/search_criteria/task_open/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/event_updates/search_criteria/task_open/__init__.py
diff --git a/event_updates/search_criteria/task_open/task_open.txt b/event_updates/search_criteria/task_open/task_open.txt
new file mode 100644
index 0000000..47e8dfc
--- /dev/null
+++ b/event_updates/search_criteria/task_open/task_open.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabTicket`.status='Open'",
+		'add_tab': None,
+		'columns': 'Ticket\x01ID,Ticket\x01Subject,Ticket\x01Priority,Ticket\x01Raised By,Ticket\x01Allocated To',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Task-Open',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Ticket',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Ticket\x01Priority':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-07-16 13:03:49',
+		'modified_by': 'Administrator',
+		'module': 'Event Updates',
+		'name': 'task-open',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabTicket`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt b/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt
new file mode 100644
index 0000000..8aee002
--- /dev/null
+++ b/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt
@@ -0,0 +1,42 @@
+[
+	{
+		'creation': '2010-08-08 17:35:42',
+		'disabled': 'Yes',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': None,
+		'modified': '2011-05-02 12:40:40',
+		'modified_by': 'Administrator',
+		'module_desc': '<p>Maintain your knowledge base of Questions &amp; Answers</p>',
+		'module_icon': 'help.png',
+		'module_label': 'Knowledge Base',
+		'module_name': 'Knowledge Base',
+		'module_page': 'questions',
+		'module_seq': 13,
+		'name': 'Knowledge Base',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'creation': '2010-08-08 17:35:42',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-08-08 17:35:42',
+		'modified_by': 'Administrator',
+		'name': 'MDR00106',
+		'owner': 'Administrator',
+		'parent': 'Knowledge Base',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'All'
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/__init__.py b/knowledge_base/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/__init__.py
diff --git a/knowledge_base/doctype/__init__.py b/knowledge_base/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/doctype/__init__.py
diff --git a/knowledge_base/doctype/answer/__init__.py b/knowledge_base/doctype/answer/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/doctype/answer/__init__.py
diff --git a/knowledge_base/doctype/answer/answer.txt b/knowledge_base/doctype/answer/answer.txt
new file mode 100644
index 0000000..2702398
--- /dev/null
+++ b/knowledge_base/doctype/answer/answer.txt
@@ -0,0 +1,220 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': 0,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': '_ANS.#######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 11:04:37',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-26 14:56:57',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Answer',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 3
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-05-09 11:04:37',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000475',
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'question',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Question',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000476',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Question',
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'answer',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Answer',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000477',
+		'no_copy': None,
+		'oldfieldname': 'question',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'points',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Points',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000478',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '_users_voted',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Users Voted',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000479',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/doctype/question/__init__.py b/knowledge_base/doctype/question/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/doctype/question/__init__.py
diff --git a/knowledge_base/doctype/question/question.txt b/knowledge_base/doctype/question/question.txt
new file mode 100644
index 0000000..066b75b
--- /dev/null
+++ b/knowledge_base/doctype/question/question.txt
@@ -0,0 +1,395 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': 0,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'QUES.#######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-20 18:22:44',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Question',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 7
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00433',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'question',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Question',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': 'FL02621',
+		'no_copy': None,
+		'oldfieldname': 'question',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'points',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Points',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': '000000472',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'answer',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Answer',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02622',
+		'no_copy': None,
+		'oldfieldname': 'answer',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '_user_tags',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'User Tags',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': '000000473',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tag_1',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Tag 1',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02623',
+		'no_copy': None,
+		'oldfieldname': 'tag_1',
+		'oldfieldtype': 'Link',
+		'options': 'Question Tag',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '_users_voted',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Users Voted',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': '000000474',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tag_2',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Tag 2',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02624',
+		'no_copy': None,
+		'oldfieldname': 'tag_2',
+		'oldfieldtype': 'Link',
+		'options': 'Question Tag',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tag_3',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Tag 3',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02625',
+		'no_copy': None,
+		'oldfieldname': 'tag_3',
+		'oldfieldtype': 'Link',
+		'options': 'Question Tag',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02626',
+		'no_copy': None,
+		'oldfieldname': 'file_list',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/page/__init__.py b/knowledge_base/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/__init__.py
diff --git a/knowledge_base/page/kb_common/kb_common.comp.js b/knowledge_base/page/kb_common/kb_common.comp.js
new file mode 100644
index 0000000..47bf0dd
--- /dev/null
+++ b/knowledge_base/page/kb_common/kb_common.comp.js
@@ -0,0 +1,23 @@
+
+KBItemToolbar=function(args,kb){$.extend(this,args);var me=this;this.make=function(){this.wrapper=$a(this.parent,'div','',{});this.line1=$a(this.wrapper,'div','',{color:'#888',fontSize:'11px',margin:'7px 0px'});this.line2=$a(this.wrapper,'div','',{marginBottom:'7px'});this.make_timestamp();this.make_vote();if(this.with_tags)
+this.make_tags();}
+this.make_timestamp=function(){this.line1.innerHTML=repl('By %(name)s | %(when)s',{name:wn.utils.full_name(this.det.first_name,this.det.last_name),when:wn.datetime.comment_when(this.det.modified)})}
+this.make_vote=function(){new KBPoints(this.line2,this.det.points,this.det._users_voted,this.doctype,this.det.name,this.det.owner);}
+this.make_tags=function(){this.tags_area=$a(this.line2,'span','kb-tags')
+this.tags=new TagList(this.tags_area,this.det._user_tags&&(this.det._user_tags.split(',')),this.doctype,this.det.name,0,kb.set_tag_filter)}
+this.make();}
+KBPoints=function(parent,points,voted,dt,dn,owner){var me=this;voted=voted?voted.split(','):[];this.wrapper=$a(parent,'span','',{fontSize:'11px',marginRight:'13px'});this.render_points=function(p){if(!this.points_area)
+this.points_area=$a(this.wrapper,'span');this.points_area.innerHTML=cint(p)+' point'+(p>1?'s':'');}
+this.render_points(points);if(user!='Guest'&&!in_list(voted,user)&&user!=owner){this.vote_up=$a(this.wrapper,'img','images/ui/vote_up.gif',{margin:'0px 0px -2px 7px',cursor:'pointer'});this.vote_down=$a(this.wrapper,'img','images/ui/vote_down.gif',{margin:'0px 0px -3px 0px',cursor:'pointer'});this.vote_up.title='Vote Up';this.vote_down.title='Vote Down';var callback=function(r,rt){if(r.exc){msgprint(r.exc);return;}
+$dh(me.vote_up);$dh(me.vote_down);me.render_points(r.message);}
+this.vote_up.onclick=function(){$c_page('knowledge_base','questions','vote',{vote:'up',dn:dn,dt:dt},callback);}
+this.vote_down.onclick=function(){$c_page('knowledge_base','questions','vote',{vote:'down',dn:dn,dt:dt},callback);}}}
+EditableText=function(args){$.extend(this,args);var me=this;this.display=$a(me.parent,'div',me.disp_class,'',me.text);this.input=$a(me.parent,'textarea',me.inp_class,{display:'none'});var div=$a(me.parent,'div','',{marginTop:'5px',height:'23px'});this.edit_btn=$a(div,'span','',{color:'#333',marginLeft:'-2px',cursor:'pointer',padding:'3px',backgroundColor:'#ddd',cssFloat:'left'});$br(this.edit_btn,'3px')
+$a(this.edit_btn,'div','wn-icon ic-pencil',{marginBottom:'-2px',cssFloat:'left'});$a(this.edit_btn,'span','link_type',{marginLeft:'3px',color:'#555',fontSize:'11px'},'Edit');this.edit_btn.onclick=function(){me.input.value=me.display.innerHTML;me.show_as_input();}
+this.save_btn=$btn(div,'Save',function(){var v=me.rich_text?wn.tinymce.get_value(me.input):me.input.value;if(!v){msgprint('Please write something!');return;}
+me.save_btn.set_working();$c_page('knowledge_base','question_view','update_item',{dt:me.dt,dn:me.dn,fn:me.fieldname,text:v},function(r,rt){me.save_btn.done_working();if(r.exc){msgprint(r.exc);return;}
+me.display.innerHTML=v;me.show_as_text();});},{display:'none'});this.cancel_btn=$a(div,'span','link_type',{color:'#555',display:'none'},'Cancel',{marginLeft:'7px'});this.cancel_btn.onclick=function(){me.show_as_text();}
+this.show_as_text=function(){$ds(me.display);$ds(me.edit_btn);if(me.rich_text)
+wn.tinymce.remove(me.input);$dh(me.input);$dh(me.save_btn);$dh(me.cancel_btn);}
+this.show_as_input=function(){$ds(me.input);$ds(me.save_btn);$ds(me.cancel_btn);$dh(me.edit_btn);$dh(me.display);if(me.rich_text)
+wn.tinymce.add_simple(me.input,'300px');}}
\ No newline at end of file
diff --git a/knowledge_base/page/kb_common/kb_common.js b/knowledge_base/page/kb_common/kb_common.js
new file mode 100644
index 0000000..1826f05
--- /dev/null
+++ b/knowledge_base/page/kb_common/kb_common.js
@@ -0,0 +1,146 @@
+// question toolbar
+// contains - voting widget / tag list and user info / timestamp
+// By XXXXXX on YYYYY
+
+KBItemToolbar = function(args, kb) {
+	$.extend(this, args);
+	var me = this;
+	this.make = function() {
+		this.wrapper = $a(this.parent, 'div', '', {});
+		this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'});
+		this.line2 = $a(this.wrapper, 'div','',{marginBottom:'7px'});
+		this.make_timestamp();
+		this.make_vote();
+		if(this.with_tags)
+			this.make_tags();
+	}
+	
+	this.make_timestamp = function() {
+		this.line1.innerHTML = repl('By %(name)s | %(when)s', {
+			name: wn.utils.full_name(this.det.first_name, this.det.last_name),
+			when: wn.datetime.comment_when(this.det.modified)
+		})
+	}
+
+	this.make_vote = function() {
+		new KBPoints(this.line2, this.det.points, this.det._users_voted, this.doctype, this.det.name, this.det.owner);
+		
+	}
+	
+	this.make_tags = function() {
+		this.tags_area = $a(this.line2, 'span', 'kb-tags')
+		this.tags = new TagList(this.tags_area, 
+			this.det._user_tags && (this.det._user_tags.split(',')), 
+			this.doctype, this.det.name, 0, kb.set_tag_filter)		
+	}
+
+	this.make();
+}
+
+
+// kb points
+// x points | Vote Up | Vote Down (if not voted and not guest)
+KBPoints = function(parent, points, voted, dt, dn, owner) {
+	var me = this;
+	voted = voted ? voted.split(',') : [];
+
+	this.wrapper = $a(parent, 'span', '', {fontSize: '11px', marginRight: '13px'});
+	
+	this.render_points = function(p) {
+		if(!this.points_area)
+			this.points_area = $a(this.wrapper, 'span');
+		this.points_area.innerHTML = cint(p) + ' point' + (p>1 ? 's' : '');			
+	}
+	
+	this.render_points(points);
+	
+	// vote up or down
+	// if user has not already voted
+	
+	if(user!='Guest' && !in_list(voted, user) && user!=owner) {
+		this.vote_up = $a(this.wrapper, 'img', 'images/ui/vote_up.gif', {margin:'0px 0px -2px 7px', cursor: 'pointer'});
+		this.vote_down = $a(this.wrapper, 'img', 'images/ui/vote_down.gif', {margin:'0px 0px -3px 0px', cursor: 'pointer'});
+		
+		this.vote_up.title = 'Vote Up'; this.vote_down.title = 'Vote Down';
+		
+		var callback = function(r, rt) {
+			if(r.exc) { msgprint(r.exc); return; }
+			$dh(me.vote_up); $dh(me.vote_down);
+			me.render_points(r.message);
+		}
+		
+		this.vote_up.onclick = function() {
+			$c_page('knowledge_base', 'questions', 'vote', {vote:'up', dn:dn, dt:dt}, callback);
+		}
+		this.vote_down.onclick = function() {
+			$c_page('knowledge_base', 'questions', 'vote', {vote:'down', dn:dn, dt:dt}, callback);
+		}
+	}
+}
+
+// displays an editable text,
+// needs parent, text, disp_class, inp_class
+// dt, dn
+
+EditableText = function(args) {
+	$.extend(this, args);
+	var me = this;
+	
+	this.display = $a(me.parent, 'div', me.disp_class, '', me.text);
+	this.input = $a(me.parent, 'textarea', me.inp_class, {display:'none'});
+	
+	var div = $a(me.parent, 'div', '', {marginTop:'5px', height:'23px'});
+	
+	// edit text
+	this.edit_btn = $a(div, 'span', '', {color:'#333', marginLeft:'-2px', cursor:'pointer', padding:'3px', backgroundColor:'#ddd', cssFloat: 'left'});
+	$br(this.edit_btn, '3px')
+	$a(this.edit_btn, 'div', 'wn-icon ic-pencil', {marginBottom:'-2px', cssFloat:'left'} );
+	$a(this.edit_btn, 'span', 'link_type', {marginLeft:'3px', color:'#555', fontSize:'11px'}, 'Edit');
+
+	this.edit_btn.onclick = function() {
+		me.input.value = me.display.innerHTML;
+		me.show_as_input();
+	}
+	
+	// save button - save the new text
+	// check if text is written
+	this.save_btn = $btn(div, 'Save', function() {
+		var v = me.rich_text ? wn.tinymce.get_value(me.input) : me.input.value;
+		if(!v) {
+			msgprint('Please write something!');
+			return;
+		}
+		me.save_btn.set_working();
+		$c_page('knowledge_base', 'question_view', 'update_item', {
+				dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
+			}, 
+			function(r, rt) {
+				me.save_btn.done_working();
+				if(r.exc) {msgprint(r.exc); return; }
+				me.display.innerHTML = v;
+				me.show_as_text();
+			});
+	}, {display: 'none'});
+
+	// cancel button
+	this.cancel_btn = $a(div, 'span', 'link_type', {color: '#555', display:'none'}, 'Cancel', {marginLeft:'7px'});
+	this.cancel_btn.onclick = function() {
+		me.show_as_text();		
+	}
+
+	this.show_as_text = function() {
+		$ds(me.display); $ds(me.edit_btn);
+		if(me.rich_text)
+			wn.tinymce.remove(me.input);
+		$dh(me.input); $dh(me.save_btn); $dh(me.cancel_btn);
+				
+	}
+
+	this.show_as_input = function() {
+		$ds(me.input); $ds(me.save_btn); $ds(me.cancel_btn); 
+		$dh(me.edit_btn); $dh(me.display);
+		if(me.rich_text)
+			wn.tinymce.add_simple(me.input, '300px');
+	}	
+
+}
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/__init__.py b/knowledge_base/page/question_view/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/question_view/__init__.py
diff --git a/knowledge_base/page/question_view/question_view.comp.js b/knowledge_base/page/question_view/question_view.comp.js
new file mode 100644
index 0000000..6f6d5bf
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.comp.js
@@ -0,0 +1,24 @@
+
+pscript['onload_question-view']=function(){var w=page_body.pages['question-view'];w.className='layout_wrapper';new PageHeader(w,'Knowledge Base');w.link=$ln($a(w,'div'),'< Back to all questions',function(){loadpage('questions');})
+w.body=$a(w,'div','qv-body');}
+pscript['refresh_question-view']=function(){var qid=window.location.hash.split('/')[1];if(qid){pscript.question_view(qid);}}
+pscript.question_view=function(qid,qtext){var w=page_body.pages['question-view'];new KBQuestionView(w,qid,qtext);}
+KBQuestionView=function(w,qid,qtext){var me=this;w.body.innerHTML='';w.question_area=$a(w.body,'div','social qv-question-wrapper');w.answer_area=$a(w.body,'div','social qv-answer-wrapper');w.add_answer_link=$a(w.body,'div','',{margin:'3px 0px'});w.add_answer_area=$a(w.body,'div','qv-add-answer');this.make_question=function(){new EditableText({parent:w.question_area,dt:'Question',dn:qid,fieldname:'question',text:qtext,inp_class:'qv-input',disp_class:'qv-text'});}
+this.make_answer_list=function(){this.ans_list=new KBAnswerList({parent:w.answer_area,qid:qid})}
+this.make_add_answer=function(){$c_page('knowledge_base','question_view','has_answered',qid,function(r,rt){if(r.message=='No'){me.make_answer_box_link();}});}
+this.make_answer_box_link=function(){$a(w.add_answer_link,'span','link_type',null,'+ Add your answer',function(){$dh(w.add_answer_link);me.make_answer_box();});}
+this.make_answer_box=function(){$ds(w.add_answer_area);$a(w.add_answer_area,'h3','',{},'Add Your Answer')
+this.input=$a(w.add_answer_area,'textarea');wn.tinymce.add_simple(this.input);this.btn=$btn($a(w.add_answer_area,'div'),'Post',function(){var v=wn.tinymce.get_value(me.input);if(!v){msgprint('Write something!');return;}
+me.btn.set_working();$c_page('knowledge_base','question_view','add_answer',{qid:qid,answer:v},function(r,rt){me.btn.done_working();me.ans_list.list.run();$dh(w.add_answer_area);});});}
+this.setup=function(){if(qtext){this.make();}
+else{$c_page('knowledge_base','question_view','get_question',qid,function(r,rt){qtext=r.message;me.make();});}}
+this.make=function(){set_title(qtext);this.make_question();this.make_answer_list();this.make_add_answer();}
+this.setup();}
+KBAnswerList=function(args){var me=this;$.extend(this,args);this.make_list=function(){this.list=new wn.widgets.Listing({parent:me.parent,as_dict:1,no_results_message:'No answers yet, be the first one to answer!',render_row:function(body,data){new KBAnswer(body,data)},get_query:function(){return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, "
++"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
++"where question='%(qid)s' and t1.owner = t2.name "
++"order by t1.points desc, t1.modified desc",{qid:me.qid})}});this.list.run();}
+this.make_list();}
+KBAnswer=function(body,data){body.className='qv-answer';new EditableText({parent:body,dt:'Answer',dn:data.name,fieldname:'answer',text:data.answer,inp_class:'qv-ans-input',disp_class:'qv-ans-text',rich_text:1});var div=$a(body,'div','',{})
+new KBItemToolbar({parent:div,det:data,with_tags:0,doctype:'Answer'},null)}
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.css b/knowledge_base/page/question_view/question_view.css
new file mode 100644
index 0000000..0c2526c
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.css
@@ -0,0 +1,49 @@
+.qv-body {
+	padding: 13px;
+}
+
+
+.qv-input {
+	font-size: 14px;
+	height: 2.5em;
+	width: 100%;
+}
+
+.qv-text {
+	font-size: 20px;
+	font-weight: bold;
+}
+
+.qv-ans-input {
+	height: 5em;
+}
+
+.qv-ans-text {
+	color: #444;
+	line-height: 1.7em;
+}
+
+.qv-question-wrapper {
+	margin: 7px 0px 13px 0px;
+	padding-bottom: 7px;
+	border-bottom: 1px solid #CCC;
+}
+
+.qv-add-answer {
+	width: 50%;
+	margin: 7px 0px;
+	padding: 7px;
+	background-color: #E2E2EE;
+	display: none;
+}
+
+.qv-add-answer textarea {
+	height: 17em;
+	font-size: 12px;
+}
+
+.qv-answer {
+	margin: 7px 0px 7px 0px;
+	padding-bottom: 7px;
+	border-bottom: 1px solid #CCC;	
+}
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.js b/knowledge_base/page/question_view/question_view.js
new file mode 100644
index 0000000..895c6f7
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.js
@@ -0,0 +1,177 @@
+pscript['onload_question-view'] = function() {
+//
+	var w = page_body.pages['question-view'];
+	w.className = 'layout_wrapper';
+	new PageHeader(w, 'Knowledge Base');
+	w.link = $ln($a(w, 'div'), '< Back to all questions', function() { loadpage('questions'); })
+	w.body = $a(w, 'div', 'qv-body');
+
+}
+
+pscript['refresh_question-view'] = function() {
+	// href
+	var qid = window.location.hash.split('/')[1];
+	if(qid) {
+		pscript.question_view(qid);
+	}
+}
+
+pscript.question_view = function(qid, qtext) {
+	var w = page_body.pages['question-view'];
+	new KBQuestionView(w, qid, qtext);
+}
+
+KBQuestionView = function(w, qid, qtext) {
+	var me = this;
+	
+	w.body.innerHTML = '';
+	w.question_area = $a(w.body, 'div', 'social qv-question-wrapper');
+	w.answer_area = $a(w.body, 'div', 'social qv-answer-wrapper');
+	w.add_answer_link = $a(w.body, 'div', '', {margin:'3px 0px'});
+	w.add_answer_area = $a(w.body, 'div', 'qv-add-answer');
+	
+	this.make_question = function() {
+		new EditableText({
+			parent: w.question_area,
+			dt: 'Question',
+			dn: qid,
+			fieldname: 'question',
+			text: qtext,
+			inp_class: 'qv-input',
+			disp_class: 'qv-text'
+		});
+
+		// show tags
+	}
+	
+	// answer list
+	this.make_answer_list = function() {
+		this.ans_list = new KBAnswerList({
+			parent: w.answer_area,
+			qid: qid
+		})
+	}
+	
+	// check if users has answered 
+	// (if no) then add a box to add a new answer
+	this.make_add_answer = function() {
+		$c_page('knowledge_base', 'question_view', 'has_answered', qid, function(r, rt) {
+			if(r.message=='No') {
+				me.make_answer_box_link();
+			}
+		});
+	}
+	
+	// add a link to open add answer
+	this.make_answer_box_link = function() {
+		$a(w.add_answer_link, 'span', 'link_type', null, '+ Add your answer', 
+			function() { 
+				$dh(w.add_answer_link);
+				me.make_answer_box();
+			});
+	}
+	
+	// answer box
+	// text area + add button
+	this.make_answer_box = function() {
+		$ds(w.add_answer_area);
+		$a(w.add_answer_area, 'h3', '', {}, 'Add Your Answer')
+		this.input = $a(w.add_answer_area, 'textarea');
+		wn.tinymce.add_simple(this.input);
+		
+		this.btn = $btn($a(w.add_answer_area, 'div'), 'Post', function() {
+			var v = wn.tinymce.get_value(me.input);
+			if(!v) { msgprint('Write something!'); return; }
+			me.btn.set_working();
+			$c_page('knowledge_base', 'question_view', 'add_answer', {qid: qid, answer:v}, 
+				function(r, rt) {
+					me.btn.done_working();
+					me.ans_list.list.run();
+					$dh(w.add_answer_area);
+				}
+			);
+		});
+	}
+	
+	this.setup = function() {
+		if(qtext) {
+			this.make();
+		}
+		else {
+			$c_page('knowledge_base', 'question_view', 'get_question', qid, function(r, rt) {
+				qtext = r.message;
+				me.make();
+			});
+		}
+	}
+	
+	this.make = function() {
+		set_title(qtext);
+		this.make_question();
+		this.make_answer_list();
+		this.make_add_answer();		
+	}
+	
+	this.setup();
+}
+
+
+// kb answer list
+KBAnswerList = function(args) {
+	var me = this;
+	$.extend(this, args);
+	
+	this.make_list = function() {
+	
+		this.list = new wn.widgets.Listing({
+			parent: me.parent,
+			as_dict: 1,
+			no_results_message: 'No answers yet, be the first one to answer!',
+			render_row: function(body, data) {
+				new KBAnswer(body, data)
+			},
+			get_query: function() {
+				return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, "
+					+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
+					+"where question='%(qid)s' and t1.owner = t2.name "
+					+"order by t1.points desc, t1.modified desc", {qid: me.qid})
+			}
+		});
+		
+		this.list.run();
+		
+	}
+	
+	this.make_list();
+	
+}
+
+// kb answer
+// answer
+// by xxx | on xxx
+// points yyy
+KBAnswer = function(body, data) {
+	body.className = 'qv-answer';
+	new EditableText({
+		parent: body,
+		dt: 'Answer',
+		dn: data.name,
+		fieldname: 'answer',
+		text: data.answer,
+		inp_class: 'qv-ans-input',
+		disp_class: 'qv-ans-text',
+		rich_text: 1
+	});	
+	
+	var div = $a(body, 'div', '', {})
+	new KBItemToolbar({
+		parent: div,
+		det: data,
+		with_tags: 0,
+		doctype: 'Answer'
+	}, null)
+	
+}
+
+
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.py b/knowledge_base/page/question_view/question_view.py
new file mode 100644
index 0000000..a2eafbc
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.py
@@ -0,0 +1,28 @@
+import webnotes
+from webnotes.utils import load_json, cstr, now
+
+# update the editable text item
+def update_item(args):
+	args = load_json(args)
+	
+	webnotes.conn.sql("update `tab%s` set `%s`=%s, modified=%s where name=%s" \
+		% (args['dt'], args['fn'], '%s', '%s', '%s'), (args['text'], now(), args['dn']))
+		
+def has_answered(arg):
+	return webnotes.conn.sql("select name from tabAnswer where owner=%s and question=%s", (webnotes.user.name, arg)) and 'Yes' or 'No'
+
+def get_question(arg):
+	return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0])
+
+def add_answer(args):
+	args = load_json(args)
+	
+	from webnotes.model.doc import Document
+	
+	a = Document('Answer')
+	a.answer = args['answer']
+	a.question = args['qid']
+	a.points = 1
+	a.save(1)
+	
+	webnotes.conn.set_value('Question', args['qid'], 'modified', now())
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.txt b/knowledge_base/page/question_view/question_view.txt
new file mode 100644
index 0000000..0840e63
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-05-09 11:04:37',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-03-29 13:54:27',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Question View',
+		'owner': 'Administrator',
+		'page_name': 'Question View',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/page/questions/__init__.py b/knowledge_base/page/questions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/questions/__init__.py
diff --git a/knowledge_base/page/questions/questions.comp.js b/knowledge_base/page/questions/questions.comp.js
new file mode 100644
index 0000000..50c6731
--- /dev/null
+++ b/knowledge_base/page/questions/questions.comp.js
@@ -0,0 +1,27 @@
+
+pscript.onload_questions=function(){var w=page_body.pages['questions'];var tab=make_table(w,1,2,'100%',['75%','25%'],{});var body=$a($td(tab,0,0),'div','layout_wrapper');new PageHeader(body,'Knowledge Base');var kb=new KnowledgeBase(body);$y($td(tab,0,1),{paddingTop:'53px'});this.sidebar=new wn.widgets.PageSidebar($td(tab,0,1),{sections:[{title:'Top Tags',render:function(body){new wn.widgets.TagCloud(body,'Question',function(tag){kb.set_tag_filter(tag)});}}]});set_title('Knowledge Base');}
+function KnowledgeBase(w){var me=this;this.sort_by='modified';this.tag_filter_dict={};this.make_search_bar=function(){this.search=$a($a(w,'div','kb-search-wrapper'),'textarea');$(this.search).add_default_text('Enter keywords or a new Question');var div=$a(w,'div','kb-btn-wrapper');$btn(div,'Search',function(){me.run()},{fontSize:'14px'});$btn(div,'Ask',function(){me.ask()},{fontSize:'14px'});}
+this.ask=function(){if(this.search.value==$(this.search).attr('default_text')){msgprint('Please enter some text');return;}
+this.suggest();}
+this.suggest=function(){this.dialog=new wn.widgets.Dialog({title:'Suggest a users',width:400,fields:[{fieldtype:'HTML',options:'Optional: Suggest a few users who can help you answer this question<br>'},{fieldtype:'Link',fieldname:'profile1',label:'1st User',options:'Profile'},{fieldtype:'Link',fieldname:'profile2',label:'2nd User',options:'Profile'},{fieldtype:'Link',fieldname:'profile3',label:'3rd User',options:'Profile'},{fieldtype:'Button',fieldname:'ask',label:'Add the Question'}]});this.dialog.fields_dict.ask.input.onclick=function(){me.dialog.hide();me.add_question(values(me.dialog.get_values()));}
+this.dialog.show();}
+this.add_question=function(suggest_list){$c_page('knowledge_base','questions','add_question',{question:this.search.value,suggest:suggest_list},function(r,rt){$(me.search).val('').blur();me.run();})}
+this.make_tag_filter_area=function(){this.tag_filters=$a(w,'div','kb-tag-filter-area');$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'},'<i>Showing for:</i>');this.tag_area=$a(this.tag_filters,'span');}
+this.make_list=function(){this.make_tag_filter_area();this.list_area=$a(w,'div','',{marginRight:'13px'})
+this.no_result=$a(w,'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
+this.list=new wn.widgets.Listing({parent:this.list_area,no_results_message:'No questions found. Ask a new question!',as_dict:1,get_query:function(){var v=me.search.value==$(me.search).attr('default_text')?'':me.search.value;cond=v?(' and t1.question like "%'+v+'%"'):'';if(me.tag_filter_dict){for(f in me.tag_filter_dict){cond+=' and t1.`_user_tags` like "%'+f+'%"'}}
+return repl('select t1.name, t1.owner, t1.question, t1.points, t1.modified, t1._user_tags, '
++'t1._users_voted, t2.first_name, t2.last_name '
++'from tabQuestion t1, tabProfile t2 '
++'where t1.docstatus!=2 '
++'and t1.owner = t2.name'
++'%(cond)s order by t1.modified desc',{user:user,cond:cond})},render_row:function(parent,data,listing){new KBQuestion(parent,data,me);}});this.list.run();}
+this.set_tag_filter=function(tag){if(in_list(keys(me.tag_filter_dict),tag.label))return;var filter_tag=new SingleTag({parent:me.tag_area,label:tag.label,dt:'Question',color:tag.color});filter_tag.remove=function(tag_remove){$(tag_remove.body).fadeOut();delete me.tag_filter_dict[tag_remove.label];if(!keys(me.tag_filter_dict).length){$(me.tag_filters).slideUp();}
+me.run();}
+me.tag_filter_dict[tag.label]=filter_tag;$ds(me.tag_filters);me.run();}
+this.run=function(){this.list.run();}
+this.make_search_bar();this.make_list();}
+KBQuestion=function(parent,det,kb){this.make=function(){this.wrapper=$a(parent,'div','kb-question-wrapper');this.q_area=$a($a(this.wrapper,'div'),'h3','kb-questions link_type',{display:'inline',textDecoration:'none'},det.question);this.q_area.onclick=function(){var q=this;window.location.href='#!question-view/'+q.id;}
+this.q_area.id=det.name;this.q_area.txt=det.question;new KBItemToolbar({parent:this.wrapper,det:det,with_tags:1,doctype:'Question'},kb)}
+this.make()}
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.css b/knowledge_base/page/questions/questions.css
new file mode 100644
index 0000000..b8a80c4
--- /dev/null
+++ b/knowledge_base/page/questions/questions.css
@@ -0,0 +1,29 @@
+div.kb-search-wrapper textarea {
+	height: 2.2em;
+	width: 80%;
+	font-size: 14px;
+	padding: 3px;
+	margin-bottom: 7px;
+}
+
+.kb-question-wrapper {
+	border-bottom: 1px solid #AAA;
+	padding-bottom: 3px;
+	margin-bottom: 3px;
+}
+
+.kb-questions {
+	color: #000;
+}
+
+.kb-question-details {
+	margin: 11px 0px 11px 29px;
+}
+
+.kb-tag-filter-area {
+	padding: 7px;
+	background-color: #F2F2E8;
+	color: #222;
+	margin: 7px 0px;
+	display: none;
+}
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.html b/knowledge_base/page/questions/questions.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/questions/questions.html
diff --git a/knowledge_base/page/questions/questions.js b/knowledge_base/page/questions/questions.js
new file mode 100644
index 0000000..993a38e
--- /dev/null
+++ b/knowledge_base/page/questions/questions.js
@@ -0,0 +1,206 @@
+pscript.onload_questions = function() {
+	var w = page_body.pages['questions'];
+	
+	var tab = make_table(w, 1, 2, '100%', ['75%', '25%'], {});
+	var body = $a($td(tab,0,0),'div','layout_wrapper');
+
+	new PageHeader(body, 'Knowledge Base');
+
+	// kb
+	var kb = new KnowledgeBase(body);
+	
+	// sidebar
+	$y($td(tab, 0, 1), {paddingTop:'53px'});
+	this.sidebar = new wn.widgets.PageSidebar($td(tab, 0, 1), {
+		sections: [
+			{
+				title: 'Top Tags',
+				render: function(body) {
+					new wn.widgets.TagCloud(body, 'Question', function(tag) { kb.set_tag_filter(tag) });
+				}				
+			}
+		]
+	});
+	set_title('Knowledge Base');
+}
+
+// knowledge base object
+// has a box for search or ask a question
+// and list of top rated search results
+//
+function KnowledgeBase(w) {
+	var me = this;
+	this.sort_by = 'modified';
+	this.tag_filter_dict = {};
+	
+	this.make_search_bar = function() {
+		this.search = $a($a(w,'div','kb-search-wrapper'), 'textarea');
+
+		$(this.search).add_default_text('Enter keywords or a new Question');
+		
+		var div = $a(w,'div','kb-btn-wrapper');
+		$btn(div, 'Search', function() { me.run() }, {fontSize:'14px'});
+		$btn(div, 'Ask', function() { me.ask() }, {fontSize:'14px'});
+	}
+	
+	// ask a new question
+	this.ask = function() {
+		if(this.search.value==$(this.search).attr('default_text')) {
+			msgprint('Please enter some text'); return;
+		}
+		this.suggest();
+	}
+	
+	// suggest a few users who can answer
+	this.suggest = function() {
+		this.dialog = new wn.widgets.Dialog({
+			title: 'Suggest a users',
+			width: 400,
+			fields: [
+				{fieldtype:'HTML', options:'Optional: Suggest a few users who can help you answer this question<br>'},
+				{fieldtype:'Link', fieldname:'profile1', label:'1st User',options:'Profile'},
+				{fieldtype:'Link', fieldname:'profile2', label:'2nd User',options:'Profile'},
+				{fieldtype:'Link', fieldname:'profile3', label:'3rd User',options:'Profile'},
+				{fieldtype:'Button', fieldname:'ask', label:'Add the Question'}
+			]
+		});
+		this.dialog.fields_dict.ask.input.onclick = function() {
+			me.dialog.hide();
+			me.add_question(values(me.dialog.get_values()));
+		}
+		this.dialog.show();
+	}
+	
+	// add a new question to the database
+	this.add_question = function(suggest_list) {
+		$c_page('knowledge_base', 'questions', 'add_question', {
+			question: this.search.value,
+			suggest: suggest_list
+		}, function(r,rt) {
+			$(me.search).val('').blur();
+			me.run();
+		})
+	}
+	
+	// where tags that filter will be displayed
+	this.make_tag_filter_area = function() {
+		this.tag_filters = $a(w, 'div', 'kb-tag-filter-area');
+		$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'}, '<i>Showing for:</i>');
+		this.tag_area = $a(this.tag_filters, 'span');
+	}
+	
+	// make a list of questions
+	this.make_list = function() {
+		this.make_tag_filter_area();
+		this.list_area = $a(w, 'div', '', {marginRight:'13px'})
+		this.no_result = $a(w, 'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
+
+		this.list = new wn.widgets.Listing({
+			parent: this.list_area,
+			no_results_message: 'No questions found. Ask a new question!',
+			as_dict: 1,
+			get_query: function() {
+				
+				// filter by search string
+				var v = me.search.value==$(me.search).attr('default_text') ? '' : me.search.value;
+				cond = v ? (' and t1.question like "%'+v+'%"') : '';
+				
+				// filter by tags
+				if(me.tag_filter_dict) {
+					for(f in me.tag_filter_dict) {
+						cond += ' and t1.`_user_tags` like "%' + f + '%"'
+					}
+				}
+				return repl('select t1.name, t1.owner, t1.question, t1.points, t1.modified, t1._user_tags, '
+				+'t1._users_voted, t2.first_name, t2.last_name '
+				+'from tabQuestion t1, tabProfile t2 '
+				+'where t1.docstatus!=2 '
+				+'and t1.owner = t2.name'
+				+'%(cond)s order by t1.modified desc', {user:user, cond: cond})
+			},
+			render_row: function(parent, data, listing) {
+				new KBQuestion(parent, data, me);
+			}
+		});
+		
+		this.list.run();
+
+	}
+
+	// add a tag filter to the search in the
+	// main page
+	this.set_tag_filter = function(tag) {
+
+		// check if exists
+		if(in_list(keys(me.tag_filter_dict), tag.label)) return;
+
+		// create a tag in filters
+		var filter_tag = new SingleTag({
+			parent: me.tag_area,
+			label: tag.label,
+			dt: 'Question',
+			color: tag.color
+		});
+
+		// remove tag from filters
+		filter_tag.remove = function(tag_remove) {
+			$(tag_remove.body).fadeOut();
+			delete me.tag_filter_dict[tag_remove.label];
+
+			// hide everything?
+			if(!keys(me.tag_filter_dict).length) {
+				$(me.tag_filters).slideUp(); // hide
+			}
+
+			// run
+			me.run();
+		}
+
+		// add to dict
+		me.tag_filter_dict[tag.label] = filter_tag;
+		$ds(me.tag_filters);
+
+		// run
+		me.run();
+	}	
+	this.run = function() {
+		this.list.run();
+	}
+
+	this.make_search_bar();
+	this.make_list();
+	
+}
+
+// single kb question
+// "question
+//  points | tag list"
+
+KBQuestion = function(parent, det, kb) {
+	
+	this.make = function() {
+		this.wrapper = $a(parent, 'div', 'kb-question-wrapper');
+		this.q_area = $a($a(this.wrapper, 'div'), 'h3', 'kb-questions link_type', {display:'inline', textDecoration:'none'}, det.question);
+
+		this.q_area.onclick = function() {
+			var q = this;
+			window.location.href = '#!question-view/' + q.id;
+			//loadpage('question-view', function() { pscript.question_view(q.id, q.txt) })
+		}
+		
+		this.q_area.id = det.name; this.q_area.txt = det.question;
+
+		new KBItemToolbar({
+			parent: this.wrapper,
+			det: det,
+			with_tags: 1,
+			doctype: 'Question'
+		}, kb)
+		
+	}
+	
+
+	this.make()
+}
+
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.py b/knowledge_base/page/questions/questions.py
new file mode 100644
index 0000000..d87579f
--- /dev/null
+++ b/knowledge_base/page/questions/questions.py
@@ -0,0 +1,37 @@
+import webnotes
+
+from webnotes.utils import load_json, cint, cstr
+
+# add a new question
+def add_question(arg):
+	args = load_json(arg)
+	
+	from webnotes.model.doc import Document
+	d = Document('Question')
+	d.question = args['question'].title()
+	d.points = 1
+	d.save(1)
+	
+	if args['suggest']:
+		from my_company.page.my_company.my_company import post_comment
+		for s in args['suggest']:
+			if s:
+				post_comment({
+					'uid': s,
+					'comment': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question,
+					'notify': 1
+				})
+	
+	
+def vote(arg):
+	args = load_json(arg)
+	
+	res = webnotes.conn.sql("select points, _users_voted from `tab%s` where name=%s" % (args['dt'], '%s'), args['dn'])[0]
+	p = cint(res[0])
+	p = args['vote']=='up' and p+1 or p-1
+	
+	# update
+	webnotes.conn.sql("update `tab%s` set points=%s, _users_voted=%s where name=%s" % (args['dt'], '%s', '%s', '%s'), \
+		(p, cstr(res[1]) + ',' + webnotes.user.name, args['dn']))
+	
+	return p
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.txt b/knowledge_base/page/questions/questions.txt
new file mode 100644
index 0000000..22cc3ed
--- /dev/null
+++ b/knowledge_base/page/questions/questions.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-05-09 11:04:37',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-03-29 13:53:57',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Questions',
+		'owner': 'Administrator',
+		'page_name': 'Questions',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file
diff --git a/maintenance/Module Def/Maintenance/Maintenance.txt b/maintenance/Module Def/Maintenance/Maintenance.txt
new file mode 100644
index 0000000..034f6a6
--- /dev/null
+++ b/maintenance/Module Def/Maintenance/Maintenance.txt
@@ -0,0 +1,407 @@
+[
+	{
+		'_last_update': '1300959286',
+		'creation': '2010-11-30 22:41:00',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'module_desc': '<p>Manage maintenance quotes, orders, schedule etc.</p>',
+		'module_icon': 'Maintenance.gif',
+		'module_label': 'Support',
+		'module_name': 'Maintenance',
+		'module_page': None,
+		'module_seq': 8,
+		'name': 'Maintenance',
+		'owner': 'nabin@webnotestech.com',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Forms',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003015',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'Warranty/AMC Summary',
+		'doc_name': 'Serial No',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003022',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'AMC Summary',
+		'doc_name': 'Serial No',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003023',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:41:00',
+		'description': 'A unique number identifying each entity of an item',
+		'display_name': 'Serial No',
+		'doc_name': 'Serial No',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'item_code\nstatus\npr_no\ndelivery_note_no\ncustomer',
+		'hide': 0,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00137',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:41:00',
+		'description': 'Create schedule based on maintenance order',
+		'display_name': 'Maintenance Schedule',
+		'doc_name': 'Maintenance Schedule',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\ncustomer\nsales_order_no',
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00138',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': "Database of Support Ticket's raised by Customers",
+		'display_name': 'Support Ticket',
+		'doc_name': 'Support Ticket',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nopening_date\ncustomer\nallocated_to',
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003019',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:41:00',
+		'description': 'Database of issues raised your Customers',
+		'display_name': 'Customer Issue',
+		'doc_name': 'Customer Issue',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ncomplaint_date\ncustomer\nallocated_to\nallocated_on',
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00139',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': 'Create schedule based on maintenance order',
+		'display_name': 'Maintenance Schedule',
+		'doc_name': 'Maintenance Schedule',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\ncustomer\nsales_order_no',
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003017',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:41:00',
+		'description': None,
+		'display_name': 'Maintenance Visit',
+		'doc_name': 'Maintenance Visit',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nmntc_date\ncustomer\nmaintenance_type\ncompletion_status',
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00140',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': 'Database of issues raised your Customers',
+		'display_name': 'Customer Issue',
+		'doc_name': 'Customer Issue',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ncomplaint_date\ncustomer\nallocated_to\nallocated_on',
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003016',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'Maintenance Visit',
+		'doc_name': 'Maintenance Visit',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nmntc_date\ncustomer\nmaintenance_type\ncompletion_status',
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003018',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Reports',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 12,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003020',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': 'List of all scheduled mainteance. You can filter by sales person, date, serial no etc. ',
+		'display_name': 'Maintenance Schedule Details',
+		'doc_name': 'Maintenance Schedule Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 13,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003024',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': 'List of all issues raised by customer',
+		'display_name': 'Customer Issues',
+		'doc_name': 'Customer Issue',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 14,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003025',
+		'owner': 'Administrator',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'Warranty/AMC Summary',
+		'doc_name': 'Serial No',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 15,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003021',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 12:00:50',
+		'description': None,
+		'display_name': 'Maintenance Orderwise Pending Amount To Bill',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 16,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': '000003026',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 22:41:00',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDR00031',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-11-30 22:41:00',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDR00032',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Maintenance User'
+	},
+	{
+		'creation': '2010-11-30 22:41:00',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2011-03-24 15:08:46',
+		'modified_by': 'Administrator',
+		'name': 'MDR00033',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Maintenance',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Maintenance Manager'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/__init__.py b/maintenance/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/__init__.py
diff --git a/maintenance/doctype/__init__.py b/maintenance/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/__init__.py
diff --git a/maintenance/doctype/customer_issue/__init__.py b/maintenance/doctype/customer_issue/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/customer_issue/__init__.py
diff --git a/maintenance/doctype/customer_issue/customer_issue.js b/maintenance/doctype/customer_issue/customer_issue.js
new file mode 100644
index 0000000..8d62568
--- /dev/null
+++ b/maintenance/doctype/customer_issue/customer_issue.js
@@ -0,0 +1,116 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  if(!doc.status) set_multiple(dt,dn,{status:'Open'});  
+  if(doc.__islocal){    
+    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+  }   
+}
+
+cur_frm.cscript.refresh = function(doc,ct,cdn){
+  if(!doc.docstatus) hide_field('Make Maintenance Visit');
+  else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('Make Maintenance Visit');
+}
+
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+
+
+
+cur_frm.cscript['Make Maintenance Visit'] = function(doc, cdt, cdn) {
+  if (doc.docstatus == 1) { 
+    $c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
+      function(r,rt){
+        if(r.message == 'No'){
+          n = createLocal("Maintenance Visit");
+          $c('dt_map', args={
+                  'docs':compress_doclist([locals["Maintenance Visit"][n]]),
+                  'from_doctype':'Customer Issue',
+                  'to_doctype':'Maintenance Visit',
+                  'from_docname':doc.name,
+            'from_to_list':"[['Customer Issue', 'Maintenance Visit'], ['Customer Issue', 'Maintenance Visit Detail']]"
+          }
+          , function(r,rt) {
+            loaddoc("Maintenance Visit", n);
+          }
+          );
+        }
+        else{
+          msgprint("You have already completed maintenance against this Customer Issue");
+        }
+      }
+    );
+  }
+}
+
+// ----------
+// serial no
+// ----------
+
+cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) {
+  var cond = '';
+  if(doc.item_code) cond = ' AND `tabSerial No`.item_code = "'+ doc.item_code +'"';
+  return 'SELECT `tabSerial No`.name, `tabSerial No`.description FROM `tabSerial No` WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name LIKE "%s" '+cond+' ORDER BY `tabSerial No`.name ASC LIMIT 50';
+}
+
+cur_frm.add_fetch('serial_no', 'item_code', 'item_code');
+cur_frm.add_fetch('serial_no', 'item_name', 'item_name');
+cur_frm.add_fetch('serial_no', 'description', 'description');
+cur_frm.add_fetch('serial_no', 'maintenance_status', 'warranty_amc_status');
+cur_frm.add_fetch('serial_no', 'warranty_expiry_date', 'warranty_expiry_date');
+cur_frm.add_fetch('serial_no', 'amc_expiry_date', 'amc_expiry_date');
+cur_frm.add_fetch('serial_no', 'customer', 'customer');
+cur_frm.add_fetch('serial_no', 'customer_name', 'customer_name');
+cur_frm.add_fetch('serial_no', 'delivery_address', 'customer_address');
+
+// ----------
+// item code
+// ----------
+cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
+  if(doc.serial_no){
+    return 'SELECT `tabSerial No`.item_code, `tabSerial No`.description FROM `tabSerial No` WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name = "'+ doc.serial_no +'" AND `tabSerial No`.item_code LIKE "%s" ORDER BY `tabSerial No`.item_code ASC LIMIT 50';
+  }
+  else{
+    return 'SELECT `tabItem`.name, `tabItem`.item_name, `tabItem`.description FROM `tabItem` WHERE `tabItem`.docstatus != 2 AND `tabItem`.name LIKE "%s" ORDER BY `tabItem`.name ASC LIMIT 50';
+  }
+}
+
+cur_frm.add_fetch('item_code', 'item_name', 'item_name');
+cur_frm.add_fetch('item_code', 'description', 'description');
+
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
diff --git a/maintenance/doctype/customer_issue/customer_issue.py b/maintenance/doctype/customer_issue/customer_issue.py
new file mode 100644
index 0000000..db63cc2
--- /dev/null
+++ b/maintenance/doctype/customer_issue/customer_issue.py
@@ -0,0 +1,98 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.prefix = is_testing and 'test' or 'tab'
+    
+  def autoname(self):
+    #self.doc.name = make_autoname('CI/' + self.doc.fiscal_year + '/.######')
+    self.doc.name = make_autoname(self.doc.naming_series + '.######')
+
+  #def get_customer_details(self):
+  #  details = sql("select address, territory, customer_group, customer_name from `tabCustomer` where name = '%s' and docstatus != 2" %(self.doc.customer), as_dict = 1)
+  #  if details:
+  #    ret = {
+  #      'customer_address'  :  details and details[0]['address'] or '',
+  #      'customer_name'  :  details and details[0]['customer_name'] or '',
+  #      'territory'       :  details and details[0]['territory'] or '',
+  #      'customer_group'    :  details and details[0]['customer_group'] or ''
+  #    }
+  #    # ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
+  #    contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer_name = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(self.doc.customer), as_dict = 1)
+  #    ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
+  #    ret['contact_no']     = contact_det and contact_det[0]['contact_no'] or ''
+  #    ret['email_id']       = contact_det and contact_det[0]['email_id'] or ''
+  #  
+  #    return cstr(ret)
+  #  else:
+  #    msgprint("Customer : %s does not exist in system." % (name))
+  #    raise Exception
+
+  # Get customer's contact person details
+  # ==============================================================
+  #def get_contact_details(self):
+  #  contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc.contact_person, self.doc.customer), as_dict = 1)
+  #  ret = {
+  #    'contact_no'       :    contact and contact[0]['contact_no'] or '',
+  #    'email_id'         :    contact and contact[0]['email_id'] or ''
+  #  }
+  #  return str(ret)
+    
+    
+#check if maintenance schedule already generated
+#============================================
+  def check_maintenance_visit(self):
+    nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
+    nm = nm and nm[0][0] or ''
+    
+    if not nm:
+      return cstr('No')    
+  
+  def on_submit(self):
+    if session['user'] != 'Guest':
+      if not self.doc.allocated_to:
+        msgprint("Please select service person name whom you want to assign this issue")
+        raise Exception
+  
+  def validate(self):
+    if session['user'] != 'Guest' and not self.doc.customer:
+      msgprint("Please select Customer from whom issue is raised")
+      raise Exception
+    #if not self.doc.email_id and not self.doc.contact_no:
+    #  msgprint("Please specify contact no. and/or email_id")
+    #  raise Exception
+    #elif self.doc.email_id and not validate_email_add(self.doc.email_id.strip(' ')):
+    #  msgprint('error:%s is not a valid email id' % self.doc.email_id)
+    #  raise Exception
+  
+  def on_cancel(self):
+    lst = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t2.prevdoc_docname = '%s' and  t1.docstatus!=2"%(self.doc.name))
+    if lst:
+      lst1 = ','.join([x[0] for x in lst])
+      msgprint("Maintenance Visit No. "+lst1+" already created against this customer issue. So can not be Cancelled")
+      raise Exception
+    else:
+      set(self.doc, 'status', 'Cancelled')
+
+  def on_update(self):
+    pass
diff --git a/maintenance/doctype/customer_issue/customer_issue.txt b/maintenance/doctype/customer_issue/customer_issue.txt
new file mode 100644
index 0000000..9fd47bf
--- /dev/null
+++ b/maintenance/doctype/customer_issue/customer_issue.txt
@@ -0,0 +1,1696 @@
+[
+	{
+		'_last_update': '1306307676',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'Customer Issue',
+		'name_case': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status,customer,customer_name,allocated_to,allocated_on, territory',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 96
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-10-07 12:49:37',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00694',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Guest',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00162',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00163',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00164',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00165',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00166',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00167',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Customer Issue',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000319',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-24 17:12:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 0,
+		'label': 'Series',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL04128',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': '\nCI/2010-2011/',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': 'Open',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00866',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nOpen\nClosed\nWork In Progress\nCancelled',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'complaint_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Issue Date',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00867',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'complaint_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'complaint_raised_by',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Raised By',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00869',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'complaint_raised_by',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-06 17:24:38',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_company',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'From Company',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL03954',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'from_company',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'service_address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Service Address',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00870',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'service_address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000320',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL03779',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001053',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001054',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Contact',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001055',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001056',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001057',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001058',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 12:06:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001059',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00875',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-18 11:46:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Customer Group',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000001052',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00876',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00868',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00877',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00878',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Issue Details',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000321',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Serial No',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000313',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Serial No',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00880',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': 'eval:doc.item_code',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Item Name',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00881',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': 'eval:doc.item_code',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00882',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'complaint',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Issue',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00883',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'complaint',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000322',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warranty_amc_status',
+		'fieldtype': 'Select',
+		'hidden': 0,
+		'icon': None,
+		'idx': 30,
+		'in_filter': 1,
+		'label': 'Warranty / AMC Status',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000315',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warranty_expiry_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Warranty Expiry Date',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000316',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amc_expiry_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'AMC Expiry Date',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000317',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'allocated_on',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': 1,
+		'label': 'Allocated On',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00885',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'allocated_on',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'allocated_to',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': 1,
+		'label': 'Allocated To',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00886',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'allocated_to',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Person',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Resolution Detail',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000323',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resolution_details',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Resolution Details',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00888',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'resolution_details',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000324',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resolution_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': 1,
+		'label': 'Resolution Date',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00890',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'resolution_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resolved_by',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': 1,
+		'label': 'Resolved By',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00891',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'resolved_by',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Person',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2011-04-18 13:55:57',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Next Steps',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': '000000325',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Make Maintenance Visit',
+		'modified': '2011-05-27 18:30:14',
+		'modified_by': 'Administrator',
+		'name': 'FL00893',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Customer Issue',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/maintenance/doctype/item_maintenance_detail/__init__.py b/maintenance/doctype/item_maintenance_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/item_maintenance_detail/__init__.py
diff --git a/maintenance/doctype/item_maintenance_detail/item_maintenance_detail.txt b/maintenance/doctype/item_maintenance_detail/item_maintenance_detail.txt
new file mode 100644
index 0000000..e2521c3
--- /dev/null
+++ b/maintenance/doctype/item_maintenance_detail/item_maintenance_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-08 15:46:00', 'search_fields': None, 'module': 'Maintenance', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'IMD.#####', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Item Maintenance Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01975', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01976', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01977', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'start_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Start Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01978', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'start_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'end_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'End Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01979', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'end_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'periodicity', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Periodicity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01980', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'periodicity', 'fieldtype': 'Select', 'options': '\nWeekly\nMonthly\nQuarterly\nHalf Yearly\nYearly\nRandom', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'no_of_visits', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'No of Visits', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01981', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'no_of_visits', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'incharge_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Incharge Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01982', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'incharge_name', 'fieldtype': 'Link', 'options': 'Sales Person', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'serial_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Serial No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01983', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'serial_no', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Against Docname', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Item Maintenance Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01984', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/maintenance/doctype/maintenance_schedule/__init__.py b/maintenance/doctype/maintenance_schedule/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/maintenance_schedule/__init__.py
diff --git a/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
new file mode 100644
index 0000000..d284c4c
--- /dev/null
+++ b/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
@@ -0,0 +1,117 @@
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
+  
+  if(doc.__islocal){
+    set_multiple(dt,dn,{transaction_date:get_today()});
+    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+  }   
+}
+
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+//
+cur_frm.fields_dict['item_maintenance_detail'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
+  return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+}
+
+// Get Items based on SO Selected
+cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+  var callback = function(r,rt) { 
+	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	  cur_frm.refresh();
+  }
+  get_server_fields('pull_sales_order_detail','','',doc, dt, dn,1,callback);
+}
+
+
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+  var fname = cur_frm.cscript.fname;
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1);
+  }
+}
+
+/*
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+}
+
+
+cur_frm.cscript.customer = function(doc, cdt, cdn) {
+  get_server_fields('get_customer_details','','',doc, cdt, cdn, 1);
+}
+*/
+
+cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
+  doc = locals[this.doctype][this.docname];
+  var cond = '';
+  if(doc.customer) {
+    cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
+  }
+  return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Detail`.parent = `tabSales Order`.name AND `tabSales Order Detail`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+}
+
+cur_frm.cscript.periodicity = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  if(d.start_date && d.end_date){
+    arg = {}
+    arg.start_date = d.start_date;
+    arg.end_date = d.end_date;
+    arg.periodicity = d.periodicity;
+    get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1);
+  }
+  else{
+    msgprint("Please enter Start Date and End Date");
+  }
+}
+
+cur_frm.cscript['Generate Schedule'] = function(doc, cdt, cdn) {
+  if (!doc.__islocal) {
+    $c('runserverobj', args={'method':'generate_schedule', 'docs':compress_doclist(make_doclist(cdt,cdn))},
+      function(r,rt){
+        refresh_field('maintenance_schedule_detail');
+      }
+    );
+  } else {
+    alert("Please save the document before generating maintenance schedule");
+  }  
+}
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
diff --git a/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
new file mode 100644
index 0000000..0d6ef80
--- /dev/null
+++ b/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -0,0 +1,302 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  # pull sales order details
+  #--------------------------
+  def pull_sales_order_detail(self):
+    self.doc.clear_table(self.doclist, 'item_maintenance_detail')
+    self.doc.clear_table(self.doclist, 'maintenance_schedule_detail')
+    self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule').dt_map('Sales Order', 'Maintenance Schedule', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Schedule'],['Sales Order Detail', 'Item Maintenance Detail']]")
+  
+  #pull item details 
+  #-------------------
+  def get_item_details(self, item_code):
+    item = sql("select item_name, description from `tabItem` where name = '%s'" %(item_code), as_dict=1)
+    ret = {
+      'item_name': item and item[0]['item_name'] or '',
+      'description' : item and item[0]['description'] or ''
+    }
+    return str(ret)
+  
+  #pull customer details
+  #-------------------------
+  #def get_customer_details(self):
+  #  det = sql("select t1.customer_name,t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = %s and t1.name=t2.customer and t2.is_primary_contact = 'Yes'", self.doc.customer, as_dict=1)
+  #  
+  #  ret = {
+  #    'customer_name':  det and det[0]['customer_name'] or '',
+  #    'address'  :  det and det[0]['address'] or '',
+  #    'territory':  det and det[0]['territory'] or '',
+  #    'contact_person' : det and det[0]['contact_name'] or ''
+  #  }
+  #  return str(ret)
+  
+  # generate maintenance schedule
+  #-------------------------------------
+  def generate_schedule(self):
+    import datetime
+    self.doc.clear_table(self.doclist, 'maintenance_schedule_detail')
+    count = 0
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      self.validate_maintenance_detail()
+      s_list =[]
+      s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits)
+      
+      for i in range(d.no_of_visits):        
+        child = addchild(self.doc,'maintenance_schedule_detail','Maintenance Schedule Detail',1,self.doclist)
+        child.item_code = d.item_code
+        child.scheduled_date = s_list[i].strftime('%Y-%m-%d')
+        if d.serial_no:
+          child.serial_no = d.serial_no
+        child.idx = count
+        count = count+1
+        child.incharge_name = d.incharge_name
+        child.save(1)
+    self.on_update()
+  
+  #get schedule dates
+  #----------------------
+  def create_schedule_list(self, start_date, end_date, no_of_visit):
+    schedule_list = []    
+    start_date1 = start_date
+    date_diff = (getdate(end_date) - getdate(start_date)).days
+    add_by = date_diff/no_of_visit
+    #schedule_list.append(start_date1)
+    while(getdate(start_date1) < getdate(end_date)):
+      start_date1 = add_days(start_date1, add_by)
+      if len(schedule_list) < no_of_visit:
+        schedule_list.append(getdate(start_date1))
+    return schedule_list
+  
+  #validate date range and periodicity selected
+  #-------------------------------------------------
+  def validate_period(self, arg):
+    arg1 = eval(arg)
+    if getdate(arg1['start_date']) >= getdate(arg1['end_date']):
+      msgprint("Start date should be less than end date ")
+      raise Exception
+    
+    period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1
+    
+    if (arg1['periodicity']=='Yearly' or arg1['periodicity']=='Half Yearly' or arg1['periodicity']=='Quarterly') and period<365:
+      msgprint(cstr(arg1['periodicity'])+ " periodicity can be set for period of atleast 1 year or more only")
+      raise Exception
+    elif arg1['periodicity']=='Monthly' and period<30:
+      msgprint("Monthly periodicity can be set for period of atleast 1 month or more")
+      raise Exception
+    elif arg1['periodicity']=='Weekly' and period<7:
+      msgprint("Weekly periodicity can be set for period of atleast 1 week or more")
+      raise Exception
+  
+  #get count on the basis of periodicity selected
+  #----------------------------------------------------
+  def get_no_of_visits(self, arg):
+    arg1 = eval(arg)
+    start_date = arg1['start_date']
+    
+    self.validate_period(arg)
+    period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1
+    
+    count =0
+    if arg1['periodicity'] == 'Weekly':
+      count = period/7
+    elif arg1['periodicity'] == 'Monthly':
+      count = period/30
+    elif arg1['periodicity'] == 'Quarterly':
+      count = period/91   
+    elif arg1['periodicity'] == 'Half Yearly':
+      count = period/182
+    elif arg1['periodicity'] == 'Yearly':
+      count = period/365
+    
+    ret = {'no_of_visits':count}
+    return str(ret)
+  
+  def validate_maintenance_detail(self):
+    if not getlist(self.doclist, 'item_maintenance_detail'):
+      msgprint("Please enter Maintaince Details first")
+      raise Exception
+    
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if not d.item_code:
+        msgprint("Please select item code")
+        raise Exception
+      elif not d.start_date or not d.end_date:
+        msgprint("Please select Start Date and End Date for item "+d.item_code)
+        raise Exception
+      elif not d.no_of_visits:
+        msgprint("Please mention no of visits required")
+        raise Exception
+      elif not d.incharge_name:
+        msgprint("Please select Incharge Person's name")
+        raise Exception
+      
+      if getdate(d.start_date) >= getdate(d.end_date):
+        msgprint("Start date should be less than end date for item "+d.item_code)
+        raise Exception
+  
+  #check if maintenance schedule already created against same sales order
+  #-----------------------------------------------------------------------------------
+  def validate_sales_order(self):
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.prevdoc_docname:
+        chk = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", d.prevdoc_docname)
+        if chk:
+          msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist")
+          raise Exception
+  
+  # Validate values with reference document
+  #----------------------------------------
+  def validate_reference_value(self):
+    get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule', with_children = 1).validate_reference_value(self, self.doc.name)
+  
+  def validate_serial_no(self):
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      cur_s_no=[]      
+      if d.serial_no:
+        cur_serial_no = d.serial_no.replace(' ', '')
+        cur_s_no = cur_serial_no.split(',')
+        
+        for x in cur_s_no:
+          chk = sql("select name, status from `tabSerial No` where docstatus!=2 and name=%s", (x))
+          chk1 = chk and chk[0][0] or ''
+          status = chk and chk[0][1] or ''
+          
+          if not chk1:
+            msgprint("Serial no "+x+" does not exist in system.")
+            raise Exception
+          else:
+            if status=='In Store' or status=='Note in Use' or status=='Scrapped':
+              msgprint("Serial no "+x+" is '"+status+"'")
+              raise Exception
+  
+  def validate(self):
+    self.validate_maintenance_detail()
+    self.validate_sales_order()
+    if self.doc.sales_order_no:
+      self.validate_reference_value()
+    self.validate_serial_no()
+    self.validate_start_date()
+  
+  # validate that maintenance start date can not be before serial no delivery date
+  #-------------------------------------------------------------------------------------------
+  def validate_start_date(self):
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.serial_no:
+        cur_serial_no = d.serial_no.replace(' ', '')
+        cur_s_no = cur_serial_no.split(',')
+        
+        for x in cur_s_no:
+          dt = sql("select delivery_date from `tabSerial No` where name = %s", x)
+          dt = dt and dt[0][0] or ''
+          
+          if dt:
+            if dt > getdate(d.start_date):
+              msgprint("Maintenance start date can not be before delivery date "+dt.strftime('%Y-%m-%d')+" for serial no "+x)
+              raise Exception
+  
+  #update amc expiry date in serial no
+  #------------------------------------------
+  def update_amc_date(self,serial_no,amc_end_date):
+    #get current list of serial no
+    cur_serial_no = serial_no.replace(' ', '')
+    cur_s_no = cur_serial_no.split(',')
+    
+    for x in cur_s_no:
+      sql("update `tabSerial No` set amc_expiry_date = '%s', maintenance_status = 'Under AMC' where name = '%s'"% (amc_end_date,x))
+  
+  def on_update(self):
+    set(self.doc, 'status', 'Draft')
+  
+  #validate that new maintenance start date does not clash with existing mntc end date
+  #-------------------------------------------------------------------------------------------------
+  def validate_serial_no_warranty(self):
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.serial_no:
+        dt = sql("select warranty_expiry_date, amc_expiry_date from `tabSerial No` where name = %s", d.serial_no, as_dict=1)
+        
+        if dt[0]['warranty_expiry_date']:
+          if dt[0]['warranty_expiry_date'] >= getdate(d.start_date):
+            msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under warranty till "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d')+". You can schedule AMC start date after "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d'))
+            raise Exception
+        if dt[0]['amc_expiry_date']:
+          if dt[0]['amc_expiry_date'] >= getdate(d.start_date):
+            msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under AMC till "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d')+". You can schedule new AMC start date after "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d'))
+            raise Exception
+  
+  #validate if schedule generated for all items
+  #-------------------------------------------------
+  def validate_schedule(self):
+    item_lst1 =[]
+    item_lst2 =[]
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.item_code not in item_lst1:
+        item_lst1.append(d.item_code)
+    
+    for m in getlist(self.doclist, 'maintenance_schedule_detail'):
+      if m.item_code not in item_lst2:
+        item_lst2.append(m.item_code)
+    
+    if len(item_lst1) != len(item_lst2):
+      msgprint("Maintenance Schedule is not generated for all the items. Please click on 'Generate Schedule'")
+      raise Exception
+    else:
+      for x in item_lst1:
+        if x not in item_lst2:
+          msgprint("Maintenance Schedule is not generated for item "+x+". Please click on 'Generate Schedule'")
+          raise Exception
+  
+  #check if serial no present in item maintenance table
+  #-----------------------------------------------------------
+  def check_serial_no_added(self):
+    serial_present =[]
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.serial_no:
+        serial_present.append(d.item_code)
+    
+    for m in getlist(self.doclist, 'maintenance_schedule_detail'):
+      if serial_present:
+        if m.item_code in serial_present and not m.serial_no:
+          msgprint("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code)
+          raise Exception
+  
+  def on_submit(self):
+    if not getlist(self.doclist, 'maintenance_schedule_detail'):
+      msgprint("Please click on 'Generate Schedule' to get schedule")
+      raise Exception
+    self.check_serial_no_added()
+    self.validate_serial_no_warranty()
+    self.validate_schedule()
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.serial_no:
+        self.update_amc_date(d.serial_no, d.end_date)
+    set(self.doc, 'status', 'Submitted')    
+
+  
+  def on_cancel(self):
+    for d in getlist(self.doclist, 'item_maintenance_detail'):
+      if d.serial_no:
+        self.update_amc_date(d.serial_no, '')
+    set(self.doc, 'status', 'Cancelled')
diff --git a/maintenance/doctype/maintenance_schedule/maintenance_schedule.txt b/maintenance/doctype/maintenance_schedule/maintenance_schedule.txt
new file mode 100644
index 0000000..4840d57
--- /dev/null
+++ b/maintenance/doctype/maintenance_schedule/maintenance_schedule.txt
@@ -0,0 +1,1051 @@
+[
+	{
+		'_last_update': '1305632624',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'MS.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 17:13:43',
+		'modified_by': 'Guest',
+		'module': 'Maintenance',
+		'name': 'Maintenance Schedule',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status,customer,customer_name, sales_order_no',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 155
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00338',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00339',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00340',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00341',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Customer Details',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05207',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05208',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL03793',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05200',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01900',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Name',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01898',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05201',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05202',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05203',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05204',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05209',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Transaction Date',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01905',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01904',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01906',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01907',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01902',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01901',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Customer Group',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05206',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05210',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 1,
+		'label': 'Sales Order No',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01908',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_order_no',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01909',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'pull_sales_order_detail',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_maintenance_detail',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Item Maintenance Detail',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01911',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_maintenance_detail',
+		'oldfieldtype': 'Table',
+		'options': 'Item Maintenance Detail',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Schedule',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL05211',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Generate Schedule',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01912',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'maintenance_schedule_detail',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Maintenance Schedule Detail',
+		'modified': '2011-05-25 12:44:53',
+		'modified_by': 'Guest',
+		'name': 'FL01914',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'maintenance_schedule_detail',
+		'oldfieldtype': 'Table',
+		'options': 'Maintenance Schedule Detail',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Schedule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/maintenance/doctype/maintenance_schedule_detail/__init__.py b/maintenance/doctype/maintenance_schedule_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/maintenance_schedule_detail/__init__.py
diff --git a/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt b/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
new file mode 100644
index 0000000..1825dfb
--- /dev/null
+++ b/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-08 15:46:00', 'search_fields': '', 'module': 'Maintenance', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'MSD.#####', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Maintenance Schedule Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Schedule Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01985', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Schedule Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01986', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'scheduled_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Scheduled Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Schedule Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01987', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'scheduled_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Date', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'actual_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Actual Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Schedule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01988', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'actual_date', 'fieldtype': 'Date', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'incharge_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Incharge Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Schedule Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01989', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'incharge_name', 'fieldtype': 'Link', 'options': 'Sales Person', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Small Text', 'creation': '2010-12-08 15:46:00', 'doctype': 'DocField', 'oldfieldname': 'serial_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Serial No', 'width': '160px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Schedule Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01990', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:00', 'parenttype': 'DocType', 'fieldname': 'serial_no', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/maintenance/doctype/maintenance_visit/__init__.py b/maintenance/doctype/maintenance_visit/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/maintenance_visit/__init__.py
diff --git a/maintenance/doctype/maintenance_visit/maintenance_visit.js b/maintenance/doctype/maintenance_visit/maintenance_visit.js
new file mode 100644
index 0000000..27b5a5f
--- /dev/null
+++ b/maintenance/doctype/maintenance_visit/maintenance_visit.js
@@ -0,0 +1,114 @@
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
+  if(doc.customer) cur_frm.cscript.customer(doc,cdt,cdn);
+    
+  if(doc.__islocal){
+    set_multiple(dt,dn,{mntc_date:get_today()});
+    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+  }   
+    
+  //if(doc.maintenance_type) cur_frm.cscript.maintenance_type(doc,cdt,cdn);
+}
+
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  }   
+
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+  var callback = function(r,rt) { 
+	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	  cur_frm.refresh();
+  }
+  get_server_fields('fetch_items','','',doc, dt, dn,1,callback);
+}
+
+
+/*
+cur_frm.cscript.maintenance_type = function(doc,cdt,cdn){
+  if(doc.maintenance_type == 'Scheduled') {
+    hide_field('sales_order_no');
+    hide_field('customer_issue_no');
+    hide_field('Get Items');
+    doc.customer_issue_no = '';
+    doc.sales_order_no = '';
+  }
+  else if(doc.maintenance_type == 'Unscheduled') {
+    unhide_field('sales_order_no');
+    hide_field('customer_issue_no');
+    unhide_field('Get Items');
+    doc.customer_issue_no = '';
+  }
+  else if(doc.maintenance_type == 'Breakdown') {
+    hide_field('sales_order_no');
+    unhide_field('customer_issue_no');
+    unhide_field('Get Items');
+    doc.sales_order_no = '';
+  }
+}*/
+
+cur_frm.fields_dict['maintenance_visit_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
+  return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+}
+
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+  var fname = cur_frm.cscript.fname;
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    get_server_fields('get_item_details',d.item_code, 'maintenance_visit_details',doc,cdt,cdn,1);
+  }
+}
+
+cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
+  doc = locals[this.doctype][this.docname];
+  var cond = '';
+  if(doc.customer) {
+    cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
+  }
+  //return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+  return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Detail`.parent = `tabSales Order`.name AND `tabSales Order Detail`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+}
+
+cur_frm.fields_dict['customer_issue_no'].get_query = function(doc) {
+  doc = locals[this.doctype][this.docname];
+  var cond = '';
+  if(doc.customer) {
+    cond = '`tabCustomer Issue`.customer = "'+doc.customer+'" AND';
+  }
+  return repl('SELECT `tabCustomer Issue`.name FROM `tabCustomer Issue` WHERE `tabCustomer Issue`.company = "%(company)s" AND %(cond)s `tabCustomer Issue`.docstatus = 1 AND (`tabCustomer Issue`.status = "Open" OR `tabCustomer Issue`.status = "Work In Progress") AND `tabCustomer Issue`.name LIKE "%s" ORDER BY `tabCustomer Issue`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+}
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
diff --git a/maintenance/doctype/maintenance_visit/maintenance_visit.py b/maintenance/doctype/maintenance_visit/maintenance_visit.py
new file mode 100644
index 0000000..203793c
--- /dev/null
+++ b/maintenance/doctype/maintenance_visit/maintenance_visit.py
@@ -0,0 +1,161 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  #get item details
+  #------------------
+  def get_item_details(self, item_code):
+    item = sql("select item_name,description from `tabItem` where name = '%s'" %(item_code), as_dict=1)
+    ret = {
+      'item_name' : item and item[0]['item_name'] or '',
+      'description' : item and item[0]['description'] or ''
+    }
+    return str(ret)
+  
+  #get customer details
+  #-----------------------
+  #def get_customer_details(self):
+  #  det = sql("select t1.customer_name,t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = %s and t1.name=t2.customer and t2.is_primary_contact = 'Yes'", self.doc.customer, as_dict=1)
+  #  
+  #  ret = {
+  #    'customer_name' :  det and det[0]['customer_name'] or '',
+  #    'address'  :  det and det[0]['address'] or '',
+  #    'territory':  det and det[0]['territory'] or '',
+  #    'contact_person' : det and det[0]['contact_name'] or ''
+  #  }
+  #  return str(ret)
+  
+  # fetch details of resp Sales order or customer issue
+  #-----------------------------------------------------------
+  def fetch_items(self):
+    if self.doc.sales_order_no and self.doc.customer_issue_no:
+      msgprint("You can not fetch details of both, Sales Order and Customer Issue, in same Maintenance Visit")
+      raise Exception
+    
+    self.doc.clear_table(self.doclist, 'maintenance_visit_details')
+    
+    if self.doc.sales_order_no:
+      self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Visit').dt_map('Sales Order', 'Maintenance Visit', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Visit'],['Sales Order Detail', 'Maintenance Visit Detail']]")
+    
+    elif self.doc.customer_issue_no:      
+      self.doclist = get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit').dt_map('Customer Issue', 'Maintenance Visit', self.doc.customer_issue_no, self.doc, self.doclist, "[['Customer Issue', 'Maintenance Visit'],['Customer Issue', 'Maintenance Visit Detail']]")
+  
+  #validate reference value using doctype mapper
+  #-----------------------------------------------------
+  def validate_reference_value(self, check_for):
+    if check_for == 'Sales Order':
+      get_obj('DocType Mapper', 'Sales Order-Maintenance Visit', with_children = 1).validate_reference_value(self, self.doc.name)
+    elif check_for == 'Customer Issue':
+      get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit', with_children = 1).validate_reference_value(self, self.doc.name)
+  
+  #check if serial no exist in system
+  #--------------------------------------
+  def validate_serial_no(self):
+    for d in getlist(self.doclist, 'maintenance_visit_details'):
+      if d.serial_no and not sql("select name from `tabSerial No` where name = '%s' and docstatus != 2" % d.serial_no):
+        msgprint("Serial No: "+ d.serial_no + " not exists in the system")
+        raise Exception
+      #elif not d.serial_no and d.item_code:
+      #  ser = sql("select has_serial_no from tabItem where name = '%s'" % d.item_code)
+      #  ser = ser and ser[0][0] or 'No'
+      #  if ser == 'Yes':
+      #    msgprint("Serial No is mandatory for item: " + d.item_code)
+      #    raise Exception
+  
+  def validate(self):
+    if not getlist(self.doclist, 'maintenance_visit_details'):
+      msgprint("Please enter maintenance details")
+      raise Exception
+    
+    for d in getlist(self.doclist, 'maintenance_visit_details'):
+      if d.prevdoc_doctype == 'Sales Order':
+        check_for = 'Sales Order'
+      elif d.prevdoc_doctype == 'Customer Issue':
+        check_for = 'Customer Issue'
+      else:
+        msgprint("Maintenance Visit must be created either against Sales Order or against Customer Issue")
+        raise Exception
+    
+    if check_for:
+      self.validate_reference_value(check_for)
+
+    self.validate_serial_no()
+  
+  def update_customer_issue(self, flag):
+    for d in getlist(self.doclist, 'maintenance_visit_details'):
+      if d.prevdoc_docname and d.prevdoc_doctype == 'Customer Issue' :
+        if flag==1:
+          mntc_date = self.doc.mntc_date
+          service_person = d.service_person
+          work_done = d.work_done
+          if self.doc.completion_status == 'Fully Completed':
+            status = 'Closed'
+          elif self.doc.completion_status == 'Partially Completed':
+            status = 'Work In Progress'
+        else:
+          nm = sql("select t1.name, t1.mntc_date, t2.service_person, t2.work_done from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t1.completion_status = 'Partially Completed' and t2.prevdoc_docname = %s and t1.name!=%s and t1.docstatus = 1 order by t1.name desc limit 1", (d.prevdoc_docname, self.doc.name))
+          
+          if nm:
+            status = 'Work In Progress'
+            mntc_date = nm and nm[0][1] or ''
+            service_person = nm and nm[0][2] or ''
+            work_done = nm and nm[0][3] or ''
+          else:
+            status = 'Open'
+            mntc_date = ''
+            service_person = ''
+            work_done = ''
+        
+        sql("update `tabCustomer Issue` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname))
+  
+  # check if last maintenance visit against same sales order/ customer issue
+  #-----------------------------------------------------------------------------------
+  def check_if_last_visit(self):
+    for d in getlist(self.doclist, 'maintenance_visit_details'):
+      if d.prevdoc_docname:
+        check_for_docname = d.prevdoc_docname
+        check_for_doctype = d.prevdoc_doctype
+    
+    if check_for_docname:
+      check = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.doc.name, check_for_docname, self.doc.mntc_date, self.doc.mntc_date, self.doc.mntc_time))
+      
+      if check:
+        check_lst = [x[0] for x in check]
+        check_lst =','.join(check_lst)
+        msgprint("To cancel this, you need to cancel Maintenance Visit(s) "+cstr(check_lst)+" created after this maintenance visit against same "+check_for_doctype)
+        raise Exception
+      else:
+        self.update_customer_issue(0)
+  
+  def on_submit(self):
+    self.update_customer_issue(1)    
+    set(self.doc, 'status', 'Submitted')
+  
+  def on_cancel(self):
+    self.check_if_last_visit()    
+    set(self.doc, 'status', 'Cancelled')
+
+  def on_update(self):
+    pass
+    
diff --git a/maintenance/doctype/maintenance_visit/maintenance_visit.txt b/maintenance/doctype/maintenance_visit/maintenance_visit.txt
new file mode 100644
index 0000000..f8fa11b
--- /dev/null
+++ b/maintenance/doctype/maintenance_visit/maintenance_visit.txt
@@ -0,0 +1,1313 @@
+[
+	{
+		'_last_update': '1305704021',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'MV.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-18 13:03:39',
+		'modified_by': 'Guest',
+		'module': 'Maintenance',
+		'name': 'Maintenance Visit',
+		'name_case': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status,maintenance_type,customer,customer_name, address,mntc_date,company,fiscal_year',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'To %(customer_name)s on %(mntc_date)s',
+		'tag_fields': 'completion_status,maintenance_type',
+		'use_template': None,
+		'version': 94
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00342',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00343',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00344',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00345',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00346',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:09:09',
+		'modified_by': 'Administrator',
+		'name': 'PERM00347',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Maintenance User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Customer Details',
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05223',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05224',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL03795',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL05213',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01933',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01931',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL05214',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL05215',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL05216',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL05217',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01926',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Select',
+		'options': 'link:Company',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01927',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05225',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mntc_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Maintenance Date',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01924',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'mntc_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mntc_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Maintenance Time',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01925',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'mntc_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Status',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01923',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Data',
+		'options': '\nDraft\nCancelled\nSubmitted',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01928',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01929',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01934',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Customer Group',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL05219',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Maintenance Details',
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05226',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'completion_status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Completion Status',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01936',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'completion_status',
+		'oldfieldtype': 'Select',
+		'options': '\nPartially Completed\nFully Completed',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'Unscheduled',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'maintenance_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Maintenance Type',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01937',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'maintenance_type',
+		'oldfieldtype': 'Select',
+		'options': '\nScheduled\nUnscheduled\nBreakdown',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05227',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'Sales Order No',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01939',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_order_no',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_issue_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Customer Issue No',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01940',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_issue_no',
+		'oldfieldtype': 'Link',
+		'options': 'Customer Issue',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01941',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'fetch_items',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05228',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'maintenance_visit_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Maintenance Visit Detail',
+		'modified': '2011-05-25 12:44:55',
+		'modified_by': 'Guest',
+		'name': 'FL01943',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'maintenance_visit_details',
+		'oldfieldtype': 'Table',
+		'options': 'Maintenance Visit Detail',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Feedback',
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL05229',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_feedback',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Customer Feedback',
+		'modified': '2011-05-25 12:44:56',
+		'modified_by': 'Guest',
+		'name': 'FL01945',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_feedback',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Maintenance Visit',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/maintenance/doctype/maintenance_visit_detail/__init__.py b/maintenance/doctype/maintenance_visit_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/maintenance_visit_detail/__init__.py
diff --git a/maintenance/doctype/maintenance_visit_detail/maintenance_visit_detail.txt b/maintenance/doctype/maintenance_visit_detail/maintenance_visit_detail.txt
new file mode 100644
index 0000000..f433c67
--- /dev/null
+++ b/maintenance/doctype/maintenance_visit_detail/maintenance_visit_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-08 15:45:57', 'search_fields': None, 'module': 'Maintenance', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'MVD.#####', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Maintenance Visit Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01885', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'service_person', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Service Person', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01886', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'service_person', 'fieldtype': 'Link', 'options': 'Sales Person', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'work_done', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Work Done', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01887', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'work_done', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01888', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01889', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'serial_no', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Serial No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01890', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'serial_no', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Against Document No', 'width': '160px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01891', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_detail_docname', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Against Document Detail No', 'width': '160px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01892', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'prevdoc_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:45:57', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_doctype', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Document Type', 'width': '150px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'Maintenance Visit Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01893', 'idx': 9, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-08 15:45:57', 'parenttype': 'DocType', 'fieldname': 'prevdoc_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/maintenance/doctype/support_ticket/__init__.py b/maintenance/doctype/support_ticket/__init__.py
new file mode 100644
index 0000000..ba49f95
--- /dev/null
+++ b/maintenance/doctype/support_ticket/__init__.py
@@ -0,0 +1,63 @@
+import webnotes
+
+from webnotes.utils.email_lib.receive import POP3Mailbox
+
+class SupportMailbox(POP3Mailbox):
+	def __init__(self):
+		"""
+			settings_doc must contain
+			is_ssl, host, username, password
+		"""
+		POP3Mailbox.__init__(self, 'Support Email Settings')
+	
+	def check_mails(self):
+		"""
+			returns true if there are active sessions
+		"""
+		return webnotes.conn.sql("select user from tabSessions where time_to_sec(timediff(now(), lastupdate)) < 1800")
+	
+	def process_message(self, mail):
+		"""
+			Updates message from support email as either new or reply
+		"""
+		from event_updates import update_feed
+
+		content, content_type = '[Blank Email]', 'text/plain'
+		if mail.text_content:
+			content, content_type = mail.text_content, 'text/plain'
+		else:
+			content, content_type = mail.html_content, 'text/html'
+			
+		thread_id = mail.get_thread_id()
+
+		if webnotes.conn.exists('Support Ticket', thread_id):
+			from webnotes.model.code import get_obj
+			
+			st = get_obj('Support Ticket', thread_id)
+			st.make_response_record(content, mail.mail['From'], content_type)
+			webnotes.conn.set(st.doc, 'status', 'To Reply')
+			update_feed(st.doc)
+			return
+				
+		# new ticket
+		from webnotes.model.doc import Document
+		d = Document('Support Ticket')
+		d.description = content
+		d.subject = mail.mail['Subject']
+		d.raised_by = mail.mail['From']
+		d.content_type = content_type
+		d.status = 'Open'
+		try:
+			d.save(1)
+		except:
+			d.description = 'Unable to extract message'
+			d.save(1)
+
+		# update feed
+		update_feed(d)
+
+def get_support_mails():
+	"""
+		Gets new emails from support inbox and updates / creates Support Ticket records
+	"""
+	SupportMailbox().get_messages()
\ No newline at end of file
diff --git a/maintenance/doctype/support_ticket/support_ticket.js b/maintenance/doctype/support_ticket/support_ticket.js
new file mode 100644
index 0000000..c723d66
--- /dev/null
+++ b/maintenance/doctype/support_ticket/support_ticket.js
@@ -0,0 +1,128 @@
+// threading structure
+// -------- orginal message --------
+// xoxoxoxo
+// -------- reply 1 --------
+// -------- reply 2 --------
+// xoxoxoxo
+// -------- new reply --------
+
+var cs = cur_frm.cscript;
+$.extend(cur_frm.cscript, {
+	onload: function(doc, dt, dn) {
+		//
+		// help area
+		//
+		if(in_list(user_roles,'System Manager')) {
+			cur_frm.page_layout.footer.help_area.innerHTML = '';
+			new wn.widgets.Footer({
+				parent:cur_frm.page_layout.footer.help_area,
+				columns:2,
+				items: [
+					{
+						column: 0,
+						label:'Support Email Settings',
+						description:'Integrate your incoming support emails to support ticket',
+						onclick: function() { loaddoc('Support Email Settings','Support Email Settings'); }
+					}, 					
+				]
+			})			
+		}
+	},
+	
+	refresh: function(doc) {
+		cs.make_listing(doc);
+		if(!doc.__islocal) {
+			// can't change the main message & subject once set
+			set_field_permlevel('subject',2);
+			set_field_permlevel('description',2);
+			set_field_permlevel('raised_by',2);
+		}
+	},
+	
+	//
+	// make thread listing
+	//
+	make_listing: function(doc) {
+		cur_frm.fields_dict['Thread HTML'].wrapper.innerHTML = '';
+		
+		// render first message
+		new EmailMessage(cur_frm.fields_dict['Thread HTML'].wrapper, {
+			from_email: doc.raised_by,
+			creation: doc.creation,
+			mail: doc.description,
+			content_type: doc.content_type
+		}, null, -1)
+		
+		// render thread		
+		cs.thread_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Thread HTML'].wrapper,
+			no_result_message: 'No responses yet',
+			get_query: function() {
+				return 'select mail, from_email, creation, content_type '+
+				'from `tabSupport Ticket Response` where parent="'+doc.name+'" order by creation asc'
+			},
+			as_dict: 1,
+			render_row: function(parent, data, list, idx) {
+				new EmailMessage(parent, data, list, idx);
+			}
+		});
+		cs.thread_list.run();
+
+	},
+	
+	Send: function(doc, dt, dn) {
+		$c_obj([doc], 'send_response', '', function(r,rt) {
+			locals[dt][dn].new_response = '';
+			refresh_field('new_response');
+			cs.make_listing(doc);
+		});
+	}
+})
+
+
+EmailMessage = function(parent, args, list, idx) {
+	var me = this;
+	$.extend(this, args);
+	this.make = function() {
+		this.creation = wn.datetime.str_to_user(this.creation);
+		if(this.from_email)
+			this.from_email = this.from_email.replace('<', '&lt;').replace('>', '&gt;');
+		
+		// main wrapper
+		w = $a(parent, 'div', '', 
+			{margin:'7px 0px', padding:'0px', border:'1px solid #c8c8c8', backgroundColor:'#f9f9f9'}
+		);
+		$br(w, '7px');
+
+		// sender and timestamp
+		$a($a(w, 'div', '', {marginBottom:'7px', padding: '7px', backgroundColor:'#d2d2f2'}), 
+			'span', 'link_type', {}, repl('By %(from_email)s on %(creation)s:', this), 
+			function() {
+				// toggle message display on timestamp
+				if(me.message.style.display.toLowerCase()=='none') {
+					$ds(me.message);
+				} else {
+					$dh(me.message);
+				}
+			}
+		);
+		
+		// email text
+		this.message = $a(w, 'div', '', 
+			// style
+			{lineHeight:'1.7em', display:'none', padding: '7px'}, 
+			
+			// newlines for text email
+			(this.content_type=='text/plain' ? this.mail
+				.replace(/\n[ ]*\n[\n\t ]*/g, '\n\n') // excess whitespace
+				.replace(/\n/g, '<br>') : this.mail)
+		);
+		
+		// show only first and last message
+		if(idx==-1 || list && list.values.length-1==idx) {
+			$ds(this.message)
+		}
+		
+	}
+	this.make();
+}
\ No newline at end of file
diff --git a/maintenance/doctype/support_ticket/support_ticket.py b/maintenance/doctype/support_ticket/support_ticket.py
new file mode 100644
index 0000000..f611765
--- /dev/null
+++ b/maintenance/doctype/support_ticket/support_ticket.py
@@ -0,0 +1,46 @@
+import webnotes
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+	def send_response(self):
+		"""
+			Adds a new response to the ticket and sends an email to the sender
+		"""
+		if not self.doc.new_response:
+			webnotes.msgprint("Please write something as a response", raise_exception=1)
+		
+		subject = '[' + self.doc.name + '] ' + self.doc.subject
+		
+		response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'
+
+		signature = webnotes.conn.get_value('Support Email Settings',None,'signature')
+		if signature:
+			response += '\n\n' + signature
+
+		from webnotes.utils.email_lib import sendmail
+		
+		sendmail(\
+			recipients = [self.doc.raised_by], \
+			sender=webnotes.conn.get_value('Support Email Settings',None,'email'), \
+			subject=subject, \
+			msg=response)
+
+		self.doc.new_response = None
+		webnotes.conn.set(self.doc,'status','Waiting for Customer')
+		self.make_response_record(response)
+	
+	def make_response_record(self, response, from_email = None, content_type='text/plain'):
+		"""
+			Creates a new Support Ticket Response record
+		"""
+		# add to Support Ticket Response
+		from webnotes.model.doc import Document
+		d = Document('Support Ticket Response')
+		d.from_email = from_email or webnotes.user.name
+		d.parent = self.doc.name
+		d.mail = response
+		d.content_type = content_type
+		d.save(1)
diff --git a/maintenance/doctype/support_ticket/support_ticket.txt b/maintenance/doctype/support_ticket/support_ticket.txt
new file mode 100644
index 0000000..2902feb
--- /dev/null
+++ b/maintenance/doctype/support_ticket/support_ticket.txt
@@ -0,0 +1,893 @@
+[
+	{
+		'_last_update': '1306413048',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'SUP.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-23 09:01:10',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'Support Ticket',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status,customer,allocated_to',
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(subject)s',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 136
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2011-05-23 09:01:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'PERM00818',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Guest',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-05-23 09:01:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': 'customer',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'PERM00819',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Customer',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-05-23 09:01:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'PERM00820',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Support Team',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-05-23 09:01:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': 'allocated_to',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'PERM00821',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Support Team',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-05-23 09:01:11',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'PERM00822',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Support Team',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-23 09:01:11',
+		'default': 'Open',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 0,
+		'label': 'Status',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04772',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nOpen\nTo Reply\nWaiting for Customer\nHold\nClosed',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'subject',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Subject',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04773',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'raised_by',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Raised By (Email)',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04774',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'raised_by',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04775',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'problem_description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Thread HTML',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04778',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'new_response',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'New Response',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04776',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Send',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04777',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Additional Info',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04779',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04780',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04781',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 1,
+		'label': 'Customer Name',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04782',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Contact No',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04783',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'opening_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Opening Date',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04784',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'opening_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'opening_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Opening Time',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04785',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'opening_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04786',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'allocated_to',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Allocated To',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04787',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'allocated_to',
+		'oldfieldtype': 'Link',
+		'options': 'Profile',
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resolution_details',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Resolution Details',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04788',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'resolution_details',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resolution_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 0,
+		'label': 'Resolution Date',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04789',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'resolution_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-23 09:01:11',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resolution_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Resolution Time',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04790',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'resolution_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:16:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'content_type',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Content Type',
+		'modified': '2011-05-28 09:22:11',
+		'modified_by': 'Administrator',
+		'name': 'FL04791',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/maintenance/doctype/support_ticket_response/__init__.py b/maintenance/doctype/support_ticket_response/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/doctype/support_ticket_response/__init__.py
diff --git a/maintenance/doctype/support_ticket_response/support_ticket_response.txt b/maintenance/doctype/support_ticket_response/support_ticket_response.txt
new file mode 100644
index 0000000..70567f7
--- /dev/null
+++ b/maintenance/doctype/support_ticket_response/support_ticket_response.txt
@@ -0,0 +1,167 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:27',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-24 10:17:30',
+		'modified_by': 'Guest',
+		'module': 'Maintenance',
+		'name': 'Support Ticket Response',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 4
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mail',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Mail',
+		'modified': '2011-05-25 12:44:27',
+		'modified_by': 'Guest',
+		'name': 'FL05056',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket Response',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'From Email',
+		'modified': '2011-05-25 12:44:27',
+		'modified_by': 'Guest',
+		'name': 'FL05057',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket Response',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'content_type',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Content Type',
+		'modified': '2011-05-25 12:44:27',
+		'modified_by': 'Guest',
+		'name': 'FL05058',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Ticket Response',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/__init__.py b/maintenance/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/__init__.py
diff --git a/maintenance/search_criteria/amc_summary/__init__.py b/maintenance/search_criteria/amc_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/amc_summary/__init__.py
diff --git a/maintenance/search_criteria/amc_summary/amc_summary.js b/maintenance/search_criteria/amc_summary/amc_summary.js
new file mode 100644
index 0000000..c3208b3
--- /dev/null
+++ b/maintenance/search_criteria/amc_summary/amc_summary.js
@@ -0,0 +1,9 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.mytabs.items['Select Columns'].hide();
+  this.mytabs.items['More Filters'].hide()
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Territory'].df.filter_hide = 0;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Item Group'].df.filter_hide = 0;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Territory'].df.in_first_page = 1;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Item Group'].df.in_first_page = 1; 
+}
\ No newline at end of file
diff --git a/maintenance/search_criteria/amc_summary/amc_summary.py b/maintenance/search_criteria/amc_summary/amc_summary.py
new file mode 100644
index 0000000..49a5976
--- /dev/null
+++ b/maintenance/search_criteria/amc_summary/amc_summary.py
@@ -0,0 +1,70 @@
+# ADD NEW COLUMNS
+row_list = [['Item Group','Data','150px',''],
+            ['Out of AMC','Int','150px',''],
+            ['Under AMC','Int','150px',''],
+            ['Out of Warranty','Int','150px',''],
+            ['Under Warranty','Int','150px',''],
+            ['Total','Int','150px','']
+           ]
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+
+#ADD VALUES TO THE COLUMN
+out=[]
+oa,ua,ow,uw,sum=0,0,0,0,0
+nowdate = nowdate()
+for r in res:
+  cc = r[col_idx['Territory']]
+  item_groups = sql("select distinct item_group from `tabSerial No` where territory = '%s' and item_group like '%%%s'" %(cc,filter_values.get('item_group')))
+  
+  for col in range(len(colnames)-1): # this would make all first row blank. just for look
+    r.append('')
+  out.append(r)
+  
+  # Add Totals for each Territory
+  # -----------------------------
+  det = sql("select COUNT(CASE WHEN amc_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN amc_expiry_date <= '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date <= '%s' THEN name ELSE NULL END) from `tabSerial No` where territory = '%s' and item_group like '%%%s'" %(nowdate,nowdate,nowdate,nowdate,cc,filter_values.get('item_group')))
+  r[col_idx['Item Group']] = ''
+
+  r[col_idx['Out of AMC']] = cstr(det[0][0])
+  r[col_idx['Under AMC']] = cstr(det[0][1])
+  r[col_idx['Out of Warranty']] = cstr(det[0][2])
+  r[col_idx['Under Warranty']] = cstr(det[0][3])
+  tot = cint(det[0][0]) + cint(det[0][1]) + cint(det[0][2]) + cint(det[0][3])
+  r[col_idx['Total']] = cstr(tot)
+
+
+  oa  += cint(det[0][0])
+  ua  += cint(det[0][1])
+  ow  += cint(det[0][2])
+  uw  += cint(det[0][3])
+  sum += tot
+
+  
+  # Add Brand Details belonging to Territory
+  # ----------------------------------------
+  for br in item_groups:
+    br_det = sql("select COUNT(CASE WHEN amc_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN amc_expiry_date <= '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date <= '%s' THEN name ELSE NULL END) from `tabSerial No` where territory = '%s' and item_group = '%s'"%(nowdate,nowdate,nowdate,nowdate,cc,br[0]))
+    t_row = ['' for i in range(len(colnames))]
+    t_row[col_idx['Item Group']] = br[0]
+   
+    t_row[col_idx['Out of AMC']] = cint(br_det[0][0])
+    t_row[col_idx['Under AMC']] = cint(br_det[0][1])
+    t_row[col_idx['Out of Warranty']] = cint(br_det[0][2])
+    t_row[col_idx['Under Warranty']] = cint(br_det[0][3])
+    tot = cint(br_det[0][0]) + cint(br_det[0][1]) + cint(br_det[0][2])+ cint(br_det[0][3])
+    t_row[col_idx['Total']] = tot
+    out.append(t_row)
+  
+
+#ADD NEW ROW
+# ----------
+newrow=['','TOTAL',oa,ua,ow,uw,sum]
+out.append(newrow)
+res=out
\ No newline at end of file
diff --git a/maintenance/search_criteria/amc_summary/amc_summary.txt b/maintenance/search_criteria/amc_summary/amc_summary.txt
new file mode 100644
index 0000000..f93d32a
--- /dev/null
+++ b/maintenance/search_criteria/amc_summary/amc_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabSerial No`.`territory` is not null\n`tabSerial No`.`territory` != ''\n`tabSerial No`.`status` not in ('In Store', 'Scrapped')",
+		'add_tab': None,
+		'columns': 'Serial No\x01Territory',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'AMC Summary',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSerial No`.`cost_center`',
+		'idx': None,
+		'modified': '2010-07-15 16:00:11',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'amc_summary',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSerial No`.`cost_center`',
+		'sort_order': 'ASC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/customer_issues/__init__.py b/maintenance/search_criteria/customer_issues/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/customer_issues/__init__.py
diff --git a/maintenance/search_criteria/customer_issues/customer_issues.js b/maintenance/search_criteria/customer_issues/customer_issues.js
new file mode 100644
index 0000000..4af2f7a
--- /dev/null
+++ b/maintenance/search_criteria/customer_issues/customer_issues.js
@@ -0,0 +1,7 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Status'].df.in_first_page = 1;
+  this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Allocated To'].df.in_first_page = 1;
+  this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+}
+
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/maintenance/search_criteria/customer_issues/customer_issues.txt b/maintenance/search_criteria/customer_issues/customer_issues.txt
new file mode 100644
index 0000000..b56e1fb
--- /dev/null
+++ b/maintenance/search_criteria/customer_issues/customer_issues.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Customer Issue\x01ID,Customer Issue\x01Status,Customer Issue\x01Complaint Date,Customer Issue\x01Complaint,Customer Issue\x01Item Code,Customer Issue\x01Item Name,Customer Issue\x01Allocated To,Customer Issue\x01Allocated On,Customer Issue\x01Resolved By,Customer Issue\x01Resolution Date,Customer Issue\x01Customer Name,Customer Issue\x01Fiscal Year',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Customer Issues',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Customer Issue',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Customer Issue\x01Saved':1,'Customer Issue\x01Submitted':1,'Customer Issue\x01Status':'','Customer Issue\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 13:21:32',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'customer_issues',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabCustomer Issue`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/customer_issues1/__init__.py b/maintenance/search_criteria/customer_issues1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/customer_issues1/__init__.py
diff --git a/maintenance/search_criteria/customer_issues1/customer_issues1.txt b/maintenance/search_criteria/customer_issues1/customer_issues1.txt
new file mode 100644
index 0000000..265006b
--- /dev/null
+++ b/maintenance/search_criteria/customer_issues1/customer_issues1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Customer Issue\x01ID,Customer Issue\x01Status,Customer Issue\x01Complaint Date,Customer Issue\x01Complaint,Customer Issue\x01Item Code,Customer Issue\x01Item Name,Customer Issue\x01Allocated To,Customer Issue\x01Allocated On,Customer Issue\x01Resolved By,Customer Issue\x01Resolution Date,Customer Issue\x01Customer Name,Customer Issue\x01Fiscal Year',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Customer Issues1',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Customer Issue',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Customer Issue\x01Saved':1,'Customer Issue\x01Submitted':1,'Customer Issue\x01Status':'','Customer Issue\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:22:31',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'customer_issues1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabCustomer Issue`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py b/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py
diff --git a/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.js b/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.js
new file mode 100644
index 0000000..46d4b2b
--- /dev/null
+++ b/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt b/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
new file mode 100644
index 0000000..9271d03
--- /dev/null
+++ b/maintenance/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`billed_qty`) * `tabSales Order Detail`.`basic_rate`) AS 'Pending Amount'",
+		'add_cond': "`tabSales Order`.status != 'Stopped'\n`tabSales Order`.order_type='Maintenance'",
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Maintenance Orderwise Pending Amount To Bill',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 13:40:44',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'maintenance_orderwise_pending_amount_to_bill',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/maintenance_schedule_details/__init__.py b/maintenance/search_criteria/maintenance_schedule_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/maintenance_schedule_details/__init__.py
diff --git a/maintenance/search_criteria/maintenance_schedule_details/maintenance_schedule_details.js b/maintenance/search_criteria/maintenance_schedule_details/maintenance_schedule_details.js
new file mode 100644
index 0000000..87651bb
--- /dev/null
+++ b/maintenance/search_criteria/maintenance_schedule_details/maintenance_schedule_details.js
@@ -0,0 +1,13 @@
+report.customize_filters = function() {
+
+  this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'From Scheduled Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'To Scheduled Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'Incharge Name'].df.in_first_page = 1;
+  this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Customer'].df.in_first_page = 1;
+  this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Customer Name'].df.in_first_page = 1;
+  this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Sales Order No'].df.in_first_page = 1;
+  //this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Status'].df.in_first_page = 0;
+  this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+}
+
+this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/maintenance/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt b/maintenance/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
new file mode 100644
index 0000000..ab60552
--- /dev/null
+++ b/maintenance/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Maintenance Schedule Detail\x01Item Code,Maintenance Schedule Detail\x01Item Name,Maintenance Schedule Detail\x01Serial No,Maintenance Schedule Detail\x01Incharge Name,Maintenance Schedule Detail\x01Scheduled Date,Maintenance Schedule\x01Customer Name,Maintenance Schedule\x01Address,Maintenance Schedule\x01Sales Order No',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Maintenance Schedule Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Maintenance Schedule Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Maintenance Schedule\x01Submitted':1,'Maintenance Schedule\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 13:18:23',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'maintenance_schedule_details',
+		'owner': 'nabin@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Maintenance Schedule',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabMaintenance Schedule Detail`.`item_code`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/warranty_amc_expiry_details/__init__.py b/maintenance/search_criteria/warranty_amc_expiry_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_expiry_details/__init__.py
diff --git a/maintenance/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.js b/maintenance/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.js
new file mode 100644
index 0000000..d1e78e0
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.js
@@ -0,0 +1,9 @@
+//this.mytabs.items['Select Columns'].hide();
+
+report.customize_filters = function() {
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Status'].df.in_first_page = 0;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Customer'].df.in_first_page = 1;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Customer Name'].df.in_first_page = 1;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Maintenance Status'].df.in_first_page = 1;
+
+}
\ No newline at end of file
diff --git a/maintenance/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt b/maintenance/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
new file mode 100644
index 0000000..7d41d62
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Status,Serial No\x01Item Group,Serial No\x01Purchase Receipt No,Serial No\x01Delivery Note No,Serial No\x01Customer,Serial No\x01Customer Name,Serial No\x01AMC Expiry Date,Serial No\x01Warranty Expiry Date',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Warranty/AMC Expiry Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':'','Serial No\x01Maintenance Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 13:32:21',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'warranty-amc_expiry_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSerial No`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/warranty_amc_summary/__init__.py b/maintenance/search_criteria/warranty_amc_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary/__init__.py
diff --git a/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.js b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.js
new file mode 100644
index 0000000..07f6952
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.js
@@ -0,0 +1,10 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.mytabs.items['Select Columns'].hide();
+  this.mytabs.items['More Filters'].hide();
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Item Group',ignore:1,parent:'Serial No',in_first_page:1, report_default:'Item Group'});
+}
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
\ No newline at end of file
diff --git a/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.py b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.py
new file mode 100644
index 0000000..64f6bd2
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.py
@@ -0,0 +1,37 @@
+
+opt = filter_values.get('based_on')
+opt_dict = {'Territory':'territory', 'Item Group':'item_group'}
+
+# ADD NEW COLUMNS
+row_list = [[opt,'Data','150px',''],
+           ['Out of AMC','Int','150px',''],
+           ['Under AMC','Int','150px',''],
+           ['Out of Warranty','Int','150px',''],
+           ['Under Warranty','Int','150px',''],
+           ['Total','Int','150px','']]
+
+for r in row_list:
+  colnames.append(r[0])
+  coltypes.append(r[1])
+  colwidths.append(r[2])
+  coloptions.append(r[3])
+  col_idx[r[0]] = len(colnames)-1
+
+
+#ADD VALUES TO THE COLUMN
+out=[]
+oa,ua,ow,uw,sum=0,0,0,0,0
+nowdate = nowdate()
+for r in res:
+  lft_rgt = sql("select lft, rgt from `tab%s` where name = '%s'" % (opt,r[col_idx[opt]].strip()))
+  
+  
+  det = sql("select COUNT(CASE WHEN t1.amc_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.amc_expiry_date >= '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date >= '%s' THEN t1.name ELSE NULL END) from `tabSerial No` t1, `tab%s` t2 where t1.%s = t2.name and t2.lft>= '%s' and t2. rgt <= '%s' and t1.status not in ('In Store', 'Scrapped','Not in Use') and ifnull(item_group,'')!='' and ifnull(territory,'')!=''" %(nowdate,nowdate,nowdate,nowdate,opt, opt_dict[opt], lft_rgt[0][0], lft_rgt[0][1]))
+  
+  r.append(cint(det[0][0]))
+  r.append(cint(det[0][1]))
+  r.append(cint(det[0][2]))
+  r.append(cint(det[0][3]))
+  tot = cint(det[0][0]) + cint(det[0][1]) + cint(det[0][2]) + cint(det[0][3])
+  r.append(tot)
+  out.append(r)
diff --git a/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.sql b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.sql
new file mode 100644
index 0000000..ebd7ae8
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.sql
@@ -0,0 +1 @@
+SELECT CONCAT(REPEAT('     ', COUNT(parent.name) - 1), node.name) AS name FROM `tab%(based_on)s` AS node,`tab%(based_on)s` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
\ No newline at end of file
diff --git a/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.txt b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
new file mode 100644
index 0000000..efd2e3a
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 17:56:43',
+		'criteria_name': 'Warranty/AMC Summary',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-25 12:14:49',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'warranty-amc_summary',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': 'name',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/maintenance/search_criteria/warranty_amc_summary1/__init__.py b/maintenance/search_criteria/warranty_amc_summary1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary1/__init__.py
diff --git a/maintenance/search_criteria/warranty_amc_summary1/warranty_amc_summary1.txt b/maintenance/search_criteria/warranty_amc_summary1/warranty_amc_summary1.txt
new file mode 100644
index 0000000..dd3a075
--- /dev/null
+++ b/maintenance/search_criteria/warranty_amc_summary1/warranty_amc_summary1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': None,
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Warranty/AMC Summary1',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:23:09',
+		'modified_by': 'Administrator',
+		'module': 'Maintenance',
+		'name': 'warranty-amc_summary1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'name',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt b/mapper/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt
new file mode 100644
index 0000000..3beb0f5
--- /dev/null
+++ b/mapper/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt
@@ -0,0 +1,405 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Customer Issue',
+		'idx': None,
+		'modified': '2011-05-18 13:37:43',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Customer Issue-Maintenance Visit',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Maintenance Visit'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00555',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003470',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00012',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003471',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00011',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003472',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003473',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003474',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003475',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00013',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003476',
+		'owner': 'Administrator',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00014',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00015',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00016',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_issue_no'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'complaint',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00017',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00018',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00019',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'doctype',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00020',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00021',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Customer Issue',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000003',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': 'prevdoc_docname',
+		'to_field': 'maintenance_visit_details',
+		'to_table': 'Maintenance Visit Detail',
+		'validation_logic': 'docstatus=1'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Customer Issue',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000004',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Customer Issue-Maintenance Visit',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': 'prevdoc_docname',
+		'to_field': None,
+		'to_table': 'Maintenance Visit',
+		'validation_logic': 'docstatus=1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt b/mapper/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt
new file mode 100644
index 0000000..7f91614
--- /dev/null
+++ b/mapper/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt
@@ -0,0 +1,480 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Delivery Note',
+		'idx': None,
+		'modified': '2011-05-17 11:42:57',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Delivery Note-Installation Note',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Installation Note'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00022',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00023',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00556',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003477',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00025',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00026',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00024',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003478',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003479',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003480',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003481',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00027',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003482',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00028',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'delivery_note_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00029',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_detail_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00030',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parenttype',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00031',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00032',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00033',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: flt(obj.qty) - flt(obj.installed_qty)',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00034',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'serial_no',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00035',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'serial_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-09 09:44:02',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'posting_date',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00551',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_date'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'delivery_note_details',
+		'from_table': 'Delivery Note Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000005',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'installed_item_details',
+		'to_table': 'Installed Item Details',
+		'validation_logic': 'qty > ifnull(installed_qty,0) and docstatus = 1'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Delivery Note',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000006',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Installation Note',
+		'validation_logic': 'docstatus = 1'
+	},
+	{
+		'creation': '2010-08-09 09:44:02',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Delivery Note',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000058',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Delivery Note-Installation Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': 'prevdoc_docname',
+		'to_field': 'installed_item_details',
+		'to_table': 'Installed Item Details',
+		'validation_logic': 'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt b/mapper/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt
new file mode 100644
index 0000000..6f05fdc
--- /dev/null
+++ b/mapper/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt
@@ -0,0 +1,1221 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Delivery Note',
+		'idx': None,
+		'modified': '2011-05-16 17:48:12',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Delivery Note-Receivable Voucher',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Receivable Voucher'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00039',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003483',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-09-01 15:48:10',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00557',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00558',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003484',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003485',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003486',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003487',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:24',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000003488',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00036',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00041',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00037',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00038',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'price_list_name',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00040',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'price_list_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00042',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00043',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-09 09:44:02',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00552',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00044',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00045',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00046',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-31 13:35:57',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'batch_no',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000002189',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'batch_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_rate',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00057',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-31 13:35:57',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'serial_no',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000002190',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'serial_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00047',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00048',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'base_ref_rate',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00049',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'base_ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'ref_rate',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00050',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'basic_rate',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00051',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'basic_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00053',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'delivery_note'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00054',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'dn_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'prevdoc_docname',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00055',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_order'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'prevdoc_detail_docname',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00056',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'so_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_rate',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00052',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-15 14:26:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': '000001853',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.basic_rate)',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00058',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.export_rate)',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00059',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'adj_rate',
+		'idx': 38,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00060',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'adj_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00061',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 40,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00062',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 41,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00063',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 42,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00064',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 43,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00065',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 44,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00066',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 45,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00067',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tax_amount',
+		'idx': 46,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00068',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tax_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total',
+		'idx': 47,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00069',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_person',
+		'idx': 48,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00070',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_designation',
+		'idx': 49,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00671',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_designation'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_percentage',
+		'idx': 50,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00071',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_percentage'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_amount',
+		'idx': 51,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00072',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'incentives',
+		'idx': 52,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00672',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'incentives'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'source',
+		'idx': 53,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00073',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'source'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'campaign',
+		'idx': 54,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00074',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'campaign'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 54,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00079',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_partner',
+		'idx': 55,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00075',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_partner'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'commission_rate',
+		'idx': 56,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00673',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'commission_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_commission',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00674',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total_commission'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 58,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00076',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'net_total',
+		'idx': 59,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00077',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'net_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total',
+		'idx': 60,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:24',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00078',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 61,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00559',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-06 17:41:54',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'warehouse',
+		'idx': 62,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000002944',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'warehouse'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Delivery Note',
+		'idx': 1,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000007',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Receivable Voucher',
+		'validation_logic': 'docstatus=1'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'delivery_note_details',
+		'from_table': 'Delivery Note Detail',
+		'idx': 2,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000008',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'entries',
+		'to_table': 'RV Detail',
+		'validation_logic': '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'other_charges',
+		'from_table': 'RV Tax Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000009',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'other_charges',
+		'to_table': 'RV Tax Detail',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_team',
+		'from_table': 'Sales Team',
+		'idx': 4,
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000010',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'sales_team',
+		'to_table': 'Sales Team',
+		'validation_logic': 'name is not null'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt b/mapper/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt
new file mode 100644
index 0000000..b04d533
--- /dev/null
+++ b/mapper/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt
@@ -0,0 +1,621 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Enquiry',
+		'idx': None,
+		'modified': '2011-05-10 16:04:40',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Enquiry-Quotation',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Quotation'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_no',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00080',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00081',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00082',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'qty',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00084',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'subject',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00083',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'enq_det'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'uom',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00085',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'source',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00086',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'source'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'campaign',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00087',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'campaign'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00088',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'enq_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00560',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003489',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00089',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00092',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003490',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-09-01 15:48:10',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00561',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003491',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00091',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003492',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003493',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'email_id',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:34',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00093',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'email_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00094',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00090',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00095',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00096',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00097',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00098',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parenttype',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00099',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'lead',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00100',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'lead'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'lead_name',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00101',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'lead_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'enquiry_from',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00102',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'quotation_to'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'enquiry_type',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00103',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'order_type'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Enquiry',
+		'idx': 1,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000011',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Quotation',
+		'validation_logic': 'docstatus=1'
+	},
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'enq_details',
+		'from_table': 'Enquiry Detail',
+		'idx': 2,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000012',
+		'owner': 'Administrator',
+		'parent': 'Enquiry-Quotation',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'quotation_details',
+		'to_table': 'Quotation Detail',
+		'validation_logic': 'docstatus=1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Enquiry-Service Quotation/Enquiry-Service Quotation.txt b/mapper/DocType Mapper/Enquiry-Service Quotation/Enquiry-Service Quotation.txt
new file mode 100644
index 0000000..7c0565a
--- /dev/null
+++ b/mapper/DocType Mapper/Enquiry-Service Quotation/Enquiry-Service Quotation.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Enquiry-Service Quotation', 'parent': None, 'to_doctype': 'Service Quotation', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Enquiry', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00708', 'parent': 'Enquiry-Service Quotation', 'to_field': 'contact_no', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'contact_no', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00709', 'parent': 'Enquiry-Service Quotation', 'to_field': 'enq_det', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'subject', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00710', 'parent': 'Enquiry-Service Quotation', 'to_field': 'source', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'source', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00711', 'parent': 'Enquiry-Service Quotation', 'to_field': 'campaign', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'campaign', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00712', 'parent': 'Enquiry-Service Quotation', 'to_field': 'enq_no', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00713', 'parent': 'Enquiry-Service Quotation', 'to_field': 'customer_name', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00714', 'parent': 'Enquiry-Service Quotation', 'to_field': 'email_id', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'email_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00715', 'parent': 'Enquiry-Service Quotation', 'to_field': 'contact_person', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'contact_person', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00716', 'parent': 'Enquiry-Service Quotation', 'to_field': 'customer_group', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00717', 'parent': 'Enquiry-Service Quotation', 'to_field': 'customer_address', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00718', 'parent': 'Enquiry-Service Quotation', 'to_field': 'cost_center', 'creation': '2010-06-08 11:14:00', 'modified': '2010-06-08 11:14:00', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'cost_center', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'Administrator', 'name': 'TMD/0000068', 'parent': 'Enquiry-Service Quotation', 'is_reference_table': None, 'to_field': '', 'creation': '2010-06-08 11:14:00', 'reference_doctype_key': '', 'modified': '2010-06-08 11:14:00', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Enquiry', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Service Quotation', 'from_field': '', 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt b/mapper/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
new file mode 100644
index 0000000..4ce80bf
--- /dev/null
+++ b/mapper/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
@@ -0,0 +1 @@
+[{'modified_by': 'jai@webnotestech.com', 'name': 'Indent-Purchase Order', 'parent': None, 'to_doctype': 'Purchase Order', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': '', 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Indent', 'parentfield': ''}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00165', 'parent': 'Indent-Purchase Order', 'to_field': 'fiscal_year', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'fiscal_year', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00164', 'parent': 'Indent-Purchase Order', 'to_field': 'company', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00544', 'parent': 'Indent-Purchase Order', 'to_field': 'prevdoc_doctype', 'creation': '2009-09-21 13:13:48', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00163', 'parent': 'Indent-Purchase Order', 'to_field': 'prevdoc_docname', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00162', 'parent': 'Indent-Purchase Order', 'to_field': 'prevdoc_detail_docname', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00155', 'parent': 'Indent-Purchase Order', 'to_field': 'stock_uom', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00168', 'parent': 'Indent-Purchase Order', 'to_field': 'conversion_factor', 'creation': '2009-03-13 13:18:32', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval:flt(1)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00166', 'parent': 'Indent-Purchase Order', 'to_field': 'uom', 'creation': '2009-03-12 17:24:05', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00157', 'parent': 'Indent-Purchase Order', 'to_field': 'warehouse', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'warehouse', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00160', 'parent': 'Indent-Purchase Order', 'to_field': 'schedule_date', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'schedule_date', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00159', 'parent': 'Indent-Purchase Order', 'to_field': 'item_code', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00244', 'parent': 'Indent-Purchase Order', 'to_field': 'item_name', 'creation': '2009-03-25 17:36:50', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00243', 'parent': 'Indent-Purchase Order', 'to_field': 'brand', 'creation': '2009-03-25 17:36:50', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'brand', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00158', 'parent': 'Indent-Purchase Order', 'to_field': 'description', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 14, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00649', 'parent': 'Indent-Purchase Order', 'to_field': 'item_group', 'creation': '2009-12-22 14:59:02', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 15, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'item_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00253', 'parent': 'Indent-Purchase Order', 'to_field': 'stock_qty', 'creation': '2009-03-30 10:55:56', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 16, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00602', 'parent': 'Indent-Purchase Order', 'to_field': 'qty', 'creation': '2009-11-18 15:10:27', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 17, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)', 'parentfield': 'field_mapper_details'}, {'reference_key': 'prevdoc_docname', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000017', 'parent': 'Indent-Purchase Order', 'is_reference_table': None, 'to_field': '', 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': '', 'modified': '2009-12-30 16:55:33', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Indent', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Purchase Order', 'from_field': '', 'validation_logic': 'docstatus = 1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000018', 'parent': 'Indent-Purchase Order', 'is_reference_table': 1, 'to_field': 'po_details', 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': 'prevdoc_doctype', 'modified': '2009-12-30 16:55:33', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'Indent Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'PO Detail', 'from_field': 'indent_details', 'validation_logic': 'qty > ifnull(ordered_qty,0) and docstatus =1', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/KRA Template-Appraisal/KRA Template-Appraisal.txt b/mapper/DocType Mapper/KRA Template-Appraisal/KRA Template-Appraisal.txt
new file mode 100644
index 0000000..9e193d6
--- /dev/null
+++ b/mapper/DocType Mapper/KRA Template-Appraisal/KRA Template-Appraisal.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'KRA Template-Appraisal', 'parent': None, 'to_doctype': 'Appraisal', 'creation': '2010-08-30 15:45:32', 'modified': '2010-09-01 14:25:40', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_doctype': 'KRA Template', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00901', 'parent': 'KRA Template-Appraisal', 'to_field': 'kra', 'creation': '2010-08-30 15:45:32', 'modified': '2010-09-01 14:25:40', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'kra', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00902', 'parent': 'KRA Template-Appraisal', 'to_field': 'per_weightage', 'creation': '2010-08-30 15:45:32', 'modified': '2010-09-01 14:25:40', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'per_weightage', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000090', 'parent': 'KRA Template-Appraisal', 'is_reference_table': None, 'to_field': 'appraisal_details', 'creation': '2010-08-30 15:45:32', 'reference_doctype_key': '', 'modified': '2010-09-01 14:25:40', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'KRA Sheet', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'to_table': 'Appraisal Detail', 'from_field': 'kra_sheet', 'validation_logic': 'name is not Null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Lead-Customer/Lead-Customer.txt b/mapper/DocType Mapper/Lead-Customer/Lead-Customer.txt
new file mode 100644
index 0000000..6b1b14b
--- /dev/null
+++ b/mapper/DocType Mapper/Lead-Customer/Lead-Customer.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Lead-Customer', 'parent': None, 'to_doctype': 'Customer', 'creation': '2009-11-26 13:15:20', 'modified': '2010-10-14 13:39:44', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Lead', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00604', 'parent': 'Lead-Customer', 'to_field': 'lead_name', 'creation': '2009-11-26 13:15:20', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00605', 'parent': 'Lead-Customer', 'to_field': 'customer_name', 'creation': '2009-11-26 13:26:04', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00606', 'parent': 'Lead-Customer', 'to_field': 'address_line1', 'creation': '2009-11-26 13:28:14', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'address_line1', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00607', 'parent': 'Lead-Customer', 'to_field': 'address_line2', 'creation': '2009-11-26 13:28:14', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'address_line2', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00608', 'parent': 'Lead-Customer', 'to_field': 'city', 'creation': '2009-11-26 13:28:50', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'city', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00609', 'parent': 'Lead-Customer', 'to_field': 'country', 'creation': '2009-11-26 13:28:50', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'country', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00610', 'parent': 'Lead-Customer', 'to_field': 'state', 'creation': '2009-11-26 13:29:50', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'state', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00611', 'parent': 'Lead-Customer', 'to_field': 'pincode', 'creation': '2009-11-26 13:29:50', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'pincode', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00612', 'parent': 'Lead-Customer', 'to_field': 'company', 'creation': '2009-11-26 13:30:21', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00621', 'parent': 'Lead-Customer', 'to_field': 'territory', 'creation': '2009-11-30 12:02:58', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00845', 'parent': 'Lead-Customer', 'to_field': 'phone_1', 'creation': '2010-08-04 12:32:05', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_no', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00975', 'parent': 'Lead-Customer', 'to_field': 'fax_1', 'creation': '2010-10-14 13:37:20', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'fax', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00976', 'parent': 'Lead-Customer', 'to_field': 'website', 'creation': '2010-10-14 13:37:20', 'modified': '2010-10-14 13:39:44', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'website', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000061', 'parent': 'Lead-Customer', 'is_reference_table': None, 'to_field': None, 'creation': '2009-11-26 13:15:20', 'reference_doctype_key': '', 'modified': '2010-10-14 13:39:44', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Lead', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Customer', 'from_field': None, 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt b/mapper/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt
new file mode 100644
index 0000000..9079494
--- /dev/null
+++ b/mapper/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Lead-Enquiry', 'parent': None, 'to_doctype': 'Enquiry', 'creation': '2009-11-27 10:47:07', 'modified': '2010-08-05 20:21:54', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Lead', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00613', 'parent': 'Lead-Enquiry', 'to_field': 'source', 'creation': '2009-11-27 10:48:10', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'source', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00614', 'parent': 'Lead-Enquiry', 'to_field': 'campaign', 'creation': '2009-11-27 10:48:10', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'campaign_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00655', 'parent': 'Lead-Enquiry', 'to_field': 'contact_by', 'creation': '2009-12-29 11:23:15', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_by', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00656', 'parent': 'Lead-Enquiry', 'to_field': 'last_contact_date', 'creation': '2009-12-29 11:23:15', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'from_field': 'last_contact_date', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00657', 'parent': 'Lead-Enquiry', 'to_field': 'contact_date_ref', 'creation': '2009-12-29 11:23:15', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_date_ref', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00658', 'parent': 'Lead-Enquiry', 'to_field': 'contact_date', 'creation': '2009-12-29 11:23:15', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_date', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00850', 'parent': 'Lead-Enquiry', 'to_field': 'enquiry_from', 'creation': '2010-08-05 19:57:36', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'doctype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00851', 'parent': 'Lead-Enquiry', 'to_field': 'lead_name', 'creation': '2010-08-05 19:57:36', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'lead_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00852', 'parent': 'Lead-Enquiry', 'to_field': 'lead', 'creation': '2010-08-05 19:57:36', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00853', 'parent': 'Lead-Enquiry', 'to_field': 'address', 'creation': '2010-08-05 19:57:36', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00854', 'parent': 'Lead-Enquiry', 'to_field': 'contact_no', 'creation': '2010-08-05 19:57:36', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_no', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00855', 'parent': 'Lead-Enquiry', 'to_field': 'email_id', 'creation': '2010-08-05 19:57:36', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'email_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'harshada@webnotestech.com', 'name': 'FMD/00856', 'parent': 'Lead-Enquiry', 'to_field': 'territory', 'creation': '2010-08-05 20:21:54', 'modified': '2010-08-05 20:21:54', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'harshada@webnotestech.com', 'name': 'TMD/0000062', 'parent': 'Lead-Enquiry', 'is_reference_table': None, 'to_field': None, 'creation': '2009-11-27 10:48:10', 'reference_doctype_key': '', 'modified': '2010-08-05 20:21:54', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Lead', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Enquiry', 'from_field': None, 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Production Forecast-Production Plan/Production Forecast-Production Plan.txt b/mapper/DocType Mapper/Production Forecast-Production Plan/Production Forecast-Production Plan.txt
new file mode 100644
index 0000000..8ca299ca
--- /dev/null
+++ b/mapper/DocType Mapper/Production Forecast-Production Plan/Production Forecast-Production Plan.txt
@@ -0,0 +1 @@
+[{'modified_by': 'jai@webnotestech.com', 'name': 'Production Forecast-Production Plan', 'parent': None, 'to_doctype': 'Production Plan', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Production Forecast', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00519', 'parent': 'Production Forecast-Production Plan', 'to_field': 'item_code', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00520', 'parent': 'Production Forecast-Production Plan', 'to_field': 'description', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00521', 'parent': 'Production Forecast-Production Plan', 'to_field': 'stock_uom', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'stock_uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00522', 'parent': 'Production Forecast-Production Plan', 'to_field': 'prevdoc_reqd_qty', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00523', 'parent': 'Production Forecast-Production Plan', 'to_field': 'against_document', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00524', 'parent': 'Production Forecast-Production Plan', 'to_field': 'document_no', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00525', 'parent': 'Production Forecast-Production Plan', 'to_field': 'document_date', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'start_date', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00526', 'parent': 'Production Forecast-Production Plan', 'to_field': 'confirmation_date', 'creation': '2009-09-09 12:33:33', 'modified': '2010-01-27 16:03:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'end_date', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000052', 'parent': 'Production Forecast-Production Plan', 'is_reference_table': None, 'to_field': None, 'creation': '2009-09-09 12:33:33', 'reference_doctype_key': '', 'modified': '2010-01-27 16:03:20', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Production Forecast', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Production Plan', 'from_field': None, 'validation_logic': 'docstatus =1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000053', 'parent': 'Production Forecast-Production Plan', 'is_reference_table': None, 'to_field': 'pp_details', 'creation': '2009-09-09 12:33:33', 'reference_doctype_key': '', 'modified': '2010-01-27 16:03:20', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'PF Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'PP Detail', 'from_field': 'pf_details', 'validation_logic': 'docstatus =1 and qty > planned_qty ', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Production Forecast-Production Planning Tool/Production Forecast-Production Planning Tool.txt b/mapper/DocType Mapper/Production Forecast-Production Planning Tool/Production Forecast-Production Planning Tool.txt
new file mode 100644
index 0000000..c7b2ac6
--- /dev/null
+++ b/mapper/DocType Mapper/Production Forecast-Production Planning Tool/Production Forecast-Production Planning Tool.txt
@@ -0,0 +1 @@
+[{'modified_by': 'jai@webnotestech.com', 'name': 'Production Forecast-Production Planning Tool', 'parent': None, 'to_doctype': 'Production Planning Tool', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_doctype': 'Production Forecast', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00686', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'item_code', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00687', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'description', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00688', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'stock_uom', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'stock_uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00689', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'prevdoc_reqd_qty', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00690', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'source_doctype', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00691', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'source_docname', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00692', 'parent': 'Production Forecast-Production Planning Tool', 'to_field': 'confirmation_date', 'creation': '2010-02-12 12:27:36', 'modified': '2010-02-12 12:41:03', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'end_date', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000066', 'parent': 'Production Forecast-Production Planning Tool', 'is_reference_table': None, 'to_field': None, 'creation': '2010-02-12 12:27:36', 'reference_doctype_key': '', 'modified': '2010-02-12 12:41:03', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Production Forecast', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'to_table': 'Production Planning Tool', 'from_field': None, 'validation_logic': 'docstatus =1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000067', 'parent': 'Production Forecast-Production Planning Tool', 'is_reference_table': None, 'to_field': 'pp_details', 'creation': '2010-02-12 12:27:36', 'reference_doctype_key': '', 'modified': '2010-02-12 12:41:03', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'PF Detail', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'to_table': 'PP Detail', 'from_field': 'pf_details', 'validation_logic': 'docstatus =1 and qty > planned_qty ', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Project-Delivery Note/Project-Delivery Note.txt b/mapper/DocType Mapper/Project-Delivery Note/Project-Delivery Note.txt
new file mode 100644
index 0000000..410a120
--- /dev/null
+++ b/mapper/DocType Mapper/Project-Delivery Note/Project-Delivery Note.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Project-Delivery Note', 'parent': None, 'to_doctype': 'Delivery Note', 'creation': '2010-08-18 18:07:55', 'modified': '2010-09-01 14:25:08', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_doctype': 'Project', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00894', 'parent': 'Project-Delivery Note', 'to_field': 'customer', 'creation': '2010-08-26 13:31:56', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00875', 'parent': 'Project-Delivery Note', 'to_field': 'customer_name', 'creation': '2010-08-18 18:07:55', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': '', 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00876', 'parent': 'Project-Delivery Note', 'to_field': 'customer_address', 'creation': '2010-08-18 18:07:55', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00877', 'parent': 'Project-Delivery Note', 'to_field': 'contact_person', 'creation': '2010-08-18 18:07:55', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_person', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00878', 'parent': 'Project-Delivery Note', 'to_field': 'contact_no', 'creation': '2010-08-18 18:07:55', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_no', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00879', 'parent': 'Project-Delivery Note', 'to_field': 'email_id', 'creation': '2010-08-18 18:07:55', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'email_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00883', 'parent': 'Project-Delivery Note', 'to_field': 'territory', 'creation': '2010-08-19 14:14:32', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00884', 'parent': 'Project-Delivery Note', 'to_field': 'customer_group', 'creation': '2010-08-19 14:14:32', 'modified': '2010-09-01 14:25:08', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_group', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000087', 'parent': 'Project-Delivery Note', 'is_reference_table': None, 'to_field': None, 'creation': '2010-08-18 18:07:55', 'reference_doctype_key': '', 'modified': '2010-09-01 14:25:08', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Project', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'to_table': 'Delivery Note', 'from_field': None, 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Project-Receivable Voucher/Project-Receivable Voucher.txt b/mapper/DocType Mapper/Project-Receivable Voucher/Project-Receivable Voucher.txt
new file mode 100644
index 0000000..1a067d6
--- /dev/null
+++ b/mapper/DocType Mapper/Project-Receivable Voucher/Project-Receivable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Project-Receivable Voucher', 'parent': None, 'to_doctype': 'Receivable Voucher', 'creation': '2010-08-19 13:08:47', 'modified': '2010-09-01 14:24:38', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_doctype': 'Project', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00893', 'parent': 'Project-Receivable Voucher', 'to_field': 'customer', 'creation': '2010-08-26 13:30:32', 'modified': '2010-09-01 14:24:38', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00880', 'parent': 'Project-Receivable Voucher', 'to_field': 'customer_name', 'creation': '2010-08-19 13:08:47', 'modified': '2010-09-01 14:24:38', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': '', 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00881', 'parent': 'Project-Receivable Voucher', 'to_field': 'customer_address', 'creation': '2010-08-19 13:08:47', 'modified': '2010-09-01 14:24:38', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00882', 'parent': 'Project-Receivable Voucher', 'to_field': 'territory', 'creation': '2010-08-19 13:08:47', 'modified': '2010-09-01 14:24:38', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000088', 'parent': 'Project-Receivable Voucher', 'is_reference_table': None, 'to_field': None, 'creation': '2010-08-19 13:08:47', 'reference_doctype_key': '', 'modified': '2010-09-01 14:24:38', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Project', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'to_table': 'Receivable Voucher', 'from_field': None, 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Project-Sales Order/Project-Sales Order.txt b/mapper/DocType Mapper/Project-Sales Order/Project-Sales Order.txt
new file mode 100644
index 0000000..f28cb70
--- /dev/null
+++ b/mapper/DocType Mapper/Project-Sales Order/Project-Sales Order.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Project-Sales Order', 'parent': None, 'to_doctype': 'Sales Order', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_doctype': 'Project', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00892', 'parent': 'Project-Sales Order', 'to_field': 'customer', 'creation': '2010-08-26 13:29:10', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00864', 'parent': 'Project-Sales Order', 'to_field': 'customer_name', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': '', 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00865', 'parent': 'Project-Sales Order', 'to_field': 'customer_address', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00866', 'parent': 'Project-Sales Order', 'to_field': 'contact_person', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_person', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00867', 'parent': 'Project-Sales Order', 'to_field': 'contact_no', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'contact_no', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00868', 'parent': 'Project-Sales Order', 'to_field': 'email_id', 'creation': '2010-08-18 14:41:39', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'email_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00885', 'parent': 'Project-Sales Order', 'to_field': 'customer_group', 'creation': '2010-08-19 14:15:00', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'customer_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00886', 'parent': 'Project-Sales Order', 'to_field': 'territory', 'creation': '2010-08-19 14:15:00', 'modified': '2010-09-01 14:23:28', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000086', 'parent': 'Project-Sales Order', 'is_reference_table': None, 'to_field': None, 'creation': '2010-08-18 14:41:39', 'reference_doctype_key': '', 'modified': '2010-09-01 14:23:28', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Project', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'to_table': 'Sales Order', 'from_field': None, 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt b/mapper/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt
new file mode 100644
index 0000000..2becbe3
--- /dev/null
+++ b/mapper/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt
@@ -0,0 +1,732 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Purchase Order',
+		'idx': None,
+		'modified': '2011-05-13 11:26:20',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Purchase Order-Payable Voucher',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Payable Voucher'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00171',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00172',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00173',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00174',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00175',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_name',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003494',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_name',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-09-01 15:48:10',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00584',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_address',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003495',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003496',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003497',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003498',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003499',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003500',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00176',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00177',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00178',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00179',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'purchase_rate',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00180',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00181',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'import_rate',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00182',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00183',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00184',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00185',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'purchase_order'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00186',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'po_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00187',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-23 15:14:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000001917',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'category',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00188',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'category'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'add_deduct_tax',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00189',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'add_deduct_tax'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00190',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00191',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00192',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00193',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00194',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'cost_center',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00195',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'cost_center'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00196',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00585',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Purchase Order',
+		'idx': 1,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000022',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Payable Voucher',
+		'validation_logic': 'docstatus =1'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'po_details',
+		'from_table': 'PO Detail',
+		'idx': 2,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000023',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'entries',
+		'to_table': 'PV Detail',
+		'validation_logic': 'ifnull(billed_qty,0)  < qty'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'purchase_tax_details',
+		'from_table': 'Purchase Tax Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000024',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Payable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'purchase_tax_details',
+		'to_table': 'Purchase Tax Detail',
+		'validation_logic': 'docstatus =1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/mapper/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
new file mode 100644
index 0000000..1d51ac1
--- /dev/null
+++ b/mapper/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
@@ -0,0 +1,876 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Purchase Order',
+		'idx': None,
+		'modified': '2011-05-13 12:42:57',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Purchase Order-Purchase Receipt',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Purchase Receipt'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00197',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00198',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00586',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003501',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003502',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003503',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': '000003504',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00199',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00200',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00201',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'warehouse',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00202',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'warehouse'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-09 09:44:02',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00553',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_factor',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00203',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_factor'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00204',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00205',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_detail_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00206',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parenttype',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00207',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'uom',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00208',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'uom'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00209',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00210',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00211',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00212',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'received_qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00213',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00214',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'purchase_rate',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00215',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'purchase_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00216',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00217',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'import_rate',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:25',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00218',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00219',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'schedule_date',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00220',
+		'owner': 'jitesh',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'schedule_date'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00221',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-23 15:14:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000001919',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00222',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'category',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00223',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'category'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'add_deduct_tax',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00224',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'add_deduct_tax'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00225',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 38,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00226',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00227',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00232',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 40,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00228',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 41,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00229',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'cost_center',
+		'idx': 42,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00230',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'cost_center'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 43,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00231',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 44,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00587',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'po_details',
+		'from_table': 'PO Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000025',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': 'prevdoc_detail_docname',
+		'to_field': 'purchase_receipt_details',
+		'to_table': 'Purchase Receipt Detail',
+		'validation_logic': 'docstatus=1 and qty > ifnull(received_qty,0)'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Purchase Order',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000026',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': 'prevdoc_docname',
+		'to_field': None,
+		'to_table': 'Purchase Receipt',
+		'validation_logic': 'docstatus = 1'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'purchase_tax_details',
+		'from_table': 'Purchase Tax Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000027',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'purchase_tax_details',
+		'to_table': 'Purchase Tax Detail',
+		'validation_logic': 'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt b/mapper/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt
new file mode 100644
index 0000000..fbf66c3
--- /dev/null
+++ b/mapper/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt
@@ -0,0 +1,750 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Purchase Receipt',
+		'idx': None,
+		'modified': '2011-05-13 12:18:34',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Purchase Receipt-Payable Voucher',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Payable Voucher'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00233',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00234',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00235',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00588',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_address',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003505',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003506',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003507',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003508',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003509',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003510',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00236',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00237',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00238',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00239',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00240',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00241',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00242',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'purchase_rate',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00243',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00244',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'import_rate',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00245',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00246',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00247',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'purchase_receipt'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'prevdoc_docname',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00248',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'purchase_order'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00249',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'pr_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'prevdoc_detail_docname',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00250',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'po_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00251',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-23 15:14:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000001918',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'category',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00252',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'category'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'add_deduct_tax',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00253',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'add_deduct_tax'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00254',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00255',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00256',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00257',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00258',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'cost_center',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00259',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'cost_center'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00260',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00589',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'purchase_receipt_details',
+		'from_table': 'Purchase Receipt Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000028',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'entries',
+		'to_table': 'PV Detail',
+		'validation_logic': 'ifnull(billed_qty,0)  < qty'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Purchase Receipt',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000029',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Payable Voucher',
+		'validation_logic': 'docstatus=1'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'purchase_tax_details',
+		'from_table': 'Purchase Tax Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000030',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Purchase Receipt-Payable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'purchase_tax_details',
+		'to_table': 'Purchase Tax Detail',
+		'validation_logic': 'docstatus=1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt b/mapper/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt
new file mode 100644
index 0000000..7601da0
--- /dev/null
+++ b/mapper/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt
@@ -0,0 +1,1257 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Quotation',
+		'idx': None,
+		'modified': '2011-05-17 12:55:58',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Quotation-Sales Order',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Sales Order'
+	},
+	{
+		'checking_operator': '>=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'transaction_date',
+		'idx': 1,
+		'map': 'No',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00261',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'transaction_date'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'order_type',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00262',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'order_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00263',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'quotation_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'transaction_date',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00264',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'quotation_date'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00265',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00266',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'price_list_name',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00267',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'price_list_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00268',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00269',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00590',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00271',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00270',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00272',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_no',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00273',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003511',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'email_id',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00274',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'email_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003512',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003513',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:26',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': '000003514',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00319',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:26',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00276',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00275',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00277',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'adj_rate',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00278',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'adj_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'basic_rate',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00279',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'basic_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'amount',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00280',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00281',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'ref_rate',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00282',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'base_ref_rate',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00283',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'base_ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00284',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'qty',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00285',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00286',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00287',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00288',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00289',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_rate',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00290',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_amount',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00291',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00292',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'net_total',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00293',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'net_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'other_charges_total',
+		'idx': 38,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00294',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'other_charges_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00295',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rounded_total',
+		'idx': 40,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00296',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rounded_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'in_words',
+		'idx': 41,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00297',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'in_words'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total_export',
+		'idx': 42,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00298',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rounded_total_export',
+		'idx': 43,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00299',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rounded_total_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'in_words_export',
+		'idx': 44,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00300',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'in_words_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 45,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00301',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 46,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00302',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 47,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00303',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 48,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00304',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 49,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00305',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 50,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00306',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_mobile_no',
+		'idx': 50,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00310',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_mobile_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tax_amount',
+		'idx': 51,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00307',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tax_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total',
+		'idx': 52,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00308',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'idx',
+		'idx': 53,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00309',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'idx'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_person',
+		'idx': 54,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00311',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_percentage',
+		'idx': 55,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00312',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_percentage'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_amount',
+		'idx': 56,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00313',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tc_name',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00314',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tc_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00317',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'source',
+		'idx': 58,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00315',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'source'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'campaign',
+		'idx': 59,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00316',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'campaign'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 60,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00318',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_team',
+		'from_table': 'Sales Team',
+		'idx': 1,
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000031',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'sales_team',
+		'to_table': 'Sales Team',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'other_charges',
+		'from_table': 'RV Tax Detail',
+		'idx': 2,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000032',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'other_charges',
+		'to_table': 'RV Tax Detail',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'quotation_details',
+		'from_table': 'Quotation Detail',
+		'idx': 3,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000033',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': None,
+		'to_field': 'sales_order_details',
+		'to_table': 'Sales Order Detail',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Quotation',
+		'idx': 4,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000034',
+		'owner': 'Administrator',
+		'parent': 'Quotation-Sales Order',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': 'prevdoc_docname',
+		'to_field': None,
+		'to_table': 'Sales Order',
+		'validation_logic': 'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Receivable Voucher-Delivery Note/Receivable Voucher-Delivery Note.txt b/mapper/DocType Mapper/Receivable Voucher-Delivery Note/Receivable Voucher-Delivery Note.txt
new file mode 100755
index 0000000..3b4e8ba
--- /dev/null
+++ b/mapper/DocType Mapper/Receivable Voucher-Delivery Note/Receivable Voucher-Delivery Note.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Receivable Voucher-Delivery Note', 'parent': None, 'to_doctype': 'Delivery Note', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Receivable Voucher', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00521', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'currency', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'currency', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00522', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'company', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00523', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'fiscal_year', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'fiscal_year', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00524', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'customer', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00525', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'customer_name', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00526', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'price_list_name', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': '', 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'price_list_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00527', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'conversion_rate', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'conversion_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00528', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'charge', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'charge', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00529', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'terms', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'terms', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00530', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'item_code', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00531', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'item_name', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00532', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'brand', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'brand', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00533', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'description', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00534', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'item_group', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 14, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00535', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'qty', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 15, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval: flt(obj.qty) - flt(obj.delivered_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00536', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'base_ref_rate', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 16, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'base_ref_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00537', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'ref_rate', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 17, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'ref_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00538', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'basic_rate', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 18, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'basic_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00539', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'export_rate', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 19, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'export_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00540', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'prevdoc_docname', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 20, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00541', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'prevdoc_doctype', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 21, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00542', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'prevdoc_detail_docname', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 22, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00543', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'export_rate', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 23, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'export_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00544', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'amount', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 24, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00545', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'export_amount', 'creation': '2010-12-14 16:40:41', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 25, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00546', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'adj_rate', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 26, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'adj_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00547', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'item_tax_rate', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 27, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_tax_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00548', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'warehouse', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 28, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'warehouse', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00549', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'charge_type', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 29, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'charge_type', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00550', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'row_id', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 30, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'row_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00551', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'item_wise_tax_detail', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 31, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_wise_tax_detail', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00552', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'description', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 32, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00553', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'account_head', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 33, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'account_head', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00554', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'rate', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 34, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00555', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'tax_amount', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 35, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'tax_amount', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00556', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'total', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 36, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'total', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00557', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'sales_person', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 3, 'idx': 37, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'sales_person', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00558', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'allocated_percentage', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 3, 'idx': 38, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'allocated_percentage', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00559', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'allocated_amount', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 3, 'idx': 39, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'allocated_amount', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00560', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'source', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 40, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'source', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00561', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'campaign', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 41, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'campaign', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00562', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'sales_partner', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 42, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'sales_partner', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00563', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'customer_address', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 43, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00564', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'delivery_address', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 44, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00565', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'net_total', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 45, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'net_total', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00566', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'grand_total', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 46, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'grand_total', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00567', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'territory', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 47, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'Administrator', 'name': 'FMD/00568', 'parent': 'Receivable Voucher-Delivery Note', 'to_field': 'project_name', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 48, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'project_name', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'Administrator', 'name': 'TMD/0000056', 'parent': 'Receivable Voucher-Delivery Note', 'reference_doctype_key': '', 'to_field': None, 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Receivable Voucher', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Delivery Note', 'from_field': '', 'validation_logic': 'docstatus=1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'Administrator', 'name': 'TMD/0000057', 'parent': 'Receivable Voucher-Delivery Note', 'reference_doctype_key': '', 'to_field': 'delivery_note_details', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'RV Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Delivery Note Detail', 'from_field': 'entries', 'validation_logic': 'docstatus = 1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'Administrator', 'name': 'TMD/0000058', 'parent': 'Receivable Voucher-Delivery Note', 'reference_doctype_key': '', 'to_field': 'other_charges', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Table Mapper Detail', 'match_id': 2, 'idx': 3, 'parenttype': 'DocType Mapper', 'from_table': 'RV Tax Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'RV Tax Detail', 'from_field': 'other_charges', 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'Administrator', 'name': 'TMD/0000059', 'parent': 'Receivable Voucher-Delivery Note', 'reference_doctype_key': '', 'to_field': 'sales_team', 'creation': '2010-12-14 16:40:42', 'modified': '2010-12-14 20:43:41', 'doctype': 'Table Mapper Detail', 'match_id': 3, 'idx': 4, 'parenttype': 'DocType Mapper', 'from_table': 'Sales Team', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Sales Team', 'from_field': 'sales_team', 'validation_logic': 'name is not null', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt b/mapper/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt
new file mode 100644
index 0000000..ebabada
--- /dev/null
+++ b/mapper/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt
@@ -0,0 +1,388 @@
+[
+	{
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'DocType Mapper',
+		'from_doctype': 'Salary Structure',
+		'idx': None,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Salary Structure-Salary Slip',
+		'owner': 'harshada@webnotestech.com',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': None,
+		'to_doctype': 'Salary Slip'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'employee',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00598',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'employee'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'employee_name',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00599',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'employee_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'department',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00600',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'department'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'designation',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00601',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'designation'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'branch',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00602',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'branch'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grade',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00603',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grade'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-10 15:57:32',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_earning',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00657',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'gross_pay'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-10 15:57:32',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_deduction',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00656',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total_deduction'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-10 15:57:32',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'net_pay',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00658',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'net_pay'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'e_type',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00604',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'e_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'modified_value',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00605',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'e_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-10 15:57:32',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'modified_value',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00660',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'e_modified_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-11 12:50:51',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'depend_on_lwp',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00661',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'e_depends_on_lwp'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'd_type',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00606',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'd_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'd_modified_amt',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00607',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'd_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-10 15:57:32',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'd_modified_amt',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00659',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'd_modified_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-11 12:50:51',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'depend_on_lwp',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00662',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'd_depends_on_lwp'
+	},
+	{
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Salary Structure',
+		'idx': 1,
+		'match_id': 0,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000063',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Salary Slip',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'earning_details',
+		'from_table': 'Earning Detail',
+		'idx': 2,
+		'match_id': 1,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000064',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'earning_details',
+		'to_table': 'SS Earning Detail',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-12-14 10:23:25',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'deduction_details',
+		'from_table': 'Deduction Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-02-12 18:31:40',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000065',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure-Salary Slip',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'deduction_details',
+		'to_table': 'SS Deduction Detail',
+		'validation_logic': 'name is not null'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt b/mapper/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
new file mode 100644
index 0000000..ef4cf6c
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
@@ -0,0 +1,1473 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Sales Order',
+		'idx': None,
+		'modified': '2011-05-16 11:48:19',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Sales Order-Delivery Note',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Delivery Note'
+	},
+	{
+		'checking_operator': '>=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'transaction_date',
+		'idx': 1,
+		'map': 'No',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00320',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'transaction_date'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'price_list_name',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00321',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'price_list_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00322',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_order_no'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00323',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00324',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'po_date',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00325',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'po_date'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'po_no',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00326',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'po_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_partner',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00327',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_partner'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'commission_rate',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00328',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'commission_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_commission',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00329',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total_commission'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00331',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00332',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 12:58:43',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'shipping_address_name',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': '000003464',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00334',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'delivery_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00336',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00333',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00335',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 12:58:43',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'shipping_address',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': '000003465',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 12:58:43',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': '000003466',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_no',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00337',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 12:58:43',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': '000003467',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'email_id',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00338',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'email_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 12:58:43',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': '000003468',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-24 14:08:13',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'ship_det_no',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-03-24 14:08:13',
+		'modified_by': 'rahul@webnotestech.com',
+		'name': '000002010',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'ship_det_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-24 14:08:13',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'ship_to',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-03-24 14:08:13',
+		'modified_by': 'rahul@webnotestech.com',
+		'name': '000002011',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'ship_to'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00340',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-24 14:08:13',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'shipping_address',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-03-24 14:08:13',
+		'modified_by': 'rahul@webnotestech.com',
+		'name': '000002012',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'shipping_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00339',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00341',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parenttype',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00342',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00343',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_detail_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_rate',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00344',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00345',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00346',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00347',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00348',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00349',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00350',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'base_ref_rate',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00351',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'base_ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'ref_rate',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00352',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'adj_rate',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00353',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'adj_rate'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'basic_rate',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00354',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'basic_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: flt(obj.qty) - flt(obj.delivered_qty)',
+		'idx': 38,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00355',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00356',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'reserved_warehouse',
+		'idx': 40,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00357',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'warehouse'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 41,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00358',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 42,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00359',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 43,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00360',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 44,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00361',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 45,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00362',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 46,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00363',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 47,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00364',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tax_amount',
+		'idx': 48,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00365',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tax_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total',
+		'idx': 49,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00366',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'idx',
+		'idx': 50,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00367',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'idx'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'net_total',
+		'idx': 51,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00368',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'net_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'other_charges_total',
+		'idx': 52,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00369',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'other_charges_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total',
+		'idx': 53,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00370',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rounded_total',
+		'idx': 54,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00371',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rounded_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'in_words',
+		'idx': 55,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00372',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'in_words'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total_export',
+		'idx': 56,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00373',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rounded_total_export',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00374',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rounded_total_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_mobile_no',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:35',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00376',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_mobile_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'in_words_export',
+		'idx': 58,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00375',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'in_words_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 12:58:43',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_amount',
+		'idx': 59,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': '000003469',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_mobile_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_amount',
+		'idx': 60,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00377',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_percentage',
+		'idx': 60,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00378',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_percentage'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_person',
+		'idx': 61,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00379',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'source',
+		'idx': 62,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00380',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'source'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'campaign',
+		'idx': 63,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00381',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'campaign'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 64,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00382',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 65,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00384',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 66,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00383',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tc_name',
+		'idx': 66,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00385',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tc_name'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-09-09 12:52:00',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 67,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00592',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-09-09 12:52:00',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 70,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00593',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_team',
+		'from_table': 'Sales Team',
+		'idx': 1,
+		'match_id': 3,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000035',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'sales_team',
+		'to_table': 'Sales Team',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'other_charges',
+		'from_table': 'RV Tax Detail',
+		'idx': 2,
+		'match_id': 2,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000036',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'other_charges',
+		'to_table': 'RV Tax Detail',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_order_details',
+		'from_table': 'Sales Order Detail',
+		'idx': 3,
+		'match_id': 1,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000037',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': 'prevdoc_detail_docname',
+		'to_field': 'delivery_note_details',
+		'to_table': 'Delivery Note Detail',
+		'validation_logic': 'qty > ifnull(delivered_qty,0) and docstatus = 1'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Sales Order',
+		'idx': 4,
+		'match_id': 0,
+		'modified': '2011-05-20 12:58:43',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000038',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Delivery Note',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': 'prevdoc_docname',
+		'to_field': None,
+		'to_table': 'Delivery Note',
+		'validation_logic': 'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt b/mapper/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt
new file mode 100755
index 0000000..4094ddd
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt
@@ -0,0 +1,331 @@
+[
+	{
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'DocType Mapper',
+		'from_doctype': 'Sales Order',
+		'idx': None,
+		'modified': '2011-05-04 14:49:55',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Sales Order-Indent',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Indent'
+	},
+	{
+		'checking_operator': '>=',
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'transaction_date',
+		'idx': 1,
+		'map': 'No',
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000724',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'transaction_date'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000725',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000726',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tc_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000727',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tc_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000728',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'letter_head',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000729',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'letter_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000730',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_order_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000731',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000732',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000733',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000734',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000735',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'qty',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000736',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'reserved_warehouse',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000737',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'warehouse'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000738',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_order_details',
+		'from_table': 'Sales Order Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000739',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': 'prevdoc_detail_docname',
+		'to_field': 'indent_details',
+		'to_table': 'Indent Detail',
+		'validation_logic': 'qty > ifnull(indented_qty,0) and docstatus = 1'
+	},
+	{
+		'creation': '2011-05-09 16:46:12',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Sales Order',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-09 16:46:12',
+		'modified_by': 'Administrator',
+		'name': '000000740',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Indent',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': 'prevdoc_docname',
+		'to_field': None,
+		'to_table': 'Indent',
+		'validation_logic': 'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Maintenance Report/Sales Order-Maintenance Report.txt b/mapper/DocType Mapper/Sales Order-Maintenance Report/Sales Order-Maintenance Report.txt
new file mode 100644
index 0000000..fd74f39
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Maintenance Report/Sales Order-Maintenance Report.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Sales Order-Maintenance Report', 'parent': None, 'to_doctype': 'Maintenance Report', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Sales Order', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00793', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'customer_name', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00794', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'address', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'customer_address', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00795', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'contact_person', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'contact_person', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00796', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'territory', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'territory', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00797', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'company', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00798', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'fiscal_year', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'fiscal_year', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00817', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'sales_order_no', 'creation': '2010-07-27 14:55:55', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00799', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'item_code', 'creation': '2010-07-15 08:17:07', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00820', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'description', 'creation': '2010-07-28 08:01:17', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00807', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'prevdoc_docname', 'creation': '2010-07-15 08:36:25', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00808', 'parent': 'Sales Order-Maintenance Report', 'to_field': 'prevdoc_doctype', 'creation': '2010-07-15 08:40:45', 'modified': '2010-07-28 08:01:17', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000076', 'parent': 'Sales Order-Maintenance Report', 'is_reference_table': None, 'to_field': 'maintenance_report_details', 'creation': '2010-07-15 08:17:07', 'reference_doctype_key': '', 'modified': '2010-07-28 08:01:17', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Sales Order Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Maintenance Report Detail', 'from_field': 'sales_order_details', 'validation_logic': 'docstatus=1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000077', 'parent': 'Sales Order-Maintenance Report', 'is_reference_table': None, 'to_field': None, 'creation': '2010-07-15 08:17:07', 'reference_doctype_key': '', 'modified': '2010-07-28 08:01:17', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'Sales Order', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Maintenance Report', 'from_field': None, 'validation_logic': 'docstatus=1', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt b/mapper/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt
new file mode 100644
index 0000000..bb6c771
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt
@@ -0,0 +1,369 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Sales Order',
+		'idx': None,
+		'modified': '2011-05-18 11:05:26',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Sales Order-Maintenance Schedule',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Maintenance Schedule'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-09-15 14:15:40',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00594',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003515',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:36',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00398',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00399',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00397',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003516',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003517',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003518',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003519',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00400',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003520',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00401',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00402',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_order_no'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00403',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00404',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00405',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00406',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_order_details',
+		'from_table': 'Sales Order Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000041',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'item_maintenance_detail',
+		'to_table': 'Item Maintenance Detail',
+		'validation_logic': 'docstatus =1'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Sales Order',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000042',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Schedule',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Maintenance Schedule',
+		'validation_logic': 'docstatus=1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt b/mapper/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt
new file mode 100644
index 0000000..4196cb8
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt
@@ -0,0 +1,405 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Sales Order',
+		'idx': None,
+		'modified': '2011-05-18 13:35:55',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Sales Order-Maintenance Visit',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Maintenance Visit'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003521',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003522',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2010-08-08 17:09:36',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00408',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00409',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00407',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003523',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003524',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003525',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003526',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00410',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:27',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': '000003527',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00411',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00412',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00413',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_order_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00414',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00415',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00416',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00417',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parenttype',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00418',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_order_details',
+		'from_table': 'Sales Order Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000043',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'maintenance_visit_details',
+		'to_table': 'Maintenance Visit Detail',
+		'validation_logic': 'docstatus=1'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Sales Order',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:27',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000044',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Sales Order-Maintenance Visit',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Maintenance Visit',
+		'validation_logic': 'docstatus=1'
+	}
+]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Production Plan/Sales Order-Production Plan.txt b/mapper/DocType Mapper/Sales Order-Production Plan/Sales Order-Production Plan.txt
new file mode 100644
index 0000000..04dc127
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Production Plan/Sales Order-Production Plan.txt
@@ -0,0 +1 @@
+[{'modified_by': 'nabin@webnotestech.com', 'name': 'Sales Order-Production Plan', 'parent': None, 'to_doctype': 'Production Plan', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Sales Order', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00515', 'parent': 'Sales Order-Production Plan', 'to_field': 'against_document', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00516', 'parent': 'Sales Order-Production Plan', 'to_field': 'document_no', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00511', 'parent': 'Sales Order-Production Plan', 'to_field': 'item_code', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00512', 'parent': 'Sales Order-Production Plan', 'to_field': 'description', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00513', 'parent': 'Sales Order-Production Plan', 'to_field': 'stock_uom', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00514', 'parent': 'Sales Order-Production Plan', 'to_field': 'prevdoc_total_qty', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00517', 'parent': 'Sales Order-Production Plan', 'to_field': 'document_date', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'transaction_date', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'nabin@webnotestech.com', 'name': 'FMD/00518', 'parent': 'Sales Order-Production Plan', 'to_field': 'delivery_date', 'creation': '2009-09-08 15:40:01', 'modified': '2009-12-21 13:16:59', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'delivery_date', 'parentfield': 'field_mapper_details'}, {'reference_key': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'TMD/0000050', 'parent': 'Sales Order-Production Plan', 'is_reference_table': None, 'to_field': None, 'creation': '2009-09-08 15:40:01', 'reference_doctype_key': None, 'modified': '2009-12-21 13:16:59', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Sales Order', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Production Plan', 'from_field': '', 'validation_logic': 'docstatus =1', 'parentfield': 'table_mapper_details'}, {'reference_key': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'TMD/0000051', 'parent': 'Sales Order-Production Plan', 'is_reference_table': None, 'to_field': 'pp_details', 'creation': '2009-09-08 15:40:01', 'reference_doctype_key': None, 'modified': '2009-12-21 13:16:59', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'Delivery Note Packing Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'PP Detail', 'from_field': 'packing_details', 'validation_logic': 'docstatus =1 and qty > planned_qty', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/mapper/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt b/mapper/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt
new file mode 100644
index 0000000..c0c5e44
--- /dev/null
+++ b/mapper/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt
@@ -0,0 +1,1347 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': u'DocType Mapper',
+		'from_doctype': 'Sales Order',
+		'idx': None,
+		'modified': '2011-05-16 17:34:21',
+		'modified_by': 'Administrator',
+		'module': 'Mapper',
+		'name': 'Sales Order-Receivable Voucher',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Receivable Voucher'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00427',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_address',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00428',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_address'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:28',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000003528',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-25 12:28:22',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_name',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00595',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:28',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'address_display',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000003529',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'address_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:28',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_display',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000003530',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_display'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:28',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_mobile',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000003531',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_mobile'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:28',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_email',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000003532',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_email'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-20 15:54:28',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'customer_group',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000003533',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'customer_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00429',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00430',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00431',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00432',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'price_list_name',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00433',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'price_list_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00434',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00435',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00436',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00437',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00438',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00439',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'base_ref_rate',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00440',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'base_ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_rate',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-02-15 16:03:10',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00447',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'ref_rate',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00441',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'ref_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'basic_rate',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00442',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'basic_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00443',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00445',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_order'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-15 14:26:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000001851',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00446',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'so_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'export_rate',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00444',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.basic_rate)',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00448',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.export_rate)',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00449',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'export_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'adj_rate',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00450',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'adj_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00451',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00452',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00453',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00454',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 38,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00455',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_amount',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00456',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'territory',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00463',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'territory'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_tax_amount',
+		'idx': 40,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00457',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total_tax_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 41,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00458',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'cost_center_other_charges',
+		'idx': 42,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00459',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'cost_center_other_charges'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 43,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00460',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tax_amount',
+		'idx': 44,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00461',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tax_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total',
+		'idx': 45,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00462',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'source',
+		'idx': 46,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00464',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'source'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'campaign',
+		'idx': 47,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00465',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'campaign'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'tc_name',
+		'idx': 48,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00466',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'tc_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'select_print_heading',
+		'idx': 49,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00467',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'select_print_heading'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 50,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00468',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'net_total',
+		'idx': 51,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00469',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'net_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total',
+		'idx': 52,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00470',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'other_charges_total',
+		'idx': 53,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00471',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'other_charges_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rounded_total',
+		'idx': 54,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00472',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rounded_total'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'in_words',
+		'idx': 55,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00473',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'in_words'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'grand_total_export',
+		'idx': 56,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00474',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'grand_total_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-15 14:26:12',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_no',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000001852',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_no'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rounded_total_export',
+		'idx': 57,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00475',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rounded_total_export'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'in_words_export',
+		'idx': 58,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00476',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'in_words_export'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 59,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00591',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_partner',
+		'idx': 60,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00663',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_partner'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_designation',
+		'idx': 61,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00667',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_designation'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'commission_rate',
+		'idx': 62,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00664',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'commission_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'total_commission',
+		'idx': 63,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00665',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'total_commission'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_percentage',
+		'idx': 64,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00668',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_percentage'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'sales_person',
+		'idx': 65,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00666',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'sales_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'allocated_amount',
+		'idx': 66,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00669',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'allocated_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'incentives',
+		'idx': 67,
+		'map': 'Yes',
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00670',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'incentives'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-05-06 17:41:54',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'reserved_warehouse',
+		'idx': 68,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': '000002943',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'warehouse'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Sales Order',
+		'idx': 1,
+		'match_id': 0,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000047',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': None,
+		'to_table': 'Receivable Voucher',
+		'validation_logic': 'docstatus=1'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_order_detail',
+		'from_table': 'Sales Order Detail',
+		'idx': 2,
+		'match_id': 1,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000048',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'entries',
+		'to_table': 'RV Detail',
+		'validation_logic': '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1'
+	},
+	{
+		'creation': '2010-08-08 17:09:36',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'other_charges',
+		'from_table': 'RV Tax Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000049',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'other_charges',
+		'to_table': 'RV Tax Detail',
+		'validation_logic': 'name is not null'
+	},
+	{
+		'creation': '2011-02-15 18:38:11',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'sales_team',
+		'from_table': 'Sales Team',
+		'idx': 4,
+		'match_id': 3,
+		'modified': '2011-05-20 15:54:28',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000070',
+		'owner': 'Administrator',
+		'parent': 'Sales Order-Receivable Voucher',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'sales_team',
+		'to_table': 'Sales Team',
+		'validation_logic': 'name is not null'
+	}
+]
\ No newline at end of file
diff --git a/mapper/Module Def/Mapper/Mapper.txt b/mapper/Module Def/Mapper/Mapper.txt
new file mode 100644
index 0000000..c2c06b5
--- /dev/null
+++ b/mapper/Module Def/Mapper/Mapper.txt
@@ -0,0 +1,29 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:41:12',
+		'disabled': None,
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module_desc': 'Mapper',
+		'module_icon': None,
+		'module_label': 'Mapper',
+		'module_name': 'Mapper',
+		'module_page': None,
+		'module_seq': None,
+		'name': 'Mapper',
+		'owner': 'saumil@webnotestech.com',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	}
+]
\ No newline at end of file
diff --git a/mapper/__init__.py b/mapper/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mapper/__init__.py
diff --git a/master.sql.gz b/master.sql.gz
new file mode 100644
index 0000000..4de5d60
--- /dev/null
+++ b/master.sql.gz
Binary files differ
diff --git a/material_management/Item Group/All Item Groups/All Item Groups.txt b/material_management/Item Group/All Item Groups/All Item Groups.txt
new file mode 100644
index 0000000..f03fa1a
--- /dev/null
+++ b/material_management/Item Group/All Item Groups/All Item Groups.txt
@@ -0,0 +1 @@
+[{'creation': '2010-07-16 11:03:21', 'doctype': 'Item Group', 'lft': 1, 'owner': 'harshada@webnotestech.com', 'rgt': 286, 'company_abbr': None, 'docstatus': 0, 'item_group_name': 'All Item Groups', 'description': None, 'parent': None, 'is_group': 'Yes', 'company': None, 'show_in_catalogue': None, 'group_or_ledger': None, 'modified_by': 'harshada@webnotestech.com', 'group_name': None, 'trash_reason': None, 'name': 'All Item Groups', 'idx': None, 'modified': '2010-07-16 11:03:21', 'parent_item_group': '', 'old_parent': '', 'parenttype': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/material_management/Item Group/Default/Default.txt b/material_management/Item Group/Default/Default.txt
new file mode 100644
index 0000000..c0b6207
--- /dev/null
+++ b/material_management/Item Group/Default/Default.txt
@@ -0,0 +1 @@
+[{'creation': '2010-07-05 16:08:14', 'doctype': 'Item Group', 'lft': 76, 'owner': 'nabin@webnotestech.com', 'rgt': 77, 'company_abbr': None, 'docstatus': 0, 'item_group_name': 'Default', 'description': None, 'parent': None, 'is_group': 'No', 'company': None, 'show_in_catalogue': None, 'group_or_ledger': None, 'modified_by': 'nabin@webnotestech.com', 'group_name': None, 'trash_reason': None, 'name': 'Default', 'idx': None, 'modified': '2010-07-05 16:08:14', 'parent_item_group': 'All Item Groups', 'old_parent': '', 'parenttype': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/material_management/Module Def/Material Management/Material Management.txt b/material_management/Module Def/Material Management/Material Management.txt
new file mode 100644
index 0000000..fe9d0a9
--- /dev/null
+++ b/material_management/Module Def/Material Management/Material Management.txt
@@ -0,0 +1,378 @@
+[
+	{
+		'creation': '2010-09-25 10:50:35',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2011-04-19 11:49:10',
+		'modified_by': 'Administrator',
+		'module_desc': 'Material Management',
+		'module_icon': 'Stock.gif',
+		'module_label': 'Stock',
+		'module_name': 'Material Management',
+		'module_page': None,
+		'module_seq': 6,
+		'name': 'Material Management',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Item master',
+		'display_name': 'Item',
+		'doc_name': 'Item',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'name\nitem_group\ndescription',
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01077',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Record of items added, removed or moved from one warehouse to another.',
+		'display_name': 'Stock Entry',
+		'doc_name': 'Stock Entry',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'transfer_date\npurpose\nfrom_warehouse\nto_warehouse\nremarks',
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01078',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Record of items delivered to your customers along with the Printed Note',
+		'display_name': 'Delivery Note',
+		'doc_name': 'Delivery Note',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\ncustomer\nterritory\ngrand_total\nper_billed',
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01079',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Record of incoming material from your suppliers',
+		'display_name': 'Purchase Receipt',
+		'doc_name': 'Purchase Receipt',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\nsupplier\ngrand_total\nper_billed',
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01080',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Details of Installation done after delivery',
+		'display_name': 'Installation Note',
+		'doc_name': 'Installation Note',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01081',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Create Quality Inspection Report for any item',
+		'display_name': 'Inspection Report',
+		'doc_name': 'QA Inspection Report',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'inspection_type\nitem_code\nreport_date\npurchase_receipt_no\ndelivery_note_no',
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01082',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Reconcile your stock by uploading it form an excel file',
+		'display_name': 'Stock Reconciliation',
+		'doc_name': 'Stock Reconciliation',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'reconciliation_date\nreconciliation_time\nremark',
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01083',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'This utility tool will update Stock UOM in Item and will respectively update Actual Qty in Stock Ledger as per Conversion Factor.',
+		'display_name': 'Stock UOM Replace Utility',
+		'doc_name': 'Stock UOM Replace Utility',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01084',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'This utility will help in tracking stock for Sales Return and Purchase Return.',
+		'display_name': 'Sales and Purchase Return Wizard',
+		'doc_name': 'Sales and Purchase Return Wizard',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01085',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Stock Ledger',
+		'doc_name': 'Stock Ledger Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01088',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Stock Level',
+		'doc_name': 'Bin',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01089',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Shortage To Indent',
+		'doc_name': 'Item',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 12,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01090',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Stock Value as per Item and Warehouse',
+		'display_name': 'Stock Report',
+		'doc_name': 'Stock Ledger Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 13,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01091',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Stock Aging Report',
+		'doc_name': 'Serial No',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 14,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01092',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Material Management',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00292',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material User'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00293',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Master Manager'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00294',
+		'owner': 'Administrator',
+		'parent': 'Material Management',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Manager'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00295',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Material Management',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Quality Manager'
+	}
+]
\ No newline at end of file
diff --git a/material_management/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt b/material_management/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt
new file mode 100644
index 0000000..3314962
--- /dev/null
+++ b/material_management/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Purchase Receipt Format', 'parent': None, 'creation': '2009-03-12 12:10:22', 'modified': '2009-09-07 11:03:11', 'module': 'Material Management', 'doctype': 'Print Format', 'idx': None, 'parenttype': None, 'html': '<html>\n<head>\n<!--Other charges function-->\n<script>\n    var make_row = function(title,val,bold){\n    var bstart = \'<b>\'; var bend = \'</b>\';\n    return \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n              +\'<td style="width:20%;text-align:right">\'+doc.currency+\'</td>\'\n              +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n              +\'</tr>\'\n  }\n\n  function get_other_charges(){\n    var out =\'\';\n    out += \'<div><table class="noborder" style="width:100%">\';\n    out += make_row(\'Total Amount\',fmt_money(convert_rate(doc.total_amount)),1)\n          +make_row(\'Grand Total\',fmt_money(convert_rate(doc.grand_total)),1);\n    out += \'</table></div>\';\n    return out;\n  }\n\n  function get_buying_costs(){\n    var out =\'\';\n    if(doc.buying_cost_transport || doc.buying_cost_taxes || doc.buying_cost_other){\n      out += \'<div><table class="noborder" style="width:100%">\'\n            + \'<tr><td style="width:100%"><b>\'+\'Buying Cost Details\'+\'</b></td></tr>\';\n      if(doc.buying_cost_transport){ out += make_row(\'Transport Cost\',fmt_money(convert_rate(doc.buying_cost_transport)),0)}\n      if(doc.buying_cost_taxes){ out += make_row(\'Taxes\',fmt_money(convert_rate(doc.buying_cost_taxes)),0)}\n      if(doc.buying_cost_other){ out += make_row(\'Other Cost\',fmt_money(convert_rate(doc.buying_cost_other)),0)}\n      out += \'</table></div>\';\n    }\n    return out;\n  }\n\n  function get_letter_head(){\n    var cp = locals[\'Control Panel\'][\'Control Panel\'];\n  \tif(cp.letter_head) {return cp.letter_head; }\n  }\n  \n  function convert_rate(val){\n    var new_val = flt(val)/flt(doc.conversion_rate);\n    return new_val;\n  }\n  \n    function get_transport_details(){\n    var out = \'\';\n    if(doc.transporter_name || doc.lr_no || doc.lr_date){\n     out += \'<div><table class="noborder" style="width:40%">\'\n            +\'<tr><td style="width:80%"><b>\' + \'Transporter Details\'+\'</b></td><td style="width:20%"></td></tr>\'\n\n     if(doc.transporter_name){ out += \'<tr><td style="width:40%">\' + \'Transporter Name\'+\'</td><td style="width:60%">\'+doc.transporter_name+\'</td></tr>\'}\n     if(doc.lr_no){ out += \'<tr><td style="width:40%">\' + \'LR No\'+\'</td><td style="width:60%">\'+doc.lr_no+\'</td></tr>\'}\n     if(doc.lr_date){ out += \'<tr><td style="width:40%">\' + \'LR Date\'+\'</td><td style="width:60%">\'+doc.lr_date+\'</td></tr>\'}\n     out += \'</table></div>\'\n    }\n    return out;\n  }\n\n</script>\n</head>\n<body>\n<div style="border:1px solid black;padding:15px">\n<!--header-->\n<div><script>get_letter_head()</script></div>\n<div style="border-bottom: 1px solid; padding-bottom: 5px;">\n <div><br><b>Purchase Receipt: <script>doc.name</script></b></div>\n <div>Date: <script>date.str_to_user(doc.transaction_date)</script></div>\n</div>\n\n<div style="padding-top:15px">\n<div><script>doc.supplier</script></div>\n<div><br><script>replace_newlines(doc.supplier_address)</script></div>\n</div>\n\n<div>\n<br>\n    <script>\n    var t = print_table(\'Purchase Receipt\', doc.name, \'purchase_receipt_details\', \'Purchase Receipt Detail\', [\'SR\', \'item_code\',\'description\',\'received_qty\',\'qty\',\'rejected_qty\',\'po_rate\',\'amount\',\'billed_qty\'], [\'Sr\', \'Item Code\', \'Description\',\'Received Quantity\',\'Accepted Qty\',\'Rejected Qty\',\'Rate\',\'Amount\',\'Billed Qty\'], [\'4%\',\'12%\', \'24%\', \'10%\',\'10%\',\'10%\',\'10%\',\'10%\',\'10%\'])\n    if(t.appendChild) {\n      // single\n      out = t.innerHTML;\n    } \n    else {//multiple\n      out = \'\'\n      for(var i=0;i<t.length;i++) {\n        if(i!=t.length-1){\n          out += \'<div style:"padding-top:5px;"></div>\' + t[i].innerHTML +\'<div style="page-break-after:always"></div>\';\n        }\n        else out += \'<div style:"padding-top:5px;"></div>\' + t[i].innerHTML;\n      }\n    }\n    out;\n    </script>\n\n</div>\n\n<!--Other charges table-->\n<div>\n<table style="width:100%">\n  <tr><td style="width:40%"><script>get_buying_costs()</script></td>\n  <td style="width:20%"></td><td style="width:40%"><script>get_other_charges()</script></td></tr>\n</table>\n</div>\n<div><script>get_transport_details()</script></div>\n<div><br>Payment Terms</div>\n<div><br><script>replace_newlines(doc.payment_terms)</script></div>\n<div><br>For NCSCI</div>\n<div><br><br>(Authorised Signatory)</div>\n</div></body>\n</html>', 'owner': 'Administrator', 'docstatus': 0, 'standard': 'Yes', 'parentfield': None}]
\ No newline at end of file
diff --git a/material_management/__init__.py b/material_management/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/__init__.py
diff --git a/material_management/doctype/__init__.py b/material_management/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/__init__.py
diff --git a/material_management/doctype/batch/__init__.py b/material_management/doctype/batch/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/batch/__init__.py
diff --git a/material_management/doctype/batch/batch.txt b/material_management/doctype/batch/batch.txt
new file mode 100644
index 0000000..d4abe1a
--- /dev/null
+++ b/material_management/doctype/batch/batch.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-27 13:54:26', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Batch', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00984', 'parent': 'Batch', 'read': 1, 'create': 1, 'creation': '2010-04-27 13:54:26', 'modified': '2010-09-20 08:57:05', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01001', 'parent': 'Batch', 'read': 1, 'create': None, 'creation': '2010-05-10 11:00:48', 'modified': '2010-09-20 08:57:05', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-10 10:58:39', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04990', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-27 13:54:26', 'doctype': 'DocField', 'oldfieldname': 'batch_id', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Batch ID', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04904', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'batch_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-27 13:54:26', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04905', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-27 13:54:26', 'doctype': 'DocField', 'oldfieldname': 'start_date', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Batch Started Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04906', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'start_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-27 13:54:26', 'doctype': 'DocField', 'oldfieldname': 'finished_date', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Batch Finished Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04907', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'finished_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-27 13:54:26', 'doctype': 'DocField', 'oldfieldname': 'expiry_date', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expiry Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04908', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'expiry_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-27 13:57:16', 'doctype': 'DocField', 'oldfieldname': 'item', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Item', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Batch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04909', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:05', 'parenttype': 'DocType', 'fieldname': 'item', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/bin/__init__.py b/material_management/doctype/bin/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/bin/__init__.py
diff --git a/material_management/doctype/bin/bin.py b/material_management/doctype/bin/bin.py
new file mode 100644
index 0000000..dfaf81a
--- /dev/null
+++ b/material_management/doctype/bin/bin.py
@@ -0,0 +1,294 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:	
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+	# -------------
+	# stock update
+	# -------------
+	def update_stock(self, actual_qty=0, reserved_qty=0, ordered_qty=0, indented_qty=0, planned_qty=0, dt=None, sle_id='', posting_time='', serial_no = ''):
+
+		if not dt: dt = nowdate()
+		# update the stock values (for current quantities)
+		self.doc.actual_qty = flt(self.doc.actual_qty) + flt(actual_qty)
+		self.doc.ordered_qty = flt(self.doc.ordered_qty) + flt(ordered_qty)						
+		self.doc.reserved_qty = flt(self.doc.reserved_qty) + flt(reserved_qty)
+		self.doc.indented_qty = flt(self.doc.indented_qty) + flt(indented_qty)
+		self.doc.planned_qty = flt(self.doc.planned_qty) + flt(planned_qty)
+		self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + flt(self.doc.indented_qty) + flt(self.doc.planned_qty) - flt(self.doc.reserved_qty)
+
+		self.doc.save()
+
+		# update valuation for post dated entry
+		if actual_qty:
+			prev_sle = self.get_prev_sle(sle_id, dt, posting_time, serial_no)
+			cqty = flt(prev_sle.get('bin_aqat', 0))
+			# Block if actual qty becomes negative
+			if (flt(cqty) + flt(actual_qty)) < 0 and flt(actual_qty) < 0:
+				msgprint('Not enough quantity (requested: %s, current: %s) for Item <b>%s</b> in Warehouse <b>%s</b> as on %s %s' % (flt(actual_qty), flt(cqty), self.doc.item_code, self.doc.warehouse, dt, posting_time), raise_exception = 1)
+
+			self.update_item_valuation(sle_id, dt, posting_time, serial_no, prev_sle)
+
+	# --------------------------------
+	# get first stock ledger entry
+	# --------------------------------
+	
+	def get_first_sle(self):
+		sle = sql("""
+			select * from `tabStock Ledger Entry`
+			where item_code = %s
+			and warehouse = %s
+			order by timestamp(posting_date, posting_time) asc, name asc
+			limit 1
+		""", (self.doc.item_code, self.doc.warehouse), as_dict=1)
+		return sle and sle[0] or None
+
+	# --------------------------------
+	# get previous stock ledger entry
+	# --------------------------------
+			
+	def get_prev_sle(self, sle_id, posting_date, posting_time, serial_no = ''):
+		# this function will only be called for a live entry
+		# for which the "name" will be the latest (even for the same timestamp)
+		# and even for a back-dated entry
+		# hence there cannot be any "backdated entries" with a name greater than the
+		# current one
+		
+		# if there are multiple entries on this timestamp, then the last one will be with
+		# the last "name"		
+		# else, the last entry will be the highest name at the previous timestamp
+		# hence, the double sort on timestamp and name should be sufficient condition
+		# to get the last sle
+
+		sle = sql("""
+			select * from `tabStock Ledger Entry`
+			where item_code = %s
+			and warehouse = %s
+			and name != %s
+			and timestamp(posting_date, posting_time) <= timestamp(%s, %s)
+			order by timestamp(posting_date, posting_time) desc, name desc
+			limit 1
+		""", (self.doc.item_code, self.doc.warehouse, sle_id, posting_date, posting_time), as_dict=1)
+
+		return sle and sle[0] or {}
+
+
+
+
+	# --------------------------------------------------------------------------------------------------------------------------------------
+	# validate negative stock (validate if stock is going -ve in between for back dated entries will consider only is_cancel = 'No' entries)
+	# --------------------------------------------------------------------------------------------------------------------------------------
+	def validate_negative_stock(self, cqty, s):
+		if cqty + s['actual_qty'] < 0 and s['is_cancelled'] != 'Yes':
+			msgprint(cqty)
+			msgprint(s['actual_qty'])
+			msgprint('Cannot complete this transaction because stock will become negative for Item <b>%s</b> in Warehouse <b>%s</b> on Posting Date <b>%s</b>' % \
+				(self.doc.item_code, self.doc.warehouse, s['posting_date']))
+			raise Exception
+
+	# ------------------------------------
+	# get serialized inventory values
+	# ------------------------------------
+	def get_serialized_inventory_values(self, val_rate, in_rate, opening_qty, actual_qty, is_cancelled, serial_nos):
+		if flt(in_rate) < 0: # wrong incoming rate
+			in_rate = val_rate
+		elif flt(in_rate) == 0: # In case of delivery/stock issue, get average purchase rate of serial nos of current entry
+			in_rate = flt(sql("select ifnull(avg(purchase_rate), 0) from `tabSerial No` where name in (%s)" % (serial_nos))[0][0])
+
+		if in_rate and val_rate == 0: # First entry
+			val_rate = in_rate		
+		# val_rate is same as previous entry if val_rate is negative
+		# Otherwise it will be calculated as per moving average
+		elif opening_qty + actual_qty > 0 and ((opening_qty * val_rate) + (actual_qty * in_rate)) > 0:
+			val_rate = ((opening_qty *val_rate) + (actual_qty * in_rate)) / (opening_qty + actual_qty)
+		stock_val = val_rate
+		return val_rate, stock_val
+
+
+
+	# ------------------------------------
+	# get moving average inventory values
+	# ------------------------------------
+	def get_moving_average_inventory_values(self, val_rate, in_rate, opening_qty, actual_qty, is_cancelled):
+		if flt(in_rate) <= 0: # In case of delivery/stock issue in_rate = 0 or wrong incoming rate
+			in_rate = val_rate
+		if in_rate and val_rate == 0: # First entry
+			val_rate = in_rate
+
+		# val_rate is same as previous entry if :
+		# 1. actual qty is negative(delivery note / stock entry)
+		# 2. cancelled entry
+		# 3. val_rate is negative
+		# Otherwise it will be calculated as per moving average
+		elif actual_qty > 0 and (opening_qty + actual_qty) > 0 and is_cancelled == 'No' and ((opening_qty * val_rate) + (actual_qty * in_rate)) > 0:
+			val_rate = ((opening_qty *val_rate) + (actual_qty * in_rate)) / (opening_qty + actual_qty)
+		stock_val = val_rate
+		return val_rate, stock_val
+
+
+	# --------------------------
+	# get fifo inventory values
+	# --------------------------
+	def get_fifo_inventory_values(self, val_rate, in_rate, actual_qty, incoming_rate):
+		# add batch to fcfs balance
+		if actual_qty > 0:
+			self.fcfs_bal.append([flt(actual_qty), flt(in_rate)])
+			val_rate = incoming_rate
+		# remove from fcfs balance
+		else:
+			fcfs_val = 0
+			withdraw = flt(abs(actual_qty))
+			while withdraw:
+				if not self.fcfs_bal:
+					break # nothing in store
+				
+				batch = self.fcfs_bal[0]
+			 
+				if batch[0] < withdraw:
+					# not enough in current batch, clear batch
+					withdraw -= batch[0]
+					fcfs_val += (flt(batch[0]) * flt(batch[1]))
+					self.fcfs_bal.pop(0)
+				else:
+					# all from current batch
+					fcfs_val += (flt(withdraw) * flt(batch[1]))
+					batch[0] -= withdraw
+					withdraw = 0
+			val_rate = flt(fcfs_val) / flt(abs(actual_qty))
+
+		return val_rate
+
+
+	# -------------------
+	# get valuation rate
+	# -------------------
+	def get_valuation_rate(self, val_method, serial_nos, val_rate, in_rate, stock_val, cqty, s):
+		if serial_nos:
+			val_rate, stock_val = self.get_serialized_inventory_values(val_rate, in_rate, opening_qty = cqty, actual_qty = s['actual_qty'], is_cancelled = s['is_cancelled'], serial_nos = serial_nos)
+		elif val_method == 'Moving Average':
+			val_rate, stock_val = self.get_moving_average_inventory_values(val_rate, in_rate, opening_qty = cqty, actual_qty = s['actual_qty'], is_cancelled = s['is_cancelled'])
+		elif val_method == 'FIFO':
+			val_rate = self.get_fifo_inventory_values(val_rate, in_rate, actual_qty = s['actual_qty'], incoming_rate = s['incoming_rate'])
+		return val_rate, stock_val
+
+
+	# ----------------
+	# get stock value
+	# ----------------
+	def get_stock_value(self, val_method, cqty, stock_val, serial_nos):
+		if val_method == 'Moving Average' or serial_nos:
+			stock_val = flt(stock_val) * flt(cqty)
+		elif val_method == 'FIFO':
+			for d in self.fcfs_bal:
+				stock_val += (flt(d[0]) * flt(d[1]))
+		return stock_val
+
+	# ----------------------
+	# update item valuation
+	# ----------------------
+	def update_item_valuation(self, sle_id=None, posting_date=None, posting_time=None, serial_no=None, prev_sle=None):
+		# no sle given, start from the first one (for repost)
+		if not prev_sle:
+			cqty, cval, val_rate, self.fcfs_bal = 0, 0, 0, []
+		
+		# normal
+		else:
+			cqty = flt(prev_sle.get('bin_aqat', 0))
+			cval =flt(prev_sle.get('stock_value', 0))
+			val_rate = flt(prev_sle.get('valuation_rate', 0))
+			self.fcfs_bal = eval(prev_sle.get('fcfs_stack', '[]') or '[]')
+
+		val_method = get_obj('Valuation Control').get_valuation_method(self.doc.item_code)	# get valuation method
+
+		# recalculate the balances for all stock ledger entries
+		# after this one (so that the corrected balance will reflect
+		# correctly in all entries after this one)
+		sll = sql("""
+			select *
+			from `tabStock Ledger Entry` 
+			where item_code = %s 
+			and warehouse = %s 
+			and timestamp(posting_date, posting_time) > timestamp(%s, %s)
+			order by timestamp(posting_date, posting_time) asc, name asc""", \
+				(self.doc.item_code, self.doc.warehouse, posting_date, posting_time), as_dict = 1)
+
+		# if in live entry - update the values of the current sle
+		if sle_id:
+			sll = sql("select * from `tabStock Ledger Entry` where name=%s", sle_id, as_dict=1) + sll
+		for s in sll:
+			# block if stock level goes negative on any date
+			self.validate_negative_stock(cqty, s)
+
+			stock_val, in_rate = 0, s['incoming_rate'] # IN
+			serial_nos = "'"+"', '".join(cstr(s["serial_no"]).split('\n')) + "'"
+
+			# Get valuation rate
+			val_rate, stock_val = self.get_valuation_rate(val_method, serial_nos, val_rate, in_rate, stock_val, cqty, s) 
+			
+			# Qty upto the sle
+			cqty += s['actual_qty'] 
+
+			# Stock Value upto the sle
+			stock_val = self.get_stock_value(val_method, cqty, stock_val, serial_nos) 
+
+			# update current sle --> will it be good to update incoming rate in sle for outgoing stock entry?????
+			sql("""update `tabStock Ledger Entry` 
+			set bin_aqat=%s, valuation_rate=%s, fcfs_stack=%s, stock_value=%s 
+			where name=%s""", (cqty, flt(val_rate), cstr(self.fcfs_bal), stock_val, s['name']))
+		
+		# update the bin
+		if sll:
+			sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s where name=%s", \
+				(flt(val_rate), cqty, flt(stock_val), self.doc.name))
+		
+	# item re-order
+	# -------------
+	def reorder_item(self):
+		projected_qty = flt(self.doc.actual_qty) + flt(self.doc.indented_qty) + flt(self.doc.ordered_qty)
+		item_reorder_level = sql("select reorder_level from `%sItem` where name = '%s'" % (self.prefix, self.doc.item_code))[0][0] or 0
+		if flt(item_reorder_level) > flt(projected_qty):
+			msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent raised (Not Implemented).")
+	
+	# validate
+	def validate(self):
+		self.validate_mandatory()
+
+	# item re-order
+	# -------------
+	def reorder_item(self):
+		#check if re-order is required
+		projected_qty = flt(self.doc.actual_qty) + flt(self.doc.indented_qty) + flt(self.doc.ordered_qty)
+		item_reorder_level = sql("select reorder_level from `%sItem` where name = '%s'" % (self.prefix, self.doc.item_code))[0][0] or 0
+		if flt(item_reorder_level) > flt(projected_qty):
+			msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent raised (Not Implemented).")
+	
+	# validate
+	def validate(self):
+		self.validate_mandatory()
+
+	
+	# set defaults in bin
+	def validate_mandatory(self):
+		qf = ['actual_qty', 'reserved_qty', 'ordered_qty', 'indented_qty']
+		for f in qf:
+			if (not self.doc.fields.has_key(f)) or (not self.doc.fields[f]): 
+				self.doc.fields[f] = 0.0
diff --git a/material_management/doctype/bin/bin.txt b/material_management/doctype/bin/bin.txt
new file mode 100644
index 0000000..0bef20c
--- /dev/null
+++ b/material_management/doctype/bin/bin.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-12-08 15:46:42', 'search_fields': 'item_code,warehouse', 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 114, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'BIN/.#######', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Bin', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00371', 'parent': 'Bin', 'read': 1, 'create': None, 'creation': '2010-12-08 15:46:42', 'modified': '2010-12-08 15:46:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00372', 'parent': 'Bin', 'read': 1, 'create': None, 'creation': '2010-12-08 15:46:42', 'modified': '2010-12-08 15:46:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00373', 'parent': 'Bin', 'read': 1, 'create': None, 'creation': '2010-12-08 15:46:42', 'modified': '2010-12-08 15:46:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00374', 'parent': 'Bin', 'read': 1, 'create': None, 'creation': '2010-12-08 15:46:42', 'modified': '2010-12-08 15:46:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00375', 'parent': 'Bin', 'read': 1, 'create': 0, 'creation': '2010-12-08 15:46:42', 'modified': '2010-12-08 15:46:42', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00376', 'parent': 'Bin', 'read': 1, 'create': 0, 'creation': '2010-12-08 15:46:42', 'modified': '2010-12-08 15:46:42', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 6, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'warehouse', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Warehouse', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02254', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'warehouse_type', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Warehouse Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02255', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'warehouse_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02256', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02257', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'reserved_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reserved Quantity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02258', 'idx': 5, 'default': '0.00', 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'reserved_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'actual_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Actual Quantity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02259', 'idx': 6, 'default': '0.00', 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'actual_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'ordered_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Ordered Quantity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02260', 'idx': 7, 'default': '0.00', 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'ordered_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'indented_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Indented Quantity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02261', 'idx': 8, 'default': '0.00', 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'indented_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'planned_qty', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Planned Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02262', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'planned_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'projected_qty', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Projected Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02263', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'projected_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:42', 'doctype': 'DocField', 'oldfieldname': 'ma_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Moving Average Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL02264', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:42', 'parenttype': 'DocType', 'fieldname': 'ma_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:43', 'doctype': 'DocField', 'oldfieldname': 'fcfs_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'FCFS Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02265', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:43', 'parenttype': 'DocType', 'fieldname': 'fcfs_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:43', 'doctype': 'DocField', 'oldfieldname': 'valuation_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Valuation Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02266', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:43', 'parenttype': 'DocType', 'fieldname': 'valuation_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-12-08 15:46:43', 'doctype': 'DocField', 'oldfieldname': 'stock_value', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Stock Value', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Bin', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02267', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-12-08 15:46:43', 'parenttype': 'DocType', 'fieldname': 'stock_value', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/delivery_note/__init__.py b/material_management/doctype/delivery_note/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/delivery_note/__init__.py
diff --git a/material_management/doctype/delivery_note/delivery_note.js b/material_management/doctype/delivery_note/delivery_note.js
new file mode 100644
index 0000000..2f61de9
--- /dev/null
+++ b/material_management/doctype/delivery_note/delivery_note.js
@@ -0,0 +1,361 @@
+// Module Material Management
+cur_frm.cscript.tname = "Delivery Note Detail";
+cur_frm.cscript.fname = "delivery_note_details";
+cur_frm.cscript.other_fname = "other_charges";
+cur_frm.cscript.sales_team_fname = "sales_team";
+
+$import(Sales Common)
+$import(Other Charges)
+$import(SMS Control)
+
+// ONLOAD
+// ================================================================================================
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
+  if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
+  if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+  if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn);
+
+  if(!doc.posting_time) doc.posting_time = wn.datetime.get_cur_time()
+    
+  if(doc.__islocal){
+    hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+  }   
+
+}
+
+cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
+  // load default charges
+  if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) 
+    cur_frm.cscript.load_taxes(doc, cdt, cdn);	
+} 
+
+// REFRESH
+// ================================================================================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
+
+  cur_frm.clear_custom_buttons();
+
+  var ch = getchildren('Delivery Note Detail',doc.name,'delivery_note_details');
+  var is_billed = 1; // assume all qty's are billed
+  var is_installed = 1; //assume all qty's are installed
+  
+  for(var i in ch){    
+    if(ch[i].billed_qty < ch[i].qty) is_billed = 0;
+    if(ch[i].installed_qty < ch[i].qty) is_installed = 0;
+    if(ch[i].billed_amt < ch[i].amount) is_billed = 0;
+  }
+   
+  if(is_billed==0 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
+  
+  if(is_installed==0 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']);
+
+  if (doc.docstatus!=1) {
+    hide_field(['SMS', 'Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
+  } else {
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+    unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
+  }
+  
+  set_print_hide(doc, cdt, cdn);
+}
+
+
+//customer
+cur_frm.cscript.customer = function(doc,dt,dn) {  
+  var callback = function(r,rt) {
+      var doc = locals[cur_frm.doctype][cur_frm.docname];
+      cur_frm.refresh();
+  } 
+  if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', '', callback);
+  if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+  locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+  locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.cscript['Get Items'] = function(doc,dt,dn) {
+  var callback = function(r,rt){
+    var doc = locals[cur_frm.doctype][cur_frm.docname];          
+    if(r.message){              
+      doc.sales_order_no = r.message;      
+		  if(doc.sales_order_no) {		      
+  			  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);			    			    			  
+		  }		  
+		  refresh_many(['delivery_note_details','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+    }
+  } 
+ $c_obj(make_doclist(doc.doctype, doc.name),'pull_sales_order_details','',callback); 
+}
+
+
+//RV-DN : Pull Item details - UOM, Item Group as it was not in Sales Invoice
+//---------------------------------------------------------------------
+cur_frm.cscript.pull_item_details_onload = function(doc,dt,dn){
+  var callback = function(r,rt){
+    refresh_field('delivery_note_details');
+    cur_frm.cscript.customer(doc,dt,dn);
+  } 
+  $c_obj(make_doclist(dt,dn),'set_item_details','',callback);
+}
+
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+  tn = createLocal('Contact');
+  locals['Contact'][tn].is_customer = 1;
+  if(doc.customer) locals['Contact'][tn].customer = doc.customer;
+  loaddoc('Contact', tn);
+}
+
+//========================= Overloaded query for link batch_no =============================================================
+cur_frm.fields_dict['delivery_note_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.item_code){
+    return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50"
+  }
+  else{
+    alert("Please enter Item Code.");
+  }
+}
+
+// ***************** Get project name *****************
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  var cond = '';
+  if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
+  return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
+}
+
+/*
+//---- get customer details ----------------------------
+cur_frm.cscript.project_name = function(doc,cdt,cdn){
+  $c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
+    refresh_many(['customer','customer_name', 'customer_address', 'contact_person', 'territory', 'contact_no', 'email_id', 'customer_group']);
+  });
+}
+*/
+
+
+
+// UTILITY FUNCTIONS
+// ================================================================================================
+/*
+var cfn_set_fields = function(doc, cdt, cdn) { 
+ var supplier_field_list = ['Supplier','supplier','supplier_address'];
+  var customer_field_list = ['Customer','customer','customer_name','customer_address','territory','customer_group','Business Associate','sales_partner','commission_rate','total_commission','sales_order_no','Get Items'];
+  if (doc.delivery_type == 'Rejected' && doc.purchase_receipt_no) {
+    unhide_field('purchase_receipt_no');
+    unhide_field(supplier_field_list);
+    hide_field(customer_field_list);
+    get_field(doc.doctype, 'delivery_type' , doc.name).permlevel = 1;
+  }
+  else if (doc.delivery_type == 'Subcontract' && doc.purchase_order_no) {
+    unhide_field('purchase_order_no');
+    unhide_field(supplier_field_list);
+    hide_field(cutomer_field_list);
+    get_field(doc.doctype, 'delivery_type' , doc.name).permlevel = 1;
+  }
+  else if (doc.delivery_type == 'Sample') unhide_field('to_warehouse');
+  else get_field(doc.doctype, 'delivery_type' , doc.name).permlevel = 0;   
+    
+  
+}
+
+*/
+
+// DOCTYPE TRIGGERS
+// ================================================================================================
+
+/*
+// ***************** Get Contact Person based on customer selected *****************
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE ((`tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'") or (`tabContact`.is_sales_partner = 1 AND `tabContact`.sales_partner = "'+ doc.sales_partner+'")) AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+}
+*/
+
+/*
+// ***************** get shipping address based on customer selected *****************
+cur_frm.fields_dict['ship_det_no'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabShipping Address`.`name`, `tabShipping Address`.`ship_to`, `tabShipping Address`.`shipping_address` FROM `tabShipping Address` WHERE `tabShipping Address`.customer = "'+ doc.customer+'" AND `tabShipping Address`.`docstatus` != 2 AND `tabShipping Address`.`name` LIKE "%s" ORDER BY `tabShipping Address`.name ASC LIMIT 50';
+}
+*/
+
+
+
+// *************** Customized link query for SALES ORDER based on customer and currency***************************** 
+cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
+  doc = locals[this.doctype][this.docname];
+  var cond = '';
+  
+  if(doc.customer) {
+    if(doc.currency) cond = '`tabSales Order`.customer = "'+doc.customer+'" and `tabSales Order`.currency = "'+doc.currency+'" and';
+    else cond = '`tabSales Order`.customer = "'+doc.customer+'" and';
+  }
+  else {
+    if(doc.currency) cond = '`tabSales Order`.currency = "'+doc.currency+'" and';
+    else cond = '';
+  }
+  if(doc.project_name){
+    cond += '`tabSales Order`.project_name ="'+doc.project_name+'"';
+  }
+  return repl('SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "%(company)s" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_delivered,0) < 100 and %(cond)s `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50', {company:doc.company,cond:cond})
+}
+
+
+// ****************************** DELIVERY TYPE ************************************
+cur_frm.cscript.delivery_type = function(doc, cdt, cdn) {
+  if (doc.delivery_type = 'Sample') cfn_set_fields(doc, cdt, cdn);
+}
+
+cur_frm.cscript.serial_no = function(doc, cdt , cdn) {
+  var d = locals[cdt][cdn];
+  if (d.serial_no) {
+     get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
+  }
+}
+
+/* 
+// this won't work in case of Sales Bom item where item.is_stock_item = 'No'
+cur_frm.fields_dict['delivery_note_details'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50";
+}
+*/
+
+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.warehouse) {
+    arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}";
+    get_server_fields('get_actual_qty',arg,'delivery_note_details',doc,cdt,cdn,1);
+  }
+}
+
+
+cur_frm.fields_dict['transporter_name'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabSupplier`.`name` FROM `tabSupplier` WHERE `tabSupplier`.supplier_type = "transporter" AND `tabSupplier`.docstatus != 2 AND `tabSupplier`.%(key)s LIKE "%s" ORDER BY `tabSupplier`.`name` LIMIT 50';
+}
+
+//-----------------------------------Make Sales Invoice----------------------------------------------
+cur_frm.cscript['Make Sales Invoice'] = function() {
+  var doc = cur_frm.doc
+  n = createLocal('Receivable Voucher');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Receivable Voucher'][n]]),
+    'from_doctype':doc.doctype,
+    'to_doctype':'Receivable Voucher',
+    'from_docname':doc.name,
+    'from_to_list':"[['Delivery Note','Receivable Voucher'],['Delivery Note Detail','RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+    }, function(r,rt) {
+       loaddoc('Receivable Voucher', n);
+    }
+  );
+}
+
+//-----------------------------------Make Installation Note----------------------------------------------
+cur_frm.cscript['Make Installation Note'] = function() {
+  var doc = cur_frm.doc;
+  if(doc.per_installed < 100){
+    n = createLocal('Installation Note');
+    $c('dt_map', args={
+      'docs':compress_doclist([locals['Installation Note'][n]]),
+      'from_doctype':doc.doctype,
+      'to_doctype':'Installation Note',
+      'from_docname':doc.name,
+      'from_to_list':"[['Delivery Note','Installation Note'],['Delivery Note Detail','Installed Item Details']]"
+      }, function(r,rt) {
+         loaddoc('Installation Note', n);
+      }
+    );
+  }
+  else if(doc.per_installed >= 100)
+    msgprint("Item installation is already completed")
+}
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+//------------------------for printing without amount----------
+
+var set_print_hide= function(doc, cdt, cdn){
+  if (doc.print_without_amount) {
+    fields['Delivery Note']['currency'].print_hide = 1;
+    fields['Delivery Note Detail']['export_rate'].print_hide = 1;
+    fields['Delivery Note Detail']['adj_rate'].print_hide = 1;
+    fields['Delivery Note Detail']['ref_rate'].print_hide = 1;
+    fields['Delivery Note Detail']['export_amount'].print_hide = 1;
+  } else {
+    fields['Delivery Note']['currency'].print_hide = 0;
+    fields['Delivery Note Detail']['export_rate'].print_hide = 0;
+    fields['Delivery Note Detail']['adj_rate'].print_hide = 0;
+    fields['Delivery Note Detail']['ref_rate'].print_hide = 0;
+    fields['Delivery Note Detail']['export_amount'].print_hide = 0;
+  }
+}
+
+cur_frm.cscript.print_without_amount = function(doc, cdt, cdn) {
+  set_print_hide(doc, cdt, cdn);
+}
+
+
+//****************** For print sales order no and date*************************
+cur_frm.pformat.sales_order_no= function(doc, cdt, cdn){
+  //function to make row of table
+  
+  var make_row = function(title,val1, val2, bold){
+    var bstart = '<b>'; var bend = '</b>';
+
+    return '<tr><td style="width:39%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+     +'<td style="width:61%;text-align:left;">'+val1+(val2?' ('+dateutil.str_to_user(val2)+')':'')+'</td>'
+     +'</tr>'
+  }
+
+  out ='';
+  
+  var cl = getchildren('Delivery Note Detail',doc.name,'delivery_note_details');
+
+  // outer table  
+  var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
+  
+  // main table
+  out +='<table class="noborder" style="width:100%">';
+
+  // add rows
+  if(cl.length){
+    prevdoc_list = new Array();
+    for(var i=0;i<cl.length;i++){
+      if(cl[i].prevdoc_doctype == 'Sales Order' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
+        prevdoc_list.push(cl[i].prevdoc_docname);
+        if(prevdoc_list.length ==1)
+          out += make_row(cl[i].prevdoc_doctype, cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
+        else
+          out += make_row('', cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
+      }
+    }
+  }
+
+  out +='</table></td></tr></table></div>';
+
+  return out;
+}
diff --git a/material_management/doctype/delivery_note/delivery_note.py b/material_management/doctype/delivery_note/delivery_note.py
new file mode 100644
index 0000000..b223da4
--- /dev/null
+++ b/material_management/doctype/delivery_note/delivery_note.py
@@ -0,0 +1,442 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.tname = 'Delivery Note Detail'
+    self.fname = 'delivery_note_details'
+    
+    # Notification objects
+    self.notify_obj = get_obj('Notification Control')
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+    
+# DOCTYPE TRIGGERS FUNCTIONS
+# ==============================================================================
+#************Fiscal Year Validation*****************************
+  def validate_fiscal_year(self):
+    get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+
+  # ******************* Get Customer Details ***********************
+  #def get_customer_details(self):
+  #  sales_com_obj = get_obj('Sales Common')
+  #  sales_com_obj.get_customer_details(self)
+  #  sales_com_obj.get_shipping_details(self)
+
+  # ****** Get contact person details based on customer selected ****
+  def get_contact_details(self):
+    return cstr(get_obj('Sales Common').get_contact_details(self,0))
+
+  # *********** Get Commission rate of Sales Partner ****************
+  def get_comm_rate(self, sales_partner):
+    return get_obj('Sales Common').get_comm_rate(sales_partner, self)
+  
+  # *************** Pull Sales Order Details ************************
+  def pull_sales_order_details(self):
+    self.validate_prev_docname()
+    self.doc.clear_table(self.doclist,'other_charges')
+        
+    if self.doc.sales_order_no:        
+      get_obj('DocType Mapper', 'Sales Order-Delivery Note').dt_map('Sales Order', 'Delivery Note', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Delivery Note'],['Sales Order Detail', 'Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]")
+    else:
+      msgprint("Please select Sales Order No. whose details need to be pulled")    
+
+    return cstr(self.doc.sales_order_no)
+
+    
+  
+  #-------------------set item details -uom and item group----------------
+  def set_item_details(self):
+    for d in getlist(self.doclist,'delivery_note_details'):
+      res = sql("select stock_uom, item_group from `tabItem` where name ='%s'"%d.item_code)
+      if not d.stock_uom:    d.stock_uom = res and cstr(res[0][0]) or ''
+      if not d.item_group:   d.item_group = res and cstr(res[0][1]) or ''
+      d.save()
+      
+  # ::::: Validates that Sales Order is not pulled twice :::::::
+  def validate_prev_docname(self):
+    for d in getlist(self.doclist, 'delivery_note_details'): 
+      if self.doc.sales_order_no == d.prevdoc_docname:
+        msgprint(cstr(self.doc.sales_order_no) + " sales order details have already been pulled. ")
+        raise Exception, "Validation Error. "
+  
+  #Set Actual Qty based on item code and warehouse
+  #------------------------------------------------------
+  def set_actual_qty(self):
+    for d in getlist(self.doclist, 'delivery_note_details'):
+      if d.item_code and d.warehouse:
+        actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+        d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
+
+
+  # GET TERMS & CONDITIONS
+  # -------------------------------------
+  def get_tc_details(self):
+    return get_obj('Sales Common').get_tc_details(self)
+  
+  #pull project customer
+  #-------------------------
+  def pull_project_customer(self):
+    res = sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
+    if res:
+      get_obj('DocType Mapper', 'Project-Delivery Note').dt_map('Project', 'Delivery Note', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Delivery Note']]")
+        
+# DELIVERY NOTE DETAILS TRIGGER FUNCTIONS
+# ================================================================================
+
+  # ***************** Get Item Details ******************************
+  def get_item_details(self, item_code):
+    return get_obj('Sales Common').get_item_details(item_code, self)
+
+  # *** Re-calculates Basic Rate & amount based on Price List Selected ***
+  def get_adj_percent(self, arg=''):
+    get_obj('Sales Common').get_adj_percent(self)
+
+  # ********** Get Actual Qty of item in warehouse selected *************
+  def get_actual_qty(self,args):
+    args = eval(args)
+    actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
+    ret = {
+       'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
+    }
+    return cstr(ret)
+
+    
+# OTHER CHARGES TRIGGER FUNCTIONS
+# ====================================================================================
+  
+  # *********** Get Tax rate if account type is TAX ********************
+  def get_rate(self,arg):
+    return get_obj('Sales Common').get_rate(arg)
+
+  # Load Default Charges
+  # ----------------------------------------------------------
+  def load_default_taxes(self):
+    return get_obj('Sales Common').load_default_taxes(self)
+
+
+  # **** Pull details from other charges master (Get Other Charges) ****
+  def get_other_charges(self):
+    return get_obj('Sales Common').get_other_charges(self)
+
+    
+  #check in manage account if sales order required or not.
+  # ====================================================================================
+  def so_required(self):
+    res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'so_required'")
+    if res and res[0][0] == 'Yes':
+       for d in getlist(self.doclist,'delivery_note_details'):
+         if not d.prevdoc_docname:
+           msgprint("Sales Order No. required against item %s"%d.item_code)
+           raise Exception
+       
+
+    
+# VALIDATE
+# ====================================================================================
+  def validate(self):
+    self.so_required()
+    self.validate_fiscal_year()
+    self.validate_proj_cust()
+    sales_com_obj = get_obj(dt = 'Sales Common')
+    sales_com_obj.check_stop_sales_order(self)
+    sales_com_obj.check_active_sales_items(self)
+    sales_com_obj.get_prevdoc_date(self)
+    self.validate_mandatory()
+    #self.validate_prevdoc_details()
+    self.validate_reference_value()
+    self.validate_for_items()
+    sales_com_obj.make_packing_list(self,'delivery_note_details')
+    get_obj('Stock Ledger').validate_serial_no(self, 'packing_details')
+    sales_com_obj.validate_max_discount(self, 'delivery_note_details')             #verify whether rate is not greater than max discount
+    sales_com_obj.get_allocated_sum(self)  # this is to verify that the allocated % of sales persons is 100%    
+    sales_com_obj.check_conversion_rate(self)
+    # ::::::: Get total in Words ::::::::
+    self.doc.in_words = sales_com_obj.get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
+    self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
+    
+    # ::::::: Set actual qty for each item in selected warehouse :::::::
+    self.update_current_stock()
+    # :::::: set DN status :::::::
+
+    self.doc.status = 'Draft'
+    if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
+    if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
+    
+ 
+  # ************** Validate Mandatory *************************
+  def validate_mandatory(self):
+    # :::::::::: Amendment Date ::::::::::::::
+    if self.doc.amended_from and not self.doc.amendment_date:
+      msgprint("Please Enter Amendment Date")
+      raise Exception, "Validation Error. "
+
+  #check for does customer belong to same project as entered..
+  #-------------------------------------------------------------------------------------------------
+  def validate_proj_cust(self):
+    if self.doc.project_name and self.doc.customer:
+      res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+      if not res:
+        msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
+        raise Exception
+            
+  # Validate values with reference document
+  #----------------------------------------
+  def validate_reference_value(self):
+    get_obj('DocType Mapper', 'Sales Order-Delivery Note', with_children = 1).validate_reference_value(self, self.doc.name)
+  
+	  
+  # ******* Validate Previous Document Details ************
+  def validate_prevdoc_details(self):
+    for d in getlist(self.doclist,'delivery_note_details'):
+           
+      prevdoc = d.prevdoc_doctype
+      prevdoc_docname = d.prevdoc_docname
+      
+      if prevdoc_docname and prevdoc:
+        # ::::::::::: Validates Transaction Date of DN and previous doc (i.e. SO , PO, PR) *********
+        trans_date = sql("select transaction_date from `tab%s` where name = '%s'" %(prevdoc,prevdoc_docname))[0][0]
+        if trans_date and getdate(self.doc.transaction_date) < (trans_date):
+          msgprint("Your Voucher Date cannot be before "+cstr(prevdoc)+" Date.")
+          raise Exception
+        # ::::::::: Validates DN and previous doc details ::::::::::::::::::
+        get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc, prevdoc_docname))
+        name = get_name and get_name[0][0] or ''
+        if name:  #check for incorrect docname
+          if prevdoc == 'Sales Order':
+            dt = sql("select company, docstatus, customer, currency, sales_partner from `tab%s` where name = '%s'" % (prevdoc, name))
+            cust_name = dt and dt[0][2] or ''
+            if cust_name != self.doc.customer:
+              msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " customer :" + cstr(cust_name) + " does not match with customer : " + cstr(self.doc.customer) + " of current document.")
+              raise Exception, "Validation Error. "
+            sal_partner = dt and dt[0][4] or ''
+            if sal_partner != self.doc.sales_partner:
+              msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " sales partner name :" + cstr(sal_partner) + " does not match with sales partner name : " + cstr(self.doc.sales_partner_name) + " of current document.")
+              raise Exception, "Validation Error. "
+          else:
+            dt = sql("select company, docstatus, supplier, currency from `tab%s` where name = '%s'" % (prevdoc, name))
+            supp_name = dt and dt[0][2] or ''
+            company_name = dt and dt[0][0] or ''
+            docstatus = dt and dt[0][1] or 0
+            currency = dt and dt[0][3] or ''
+            if (currency != self.doc.currency):
+              msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " currency : "+ cstr(currency) + "does not match with Currency: " + cstr(self.doc.currency) + "of current document")
+              raise Exception, "Validation Error."
+            if (company_name != self.doc.company):
+              msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " does not belong to the Company: " + cstr(self.doc.company_name))
+              raise Exception, "Validation Error."
+            if (docstatus != 1):
+              msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " is not Submitted Document.")
+              raise Exception, "Validation Error."
+        else:
+          msgprint(cstr(prevdoc) + ": " + cstr(prevdoc_docname) + " is not a valid " + cstr(prevdoc))
+          raise Exception, "Validation Error."
+
+
+  # ******************** Validate Items **************************
+  def validate_for_items(self):
+    check_list, chk_dupl_itm = [], []
+    for d in getlist(self.doclist,'delivery_note_details'):
+      ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
+      if d.prevdoc_doctype and d.prevdoc_detail_docname and ch and ch[0][0]=='Yes':
+        self.validate_items_with_prevdoc(d)
+      
+      # validates whether item is not entered twice
+      e = [d.item_code, d.description, d.warehouse, d.prevdoc_docname or '', d.batch_no or '']
+      f = [d.item_code, d.description, d.prevdoc_docname or '']
+
+      if ch and ch[0][0] == 'Yes':
+        if e in check_list:
+          msgprint("Please check whether item %s has been entered twice wrongly." % d.item_code)
+        else:
+          check_list.append(e)
+      elif ch and ch[0][0] == 'No':
+        if f in chk_dupl_itm:
+          msgprint("Please check whether item %s has been entered twice wrongly." % d.item_code)
+        else:
+          chk_dupl_itm.append(f)
+
+
+  # check if same item, warehouse present in prevdoc
+  # ------------------------------------------------------------------
+  def validate_items_with_prevdoc(self, d):
+    if d.prevdoc_doctype == 'Sales Order':
+      data = sql("select item_code, reserved_warehouse from `tabSales Order Detail` where parent = '%s' and name = '%s'" % (d.prevdoc_docname, d.prevdoc_detail_docname))
+    if d.prevdoc_doctype == 'Purchase Receipt':
+      data = sql("select item_code, rejected_warehouse from `tabPurchase Receipt Detail` where parent = '%s' and name = '%s'" % (d.prevdoc_docname, d.prevdoc_detail_docname))
+    if not data or data[0][0] != d.item_code or data[0][1] != d.warehouse:
+      msgprint("Item: %s / Warehouse: %s is not matching with Sales Order: %s. Sales Order might be modified after fetching data from it. Please delete items and fetch again." % (d.item_code, d.warehouse, d.prevdoc_docname))
+      raise Exception
+
+
+  # ********* UPDATE CURRENT STOCK *****************************
+  def update_current_stock(self):
+    for d in getlist(self.doclist, 'delivery_note_details'):
+      bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+      d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
+
+    for d in getlist(self.doclist, 'packing_details'):
+      bin = sql("select actual_qty, projected_qty from `tabBin` where item_code =  %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+      d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
+      d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0  
+      
+
+# ON SUBMIT
+# =================================================================================================
+  def on_submit(self):
+    set(self.doc, 'message', 'Items against your Order #%s have been delivered. Delivery #%s: ' % (self.doc.po_no, self.doc.name))
+    self.check_qty_in_stock()
+    # Check for Approving Authority
+    get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
+    sl_obj = get_obj("Stock Ledger")
+    sl_obj.validate_serial_no_warehouse(self, 'packing_details')
+    sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0)
+    get_obj("Sales Common").update_prevdoc_detail(1,self)
+    self.update_stock_ledger(update_stock = 1)
+
+    #------------Check Credit Limit---------------------
+    self.credit_limit()
+
+    # set DN status
+    set(self.doc, 'status', 'Submitted')
+
+    # on submit notification
+    self.notify_obj.notify_contact('Delivery Note',self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
+
+   
+  # *********** Checks whether actual quantity is present in warehouse *************
+  def check_qty_in_stock(self):
+    for d in getlist(self.doclist, 'packing_details'):
+      is_stock_item = sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
+      if is_stock_item == 'Yes' and d.warehouse and flt(d.qty) > flt(d.actual_qty):
+        msgprint("For Item: " + cstr(d.item_code) + " at Warehouse: " + cstr(d.warehouse) + " Quantity: " + cstr(d.qty) +" is not Available. (Must be less than or equal to " + cstr(d.actual_qty) + " )")
+        raise Exception, "Validation Error"
+
+
+
+# ON CANCEL
+# =================================================================================================  
+  def on_cancel(self):
+    sales_com_obj = get_obj(dt = 'Sales Common')
+    sales_com_obj.check_stop_sales_order(self)
+    self.check_next_docstatus()
+    get_obj('Stock Ledger').update_serial_record(self, 'packing_details', is_submit = 0, is_incoming = 0)
+    sales_com_obj.update_prevdoc_detail(0,self)
+    self.update_stock_ledger(update_stock = -1)
+    # :::::: set DN status :::::::
+    set(self.doc, 'status', 'Cancelled')
+
+  
+  # ******************** Check Next DocStatus **************************
+  def check_next_docstatus(self):
+    submit_rv = sql("select t1.name from `tabReceivable Voucher` t1,`tabRV Detail` t2 where t1.name = t2.parent and t2.delivery_note = '%s' and t1.docstatus = 1" % (self.doc.name))
+    if submit_rv:
+      msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted !")
+      raise Exception , "Validation Error."
+    
+    submit_in = sql("select t1.name from `tabInstallation Note` t1, `tabInstalled Item Details` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
+    if submit_in:
+      msgprint("Installation Note : "+cstr(submit_in[0][0]) +" has already been submitted !")
+      raise Exception , "Validation Error."
+
+
+# UPDATE STOCK LEDGER
+# =================================================================================================
+  def update_stock_ledger(self, update_stock, is_stopped = 0):
+    self.values = []
+    for d in self.get_item_list(is_stopped):
+      stock_item = sql("SELECT is_stock_item, is_sample_item FROM tabItem where name = '%s'"%(d[1]), as_dict = 1) # stock ledger will be updated only if it is a stock item
+      if stock_item[0]['is_stock_item'] == "Yes":
+        if not d[0]:
+          msgprint("Message: Please enter Warehouse for item %s as it is stock item."% d[1])
+          raise Exception
+        # if prevdoc_doctype = "Sales Order" 
+        if d[3] < 0 :
+          # Reduce Reserved Qty from warehouse
+          bin = get_obj('Warehouse', d[0]).update_bin(0, flt(update_stock) * flt(d[3]), 0, 0, 0, d[1], self.doc.transaction_date)
+          
+        # Reduce actual qty from warehouse
+        self.make_sl_entry(d, d[0], - flt(d[2]) , 0, update_stock)
+    get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
+
+
+  # ***************** Gets Items from packing list *****************
+  def get_item_list(self, is_stopped):
+   return get_obj('Sales Common').get_item_list(self, is_stopped)
+
+	
+  # ********************** Make Stock Entry ************************************
+  def make_sl_entry(self, d, wh, qty, in_value, update_stock):
+    self.values.append({
+      'item_code'           : d[1],
+      'warehouse'           : wh,
+      'transaction_date'    : self.doc.transaction_date,
+      'posting_date'        : self.doc.posting_date,
+      'posting_time'        : self.doc.posting_time,
+      'voucher_type'        : 'Delivery Note',
+      'voucher_no'          : self.doc.name,
+      'voucher_detail_no'   : '', 
+      'actual_qty'          : qty, 
+      'stock_uom'           : d[4],
+      'incoming_rate'       : in_value,
+      'company'             : self.doc.company,
+      'fiscal_year'         : self.doc.fiscal_year,
+      'is_cancelled'        : (update_stock==1) and 'No' or 'Yes',
+      'batch_no'            : d[5],
+      'serial_no'           : d[6]
+    })    
+
+  
+  # SEND SMS
+  # ============================================================================================
+  def send_sms(self):
+    if not self.doc.customer_mobile_no:
+      msgprint("Please enter customer mobile no")
+    elif not self.doc.message:
+      msgprint("Please enter the message you want to send")
+    else:
+      msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.customer_mobile_no,], self.doc.message))
+
+
+#------------ check credit limit of items in DN Detail which are not fetched from sales order----------
+  def credit_limit(self):
+    amount, total = 0, 0
+    for d in getlist(self.doclist, 'delivery_note_details'):
+      if not d.prevdoc_docname:
+        amount += d.amount
+    if amount != 0:
+      total = (amount/self.doc.net_total)*self.doc.grand_total
+      get_obj('Sales Common').check_credit(self, total)
+
+  # on update
+  def on_update(self):
+    self.set_actual_qty()
+    get_obj('Stock Ledger').scrub_serial_nos(self)
+
+  # Repair Delivery Note
+  # ===========================================
+  def repair_delivery_note(self):
+    get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)
diff --git a/material_management/doctype/delivery_note/delivery_note.txt b/material_management/doctype/delivery_note/delivery_note.txt
new file mode 100644
index 0000000..fc2fdd2
--- /dev/null
+++ b/material_management/doctype/delivery_note/delivery_note.txt
@@ -0,0 +1,3672 @@
+[
+	{
+		'_last_update': '1306988762',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': 1,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Delivery Note',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'status,transaction_date,customer,customer_name, territory,grand_total',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
+		'tag_fields': 'billing_status',
+		'use_template': None,
+		'version': 443
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00175',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00176',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00177',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00178',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00179',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00180',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00181',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00182',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 9,
+		'match': 'customer_name',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00183',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Customer',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:57',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 10,
+		'match': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00184',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04868',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04869',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00910',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'DN',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL03772',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Shipping Address',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00913',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Address',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Contact Person',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00915',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Contact',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00912',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Shipping Address',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04855',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04856',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04857',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04858',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04870',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Voucher Date',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00921',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00911',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': '% of materials billed against this Delivery Note',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_billed',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': '% Qty Billed',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00922',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'per_billed',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': '% of materials delivered against this Delivery Note',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_installed',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': '% Installed',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00923',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'per_installed',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00917',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00918',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00914',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 1,
+		'label': 'Customer Group',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00971',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Transporter Info',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04871',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transporter_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Transporter Name',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00919',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'transporter_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': 'Transporter lorry number',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lr_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'LR No',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00926',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'lr_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'Date on which lorry started from your warehouse',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lr_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'LR Date',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00927',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'lr_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04872',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'challan_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Challan No',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00928',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'challan_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'challan_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Challan Date',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00929',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'challan_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04873',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'You can make a delivery note from multiple sales orders. Select sales orders one by one and click on the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Sales Order No',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00931',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'sales_order_no',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00932',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'pull_sales_order_details',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'price_list_name',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Price List',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00933',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'price_list_name',
+		'oldfieldtype': 'Select',
+		'options': 'link:Price List',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04874',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': "Customer's Currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Currency',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00924',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'default': '1.00',
+		'depends_on': None,
+		'description': "Rate at which customer's currency is converted to your currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Conversion Rate',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00925',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04875',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Delivery Note Details',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00934',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'delivery_note_details',
+		'oldfieldtype': 'Table',
+		'options': 'Delivery Note Detail',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Net Total*',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00935',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Re-Calculate Values',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00936',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Note',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04876',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>NOTE :</b>* In Base Currency',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04877',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'If you have created a standard template in Other Charges master, select one and click on the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'charge',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Charge',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00939',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'charge',
+		'oldfieldtype': 'Link',
+		'options': 'Other Charges',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Get Charges',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00940',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Other Charges',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00941',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'other_charges',
+		'oldfieldtype': 'Table',
+		'options': 'RV Tax Detail',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Charges Total',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00945',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Calculate Charges',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00942',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Other Charges Calculation',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04878',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04879',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Grand Total',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00946',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Rounded Total',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00947',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'rounded_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Delivery Note.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00948',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04880',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Grand Total (Export)',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00950',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'grand_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total_export',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Rounded Total (Export)',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00951',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'rounded_total_export',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words (Export) will be visible once you save the Delivery Note.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_export',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'In Words (Export)',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00952',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'in_words_export',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04881',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00954',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00955',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Server',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04882',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': None,
+		'label': 'Term Details',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00957',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': 'Filling in Additional Information about the Delivery Note will help you analyze your data better.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04883',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00967',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00968',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': 'Today',
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00959',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'Time at which items were delivered from warehouse',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': 0,
+		'label': 'Posting Time',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00960',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'posting_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:51',
+		'default': None,
+		'depends_on': None,
+		'description': 'Track this Delivery Note against any Project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL03771',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'Required only for sample item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_warehouse',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': 'To Warehouse',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00963',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'to_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04884',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-06-01 16:23:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'billing_status',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'Billing Status',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL05198',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nNot Billed\nPartly Billed\nFully Billed',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-06-02 12:06:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'installation_status',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Installation Status',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL05199',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-21 10:53:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'P.O. No',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000635',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'po_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-21 10:53:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_date',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': 'P.O. Date',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': '000000634',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'po_date',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-12-14 10:32:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': 'Letter Head',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04141',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'letter_head',
+		'oldfieldtype': 'Link',
+		'options': 'link:Letter Head',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'source',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': None,
+		'label': 'Source',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00961',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'source',
+		'oldfieldtype': 'Select',
+		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': "eval:doc.source == 'Campaign'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'campaign',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'Campaign',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00962',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'campaign',
+		'oldfieldtype': 'Link',
+		'options': 'Campaign',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 75,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00969',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'print_without_amount',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 76,
+		'in_filter': None,
+		'label': 'Print Without Amount',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00966',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'print_without_amount',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'instructions',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 77,
+		'in_filter': None,
+		'label': 'Instructions',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00964',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'instructions',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 78,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00976',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'excise_page',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 79,
+		'in_filter': None,
+		'label': 'Excise Page Number',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00977',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'excise_page',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 80,
+		'in_filter': None,
+		'label': 'Sales Team',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04885',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 81,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04886',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_partner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 82,
+		'in_filter': None,
+		'label': 'Sales Partner',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00981',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'sales_partner',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Partner',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'commission_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 83,
+		'in_filter': None,
+		'label': 'Commission Rate (%)',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00982',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'commission_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_commission',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 84,
+		'in_filter': None,
+		'label': 'Total Commission',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00983',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'total_commission',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 85,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04887',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_team',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 86,
+		'in_filter': None,
+		'label': 'Sales Team1',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00984',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_team',
+		'oldfieldtype': 'Table',
+		'options': 'Sales Team',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': 1,
+		'icon': None,
+		'idx': 87,
+		'in_filter': None,
+		'label': 'Supplier Details',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04888',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 88,
+		'in_filter': None,
+		'label': 'Supplier',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00986',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier',
+		'oldfieldtype': 'Link',
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_address',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 89,
+		'in_filter': None,
+		'label': 'Supplier Address',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00987',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_address',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 90,
+		'in_filter': None,
+		'label': 'Purchase Receipt No',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00988',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'purchase_receipt_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_order_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 91,
+		'in_filter': None,
+		'label': 'Purchase Order',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00989',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'purchase_order_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Order',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 10:31:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 92,
+		'in_filter': None,
+		'label': 'Packing List',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04889',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'packing_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 93,
+		'in_filter': None,
+		'label': 'Packing Details',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00991',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'packing_details',
+		'oldfieldtype': 'Table',
+		'options': 'Delivery Note Packing Detail',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 94,
+		'in_filter': None,
+		'label': 'Repair Delivery Note',
+		'modified': '2011-06-02 12:06:13',
+		'modified_by': 'Administrator',
+		'name': 'FL00995',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_delivery_note',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Delivery Note',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/delivery_note_detail/__init__.py b/material_management/doctype/delivery_note_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/delivery_note_detail/__init__.py
diff --git a/material_management/doctype/delivery_note_detail/delivery_note_detail.txt b/material_management/doctype/delivery_note_detail/delivery_note_detail.txt
new file mode 100644
index 0000000..159b91b
--- /dev/null
+++ b/material_management/doctype/delivery_note_detail/delivery_note_detail.txt
@@ -0,0 +1,1070 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'DND/.#######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Delivery Note Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 35
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01000',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Item Name',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01001',
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01002',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_uom',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'UOM',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01003',
+		'no_copy': None,
+		'oldfieldname': 'stock_uom',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'no_of_packs',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'No of Packs',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01004',
+		'no_copy': None,
+		'oldfieldname': 'no_of_packs',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Quantity',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01005',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ref_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Ref Rate',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01006',
+		'no_copy': 0,
+		'oldfieldname': 'ref_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'adj_rate',
+		'fieldtype': 'Float',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Discount (%)',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01007',
+		'no_copy': None,
+		'oldfieldname': 'adj_rate',
+		'oldfieldtype': 'Float',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'export_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Rate',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01008',
+		'no_copy': None,
+		'oldfieldname': 'export_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'export_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01009',
+		'no_copy': None,
+		'oldfieldname': 'export_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'base_ref_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Ref Rate*',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01010',
+		'no_copy': None,
+		'oldfieldname': 'base_ref_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'basic_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Rate*',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01011',
+		'no_copy': None,
+		'oldfieldname': 'basic_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Amount*',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01012',
+		'no_copy': None,
+		'oldfieldname': 'amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Warehouse',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01013',
+		'no_copy': None,
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Serial No',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01014',
+		'no_copy': None,
+		'oldfieldname': 'serial_no',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'batch_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Batch No',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01015',
+		'no_copy': None,
+		'oldfieldname': 'batch_no',
+		'oldfieldtype': 'Link',
+		'options': 'Batch',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Item Group',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01016',
+		'no_copy': None,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Brand Name',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01017',
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Link',
+		'options': 'Brand',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pack_unit',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Pack Unit',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01018',
+		'no_copy': None,
+		'oldfieldname': 'pack_unit',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'installed_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Installed Qty',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01019',
+		'no_copy': 1,
+		'oldfieldname': 'installed_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Available Qty at Warehouse',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01020',
+		'no_copy': 1,
+		'oldfieldname': 'actual_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'billed_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Billed Qty',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01021',
+		'no_copy': 1,
+		'oldfieldname': 'billed_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-01 10:35:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'billed_amt',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Billed Amt',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL04938',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'prevdoc_docname',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Against Document No',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01022',
+		'no_copy': 1,
+		'oldfieldname': 'prevdoc_docname',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'prevdoc_doctype',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'Document Type',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01023',
+		'no_copy': None,
+		'oldfieldname': 'prevdoc_doctype',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'prevdoc_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Against Document Date',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01024',
+		'no_copy': None,
+		'oldfieldname': 'prevdoc_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'prevdoc_detail_docname',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 27,
+		'in_filter': 1,
+		'label': 'Against Document Detail No',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01025',
+		'no_copy': None,
+		'oldfieldname': 'prevdoc_detail_docname',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_tax_rate',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Item Tax Rate',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01026',
+		'no_copy': None,
+		'oldfieldname': 'item_tax_rate',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'page_break',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Page Break',
+		'modified': '2011-03-01 10:35:06',
+		'modified_by': 'Administrator',
+		'name': 'FL01027',
+		'no_copy': None,
+		'oldfieldname': 'page_break',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/delivery_note_packing_detail/__init__.py b/material_management/doctype/delivery_note_packing_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/delivery_note_packing_detail/__init__.py
diff --git a/material_management/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt b/material_management/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
new file mode 100644
index 0000000..3ba01df
--- /dev/null
+++ b/material_management/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
@@ -0,0 +1,687 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-14 14:50:55',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Delivery Note Packing Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 17
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'parent_item',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Parent Item',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01028',
+		'no_copy': None,
+		'oldfieldname': 'parent_item',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01029',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Item Name',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL03784',
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'parent_detail_docname',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Parent Detail docname',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01030',
+		'no_copy': 1,
+		'oldfieldname': 'parent_detail_docname',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01031',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Warehouse',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01034',
+		'no_copy': None,
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Qty',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01032',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Serial No',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': '000000471',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Actual Qty',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01035',
+		'no_copy': 1,
+		'oldfieldname': 'actual_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-21 14:51:19',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'projected_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Projected Qty',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL04427',
+		'no_copy': 1,
+		'oldfieldname': 'projected_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'UOM',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01033',
+		'no_copy': None,
+		'oldfieldname': 'uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'planned_qty',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Planned Qty ',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01036',
+		'no_copy': 1,
+		'oldfieldname': 'planned_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'produced_qty',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Produced Qty',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01037',
+		'no_copy': 1,
+		'oldfieldname': 'produced_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'prevdoc_doctype',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Prevdoc DocType',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01038',
+		'no_copy': None,
+		'oldfieldname': 'prevdoc_doctype',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Sales Order Date',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01039',
+		'no_copy': None,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Expected Delivery Date',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01040',
+		'no_copy': None,
+		'oldfieldname': 'delivery_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'confirmation_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Confirmed delivery date',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01041',
+		'no_copy': 1,
+		'oldfieldname': 'confirmation_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'page_break',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Page Break',
+		'modified': '2011-05-09 11:04:35',
+		'modified_by': 'Administrator',
+		'name': 'FL01042',
+		'no_copy': None,
+		'oldfieldname': 'page_break',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Delivery Note Packing Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/item/__init__.py b/material_management/doctype/item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/item/__init__.py
diff --git a/material_management/doctype/item/item.js b/material_management/doctype/item/item.js
new file mode 100644
index 0000000..115ced5
--- /dev/null
+++ b/material_management/doctype/item/item.js
@@ -0,0 +1,87 @@
+cur_frm.cscript.refresh = function(doc) {
+  if(cint(doc.is_local) && doc.has_serial_no) set_field_permlevel('has_serial_no', 1);
+  if(cint(doc.is_local) && doc.is_stock_item) set_field_permlevel('is_stock_item', 1);
+}
+
+
+cur_frm.fields_dict['default_bom'].get_query = function(doc) {
+   //var d = locals[this.doctype][this.docname];
+   return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + doc.item_code + '"  AND `tabBill Of Materials`.`is_active` = "No" and `tabBill Of Materials`.docstatus != 2 AND `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50'
+}
+
+
+// Expense Account
+// ---------------------------------
+cur_frm.fields_dict['purchase_account'].get_query = function(doc){ 
+  return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Debit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
+}
+
+// Income Account 
+// --------------------------------
+cur_frm.fields_dict['default_income_account'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Credit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`account_type` ="Income Account" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
+}
+
+
+// Purchase Cost Center 
+// -----------------------------
+cur_frm.fields_dict['cost_center'].get_query = function(doc) {
+  return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `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'
+}
+
+
+// Sales Cost Center 
+// -----------------------------
+cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) {
+  return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `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'
+}
+
+
+cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`account_type` in ("Tax", "Chargeable") and `tabAccount`.`docstatus` != 2 and `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` DESC LIMIT 50'
+}
+
+cur_frm.cscript.tax_type = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  get_server_fields('get_tax_rate',d.tax_type,'item_tax',doc, cdt, cdn, 1);
+}
+
+
+//get query select item group
+cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "No" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.%(key)s LIKE "%s"  ORDER BY  `tabItem Group`.`name` ASC LIMIT 50'
+}
+
+cur_frm.cscript.IGHelp = function(doc,dt,dn){
+  var call_back = function(){
+    var sb_obj = new SalesBrowser();        
+    sb_obj.set_val('Item Group');
+
+  }
+  loadpage('Sales Browser',call_back);
+}
+
+// for description from attachment
+// takes the first attachment and creates
+// a table with both image and attachment in HTML
+// in the "alternate_description" field
+cur_frm.cscript['Add Image'] = function(doc, dt, dn) {
+	if(!doc.file_list) {
+		msgprint('Please attach a file first!'); 
+	}
+	
+	var f = doc.file_list.split('\n')[0];
+	var fname = f.split(',')[0];
+	var fid = f.split(',')[1];
+	if(!in_list(['jpg','jpeg','gif','png'], fname.split('.')[1].toLowerCase())) {
+		msgprint('File must be of extension jpg, jpeg, gif or png'); return;
+	}
+	
+	doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">'+
+	'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
+	'<td>%(desc)s</td></tr>'+
+	'</table>', {imgurl: wn.urllib.get_file_url(fid), desc:doc.description});
+	
+	refresh_field('description_html');
+}
+
diff --git a/material_management/doctype/item/item.py b/material_management/doctype/item/item.py
new file mode 100644
index 0000000..20cd383
--- /dev/null
+++ b/material_management/doctype/item/item.py
@@ -0,0 +1,177 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+		
+	def get_tax_rate(self, tax_type):
+		rate = sql("select tax_rate from tabAccount where name = %s", tax_type)
+		ret = {
+			'tax_rate'	:	rate and flt(rate[0][0]) or 0
+		}
+		return str(ret)
+
+	def on_update(self):
+		bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
+		if bin and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
+			msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
+			raise Exception
+		check_list = []
+		for d in getlist(self.doclist,'uom_conversion_details'):
+			if not self.doc.stock_uom:
+				msgprint("Please enter Stock UOM first.")
+				raise Exception
+			
+			if cstr(d.uom) in check_list:
+				msgprint("UOM %s has been entered more than once in Conversion Factor Details." % cstr(d.uom))
+				raise Exception
+			
+			if not cstr(d.uom) in check_list:
+				check_list.append(cstr(d.uom))
+							
+			if cstr(d.uom) == cstr(self.doc.stock_uom):
+				if flt(d.conversion_factor) != 1:
+					msgprint("Conversion Fator of UOM : %s should be equal to 1. As UOM : %s is Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
+					raise Exception
+				# else set uom_exist as true
+				uom_exist='true'
+			elif cstr(d.uom) != cstr(self.doc.stock_uom) and flt(d.conversion_factor) == 1:
+				msgprint("Conversion Factor of UOM : %s should not be equal to 1. As UOM : %s is not Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
+				raise Exception
+		
+		if not cstr(self.doc.stock_uom) in check_list :
+			child = addchild( self.doc, 'uom_conversion_details', 'UOM Conversion Detail', 1, self.doclist)
+			child.uom = self.doc.stock_uom
+			child.conversion_factor = 1
+			child.save()
+
+	
+	# Check whether Ref Rate is not entered twice for same Price List and Currency
+	def check_ref_rate_detail(self):
+		check_list=[]
+		for d in getlist(self.doclist,'ref_rate_details'):
+			if [cstr(d.price_list_name),cstr(d.ref_currency)] in check_list:
+				msgprint("Ref Rate is entered twice for Price List : '%s' and Currency : '%s'." % (d.price_list_name,d.ref_currency))
+				raise Exception
+			else:
+				check_list.append([cstr(d.price_list_name),cstr(d.ref_currency)])
+				
+
+	# Check whether Tax Rate is not entered twice for same Tax Type
+	def check_item_tax(self):
+		check_list=[]
+		for d in getlist(self.doclist,'item_tax'):
+			account_type = sql("select account_type from tabAccount where name = %s",d.tax_type)
+			account_type = account_type and account_type[0][0] or ''
+			if account_type not in ['Tax', 'Chargeable']:
+				msgprint("'%s' is not Tax / Chargeable Account"%(d.tax_type))
+				raise Exception, "Tax Account validation"
+			else:
+				if d.tax_type in check_list:
+					msgprint("Rate is entered twice for Tax : '%s'." % (d.tax_type))
+					raise Exception
+				else:
+					check_list.append(d.tax_type)				
+
+	def check_for_active_boms(self, check):
+		if check in ['Is Active', 'Is Purchase Item']:
+			bom_mat = sql("select distinct t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 where t1.item_code ='%s' and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
+			if bom_mat and bom_mat[0][0]:
+				msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
+				raise Exception
+		if check == 'Is Active' or ( check == 'Is Manufactured Item' and self.doc.is_sub_contracted_item != 'Yes') or (check ==	'Is Sub Contracted Item' and self.doc.is_manufactured_item != 'Yes') :
+			bom = sql("select name from `tabBill Of Materials` where item = '%s' and is_active ='Yes'" % cstr(self.doc.name))
+			if bom and bom[0][0]:
+				msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
+				raise Exception
+		if check in ['Is Active', 'Is Pro Applicable']:
+			flat_bom = sql("select distinct t1.parent from `tabFlat BOM Detail` t1, `tabBill Of Materials` t2 where t1.item_code ='%s' and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 and t1.is_pro_applicable = 'Yes'" % self.doc.name )
+			if flat_bom and flat_bom[0][0]:
+				msgprint(" %s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
+				raise Exception
+		
+	def validate(self):
+		fl = {'is_manufactured_item'	:'Is Manufactured Item',
+					'is_sub_contracted_item':'Is Sub Contracted Item',
+					'is_purchase_item'			:'Is Purchase Item',
+					'is_pro_applicable'		 :'Is Pro Applicable'}
+		for d in fl:
+			if cstr(self.doc.fields[d]) != 'Yes':
+				self.check_for_active_boms(check = fl[d])
+		self.check_ref_rate_detail()
+		self.check_item_tax()
+		if not self.doc.min_order_qty:
+			self.doc.min_order_qty = 0
+		self.check_non_asset_warehouse()
+		
+		if self.doc.is_pro_applicable == 'Yes' and self.doc.is_manufactured_item != 'Yes':
+			msgprint("If making Production Order is allowed then, it should also allow to make Bill of Materials. Refer Manufacturing section.")
+			raise Exception
+			
+		if self.doc.is_pro_applicable == 'Yes' and self.doc.is_stock_item == 'No':
+			msgprint("As Production Order can be made for this Item, then Is Stock Item Should be 'Yes' as we maintain it's stock. Refer Manufacturing and Inventory section.", raise_exception=1)
+			
+		if self.doc.is_stock_item == "Yes" and not self.doc.default_warehouse:
+			msgprint("As we maintain stock of this item, its better to maintain default warehouse. To add default warehouse please go to 'Inventory' section. It will be fetched automatically while making Sales Order, Delivery Note, etc.. ", 1)
+
+		if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No':
+			msgprint("'Has Serial No' can not be 'Yes' for non-stock item", raise_exception=1)
+
+	def check_non_asset_warehouse(self):
+		if self.doc.is_asset_item == "Yes":
+			existing_qty = sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
+			for e in existing_qty:
+				msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." % (e[1],e[0]))
+			if existing_qty:
+				msgprint("Please transfer the above quantities to an asset warehouse before changing this item to an asset item.")
+				self.doc.is_asset_item = 'No'
+				raise Exception
+
+	def check_min_inventory_level(self):
+		if self.doc.minimum_inventory_level:
+			total_qty = sql("select sum(projected_qty) from tabBin where item_code = %s",self.doc.name)
+			if flt(total_qty) < flt(self.doc.minimum_inventory_level):
+				msgprint("Your minimum inventory level is reached")
+				send_to = []
+				send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role IN ('Material Master Manager','Purchase Manager') and t2.parent = t1.name") 
+				for d in send:
+					send_to.append(d[0])
+				msg = '''
+Minimum Inventory Level Reached
+
+Item Code: %s
+Item Name: %s
+Minimum Inventory Level: %s
+Total Available Qty: %s
+
+''' % (self.doc.item_code, self.doc.item_name, self.doc.minimum_inventory_level, total_qty)
+
+				sendmail(send_to, sender='automail@webnotestech.com', subject='Minimum Inventory Level Reached', parts=[['text/plain', msg]])
+
+	def get_file_details(self, arg = ''):
+		file = sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
+
+		ret = {
+			'file_group'	:	file and file[0]['file_group'] or '',
+			'description'	:	file and file[0]['description'] or ''
+			
+		}
+		return str(ret)
diff --git a/material_management/doctype/item/item.txt b/material_management/doctype/item/item.txt
new file mode 100644
index 0000000..b1c0ef2
--- /dev/null
+++ b/material_management/doctype/item/item.txt
@@ -0,0 +1,2294 @@
+[
+	{
+		'_last_update': '1304919275',
+		'allow_attach': 1,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:item_code',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': 1,
+		'menu_index': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Item',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'item_name,description,item_group',
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(item_name)s',
+		'tag_fields': 'item_group',
+		'use_template': None,
+		'version': 153
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00280',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00281',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00282',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00283',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00284',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Master Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 0,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00285',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Master Manager',
+		'submit': None,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00286',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00287',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01606',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01605',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Item will be saved by this name in the data base.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 0,
+		'label': 'Item Code',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01607',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Item Name',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01608',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Classify your item in any one item group by clicking on the magnifying glass',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Item Group',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01609',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'IGHelp',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01610',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<a href="javascript:cur_frm.cscript.IGHelp();">To manage Item Group, click here</a>',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Brand',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01614',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Link',
+		'options': 'Brand',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-25 14:19:11',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': '000000642',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 0,
+		'label': 'Description',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01612',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-28 09:32:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description_html',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Description HTML',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': '000000677',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-25 14:19:11',
+		'default': None,
+		'depends_on': None,
+		'description': 'Generates HTML to include image (1st attachment) in the description',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Add Image',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': '000000643',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Inventory',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01615',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter unit of measurement in which stock of this item is maintained in your warehouse.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Default UoM',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01611',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'stock_uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'Yes',
+		'depends_on': None,
+		'description': 'Select "Yes" if you are maintaining stock of this item in your Inventory.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_stock_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Is Stock Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01616',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_stock_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'valuation_method',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Valuation Method',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01617',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'valuation_method',
+		'oldfieldtype': 'Select',
+		'options': '\nFIFO\nMoving Average',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Default Warehouse',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01618',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'default_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Percentage variation in quantity to be allowed while receiving or delivering this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tolerance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Allowance Percent',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01619',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tolerance',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 're_order_level',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Re-Order Level',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01620',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 're_order_level',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': '0.00',
+		'depends_on': None,
+		'description': 'If stock level for this item has reached the minimum inventory level, system will prompt you to raise an Indent (Purchase Requisition).',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'minimum_inventory_level',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Minimum Inventory Level',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01621',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'minimum_inventory_level',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': '0.00',
+		'depends_on': None,
+		'description': 'You can enter the minimum quantity of this item to be ordered.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'min_order_qty',
+		'fieldtype': 'Currency',
+		'hidden': 0,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Minimum Order Qty',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01622',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'min_order_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01623',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Select "Yes" if this item is used for some internal purpose in your company.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_asset_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Is Asset Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01624',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_asset_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'has_batch_no',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Has Batch No',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01625',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'has_batch_no',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Selecting "Yes" will give a unique identity to each entity of this item which can be viewed in the Serial No master.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'has_serial_no',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Has Serial No',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01626',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'has_serial_no',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warranty_period',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Warranty Period (in days)',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01627',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'warranty_period',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'end_of_life',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'End of Life',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01628',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'end_of_life',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Purchase Details',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01629',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'Yes',
+		'depends_on': None,
+		'description': 'Selecting "Yes" will allow this item to appear in Purchase Order , Purchase Receipt.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_purchase_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Is Purchase Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01630',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_purchase_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Indent when you select this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_time_days',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Lead Time Days',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01631',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'lead_time_days',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Default Purchase Account in which cost of the item will be debited.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Default Expense Account',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01632',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_account',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Default Cost Center for tracking expense for this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_center',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Default Cost Center',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01633',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cost_center',
+		'oldfieldtype': 'Link',
+		'options': 'Cost Center',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Buying Cost will be updated from Purchase Orders and Purchase Receipts. <br>The buying cost will calculated by moving average method.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'buying_cost',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Buying Cost',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01634',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'buying_cost',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'last_purchase_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Last Purchase Rate',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01635',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'last_purchase_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'standard_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Standard Rate',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01636',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'standard_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01637',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'uom_conversion_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'UOM Conversion Details',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01638',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'uom_conversion_details',
+		'oldfieldtype': 'Table',
+		'options': 'UOM Conversion Detail',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Sales Details',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01639',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'Yes',
+		'depends_on': None,
+		'description': 'Selecting "Yes" will allow this item to figure in Sales Order, Delivery Note',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_sales_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Is Sales Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01640',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_sales_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Select "Yes" if this item represents some work like training, designing, consulting etc.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_service_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Is Service Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01641',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_service_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Select "Yes" if this item is to be sent to a customer or received from a supplier as a sample. Delivery notes and Purchase Receipts will update stock levels but there will be no invoice against this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_sample_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Allow Samples',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01642',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_sample_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'max_discount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Max Discount (%)',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01643',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'max_discount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-17 17:34:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_income_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Default Income Account',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL04490',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-17 17:34:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_sales_cost_center',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Cost Center',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL04491',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Cost Center',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_rate',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Sales Rate',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01644',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'sales_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01645',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Create a price list from Price List master and enter standard ref rates against each of them. On selection of a price list in Quotation, Sales Order or Delivery Note, corresponding ref rate will be fetched for this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ref_rate_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Ref Rate Details',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01646',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'ref_rate_details',
+		'oldfieldtype': 'Table',
+		'options': 'Ref Rate Detail',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Item Tax',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01647',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_tax',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Item Tax1',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01648',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_tax',
+		'oldfieldtype': 'Table',
+		'options': 'Item Tax',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Inspection Criteria',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01649',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'inspection_required',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Inspection Required',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01650',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'inspection_required',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_specification_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'Item Specification Detail',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01651',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_specification_details',
+		'oldfieldtype': 'Table',
+		'options': 'Item Specification Detail',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Manufacturing',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01652',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Selecting "Yes" will allow you to create Bill of Material showing raw material and operational costs incurred to manufacture this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_manufactured_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Allow Bill of Materials',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01653',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_manufactured_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_bom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'Default BOM',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01654',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'default_bom',
+		'oldfieldtype': 'Link',
+		'options': 'Bill Of Materials',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Selecting "Yes" will allow you to make a Production Order for this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_pro_applicable',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': 'Allow Production Order',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01655',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_pro_applicable',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:05',
+		'default': 'No',
+		'depends_on': None,
+		'description': 'Select "Yes" if you supply raw materials to your supplier to manufacture this item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_sub_contracted_item',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Is Sub Contracted Item',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': 'FL01656',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_sub_contracted_item',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-25 16:22:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2011-04-28 09:32:17',
+		'modified_by': 'Administrator',
+		'name': '000000644',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Item',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/item_attachments_detail/__init__.py b/material_management/doctype/item_attachments_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/item_attachments_detail/__init__.py
diff --git a/material_management/doctype/item_attachments_detail/item_attachments_detail.txt b/material_management/doctype/item_attachments_detail/item_attachments_detail.txt
new file mode 100644
index 0000000..083e892
--- /dev/null
+++ b/material_management/doctype/item_attachments_detail/item_attachments_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-10 15:46:04', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Item Attachments Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-10 15:46:04', 'doctype': 'DocField', 'oldfieldname': 'file_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'File Name', 'width': '220px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Attachments Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02701', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-08-10 17:07:02', 'parenttype': 'DocType', 'fieldname': 'file_name', 'fieldtype': 'Link', 'options': 'File', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-10 15:46:04', 'doctype': 'DocField', 'oldfieldname': 'file_group', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'File Group', 'width': '160px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Item Attachments Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02702', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-08-10 17:07:02', 'parenttype': 'DocType', 'fieldname': 'file_group', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-10 15:46:04', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': '300px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Item Attachments Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02703', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-08-10 17:07:02', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/item_specification_detail/__init__.py b/material_management/doctype/item_specification_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/item_specification_detail/__init__.py
diff --git a/material_management/doctype/item_specification_detail/item_specification_detail.txt b/material_management/doctype/item_specification_detail/item_specification_detail.txt
new file mode 100644
index 0000000..38fdfa2
--- /dev/null
+++ b/material_management/doctype/item_specification_detail/item_specification_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-28 13:08:08', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'IISD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Item Specification Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 13:08:09', 'doctype': 'DocField', 'oldfieldname': 'specification', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 0, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Parameter', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Specification Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01536', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-07 10:17:01', 'parenttype': 'DocType', 'fieldname': 'specification', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 13:08:09', 'doctype': 'DocField', 'oldfieldname': 'value', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Acceptance Criteria', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01537', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-05-07 10:17:01', 'parenttype': 'DocType', 'fieldname': 'value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/item_tax/__init__.py b/material_management/doctype/item_tax/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/item_tax/__init__.py
diff --git a/material_management/doctype/item_tax/item_tax.txt b/material_management/doctype/item_tax/item_tax.txt
new file mode 100644
index 0000000..a1031d1
--- /dev/null
+++ b/material_management/doctype/item_tax/item_tax.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-04-07 12:11:58', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': None, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Item Tax', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-04-07 12:11:58', 'doctype': 'DocField', 'oldfieldname': 'tax_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tax', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Tax', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01724', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-04-07 12:25:25', 'parenttype': 'DocType', 'fieldname': 'tax_type', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-04-07 12:11:58', 'doctype': 'DocField', 'oldfieldname': 'tax_rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tax Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Tax', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01725', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-04-07 12:25:25', 'parenttype': 'DocType', 'fieldname': 'tax_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/landed_cost_master/__init__.py b/material_management/doctype/landed_cost_master/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/landed_cost_master/__init__.py
diff --git a/material_management/doctype/landed_cost_master/landed_cost_master.js b/material_management/doctype/landed_cost_master/landed_cost_master.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/material_management/doctype/landed_cost_master/landed_cost_master.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/material_management/doctype/landed_cost_master/landed_cost_master.txt b/material_management/doctype/landed_cost_master/landed_cost_master.txt
new file mode 100644
index 0000000..fb2271d
--- /dev/null
+++ b/material_management/doctype/landed_cost_master/landed_cost_master.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-07-27 15:38:48', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Landed Cost Master', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01094', 'parent': 'Landed Cost Master', 'read': 1, 'create': None, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01095', 'parent': 'Landed Cost Master', 'read': 1, 'create': 1, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01096', 'parent': 'Landed Cost Master', 'read': 1, 'create': 1, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01097', 'parent': 'Landed Cost Master', 'read': 1, 'create': 1, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01098', 'parent': 'Landed Cost Master', 'read': 1, 'create': None, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01099', 'parent': 'Landed Cost Master', 'read': 1, 'create': None, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01100', 'parent': 'Landed Cost Master', 'read': 1, 'create': None, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 7, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01101', 'parent': 'Landed Cost Master', 'read': 1, 'create': None, 'creation': '2010-07-27 15:38:48', 'modified': '2010-09-20 09:46:19', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 8, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-07-27 15:38:48', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Landed Cost Master', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05711', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:46:19', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-27 15:38:48', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Master', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05713', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:46:19', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-07-27 15:38:48', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Landed Cost Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Master', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05712', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:46:19', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-07-27 15:38:48', 'doctype': 'DocField', 'oldfieldname': 'landed_cost', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Landed Cost', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Master', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05714', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-20 09:46:19', 'parenttype': 'DocType', 'fieldname': 'landed_cost', 'fieldtype': 'Table', 'options': 'Landed Cost Master Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/landed_cost_master_detail/__init__.py b/material_management/doctype/landed_cost_master_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/landed_cost_master_detail/__init__.py
diff --git a/material_management/doctype/landed_cost_master_detail/landed_cost_master_detail.txt b/material_management/doctype/landed_cost_master_detail/landed_cost_master_detail.txt
new file mode 100644
index 0000000..f72521c
--- /dev/null
+++ b/material_management/doctype/landed_cost_master_detail/landed_cost_master_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-07-27 15:30:16', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Landed Cost Master Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-27 15:30:17', 'doctype': 'DocField', 'oldfieldname': 'account_head', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Account Head', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Master Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05709', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 14:52:23', 'parenttype': 'DocType', 'fieldname': 'account_head', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-27 15:30:17', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Master Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05710', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 14:52:23', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/landed_cost_wizard/__init__.py b/material_management/doctype/landed_cost_wizard/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/landed_cost_wizard/__init__.py
diff --git a/material_management/doctype/landed_cost_wizard/landed_cost_wizard.js b/material_management/doctype/landed_cost_wizard/landed_cost_wizard.js
new file mode 100644
index 0000000..5209d1a
--- /dev/null
+++ b/material_management/doctype/landed_cost_wizard/landed_cost_wizard.js
@@ -0,0 +1,11 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+if(!doc.currency){doc.currency = sys_defaults.currency;}
+}
+
+cur_frm.fields_dict['landed_cost_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.account_type = "Chargeable" AND  tabAccount.name LIKE "%s"'
+}
+
+cur_frm.fields_dict['landed_cost_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND  tabAccount.name LIKE "%s"'
+}
\ No newline at end of file
diff --git a/material_management/doctype/landed_cost_wizard/landed_cost_wizard.py b/material_management/doctype/landed_cost_wizard/landed_cost_wizard.py
new file mode 100644
index 0000000..d339e18
--- /dev/null
+++ b/material_management/doctype/landed_cost_wizard/landed_cost_wizard.py
@@ -0,0 +1,241 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+
+  def get_purchase_receipts(self):
+    self.doc.clear_table(self.doclist,'lc_pr_details',1)
+    if not self.doc.from_pr_date or not self.doc.to_pr_date:
+      msgprint("Please enter From and To PR Date")
+      raise Exception
+    if not self.doc.currency:
+      msgprint("Please enter Currency.")
+      raise Exception
+    pr = sql("select name from `tabPurchase Receipt` where docstatus = 1 and posting_date >= '%s' and posting_date <= '%s' and currency = '%s' order by name "%(self.doc.from_pr_date,self.doc.to_pr_date,self.doc.currency), as_dict = 1)
+    if len(pr)>200:
+      msgprint("Please enter date of shorter duration as there are too many purchase receipt, hence it cannot be loaded.")
+      raise Exception
+    for i in pr:
+      if i and i['name']:
+        pr_no = addchild(self.doc, 'lc_pr_details', 'LC PR Detail', 1, self.doclist)
+        pr_no.purchase_receipt_no = i and i['name'] or ''
+        pr_no.save()
+
+
+  def update_pr_lc_se(self):
+    lst = []
+    condition = ' name in('
+    
+    amt = 0
+    for d in getlist(self.doclist, 'lc_pr_details'):
+      
+      if cint(d.include_in_landed_cost) == 1:
+        condition += '"'+d.purchase_receipt_no+'",'
+        lst.append(d.purchase_receipt_no) 
+    condition += '"")'
+    
+    amount = sql("SELECT SUM(net_total) FROM `tabPurchase Receipt` WHERE docstatus = 1 AND %s"%condition)
+    amt = amount and flt(amount[0][0]) or 0
+    for lc in getlist(self.doclist, 'landed_cost_details'):
+      for name in lst:
+        pr_oc_det = sql("select name from `tabPurchase Tax Detail` where parent = %s and category = 'For Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s ",(name, lc.account_head))
+        #obj = get_obj('Purchase Receipt', name, with_children = 1)
+        if not pr_oc_det:
+          obj = get_obj('Purchase Receipt', name, with_children = 1)
+          lgth = cint(sql("select count(name) from `tabPurchase Tax Detail` where parent = '%s' "%(name))[0][0])
+          pr_oc = addchild(obj.doc, 'purchase_tax_details', 'Purchase Tax Detail', 1)
+          pr_oc.category = 'For Valuation'
+          pr_oc.add_deduct_tax = 'Add'
+          pr_oc.charge_type = 'Actual'
+          pr_oc.description = lc.description
+          pr_oc.account_head = lc.account_head
+          pr_oc.rate = flt(flt(lc.amount) * flt(obj.doc.net_total/ amt))
+          pr_oc.tax_amount = flt(flt(lc.amount) * flt(obj.doc.net_total/ amt))
+          pr_oc.total = obj.doc.grand_total
+          pr_oc.docstatus = 1
+          pr_oc.idx = cint(lgth)
+          pr_oc.save()
+        else:
+          obj = get_obj('Purchase Receipt', name)
+          sql("update `tabPurchase Tax Detail` set rate = %s, tax_amount = %s where name = %s and parent = %s",(flt(flt(lc.amount) * flt(obj.doc.net_total/ amt)),flt(flt(lc.amount) * flt(obj.doc.net_total/ amt)),pr_oc_det[0][0],name))
+        self.calc_pr_other_charges(name)
+        obj = get_obj('Purchase Receipt', name, with_children = 1)
+        for d in getlist(obj.doclist, 'purchase_receipt_details'):
+          if flt(d.qty):
+            d.valuation_rate = (flt(d.purchase_rate) + (flt(d.rm_supp_cost) / flt(d.qty)) + (flt(d.item_tax_amount)/flt(d.qty))) / flt(d.conversion_factor)
+            d.save()
+          sql("update `tabStock Ledger Entry` set incoming_rate = '%s' where voucher_detail_no = '%s'"%(flt(d.valuation_rate), d.name))
+          bin_name = sql("select t1.name, t2.name, t2.posting_date, t2.posting_time from `tabBin` t1, `tabStock Ledger Entry` t2 where t2.voucher_detail_no = '%s' and t2.item_code = t1.item_code and t2.warehouse = t1.warehouse LIMIT 1"%(d.name))
+          if bin_name and bin_name[0][0]:
+            obj = get_obj('Bin', bin_name[0][0]).update_item_valuation(bin_name[0][1], bin_name[0][2], bin_name[0][3])
+
+		# now distribute the taxes among the PRs
+		for lc in getlist(self.doclist, 'landed_cost_details'):
+			for d in lst:
+				pr_id = d.purchase_receipt_no
+				
+				# load the purchase receipt object
+				pr = get_obj('Purchase Receipt', pr_id, with_children = 1)
+				
+				# get the tax detail (for valuation) in the PR if it exists 
+				pr_oc_det = sql("select name from `tabPurchase Tax Detail` where parent = %s and category = 'For Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s ",(pr_id, lc.account_head))
+				
+				# update tax rate and tax amount
+				tax_amount = flt(flt(lc.amount) * flt(pr.doc.net_total/ amt))
+				
+				# for display
+				d.net_total = pr.doc.net_total
+				d.added_cost = tax_amount
+				d.save()
+				
+				# if not exist, create the tax detail for valuation
+				if not pr_oc_det:
+					lgth = cint(sql("select count(name) from `tabPurchase Tax Detail` where parent = '%s' "%(pr_id))[0][0])
+					pr_oc = addchild(pr.doc, 'purchase_tax_details', 'Purchase Tax Detail', 1)
+					pr_oc.category = 'For Valuation'
+					pr_oc.add_deduct_tax = 'Add'
+					pr_oc.charge_type = 'Actual'
+					pr_oc.description = lc.description
+					pr_oc.account_head = lc.account_head
+					pr_oc.rate = tax_amount
+					pr_oc.tax_amount = tax_amount
+					pr_oc.total = obj.doc.grand_total
+					pr_oc.docstatus = 1
+					pr_oc.idx = cint(lgth)
+					pr_oc.save()
+				else:
+					obj = get_obj('Purchase Receipt', name)
+					sql("update `tabPurchase Tax Detail` set rate = %s, tax_amount = %s where name = %s and parent = %s", \
+						(tax_amount, tax_amount, pr_oc_det[0][0], pr_id))
+					
+				self.calc_pr_other_charges(name)
+				
+				# reload - and update the stock entries with the
+				# additional valuations
+				
+				obj = get_obj('Purchase Receipt', name, with_children = 1)
+				for d in getlist(obj.doclist, 'purchase_receipt_details'):
+					if flt(d.qty):
+						d.valuation_rate = (flt(d.purchase_rate) + (flt(d.rm_supp_cost) / flt(d.qty)) + (flt(d.item_tax_amount)/flt(d.qty))) / flt(d.conversion_factor)
+						d.save()
+					sql("update `tabStock Ledger Entry` set incoming_rate = '%s' where voucher_detail_no = '%s'"%(flt(d.valuation_rate), d.name))
+					bin_name = sql("select t1.name, t2.name, t2.posting_date, t2.posting_time from `tabBin` t1, `tabStock Ledger Entry` t2 where t2.voucher_detail_no = '%s' and t2.item_code = t1.item_code and t2.warehouse = t1.warehouse LIMIT 1"%(d.name))
+
+					# update valuation of the item
+					if bin_name and bin_name[0][0]:
+						obj = get_obj('Bin', bin_name[0][0]).update_item_valuation(bin_name[0][1], bin_name[0][2], bin_name[0][3])
+
+	def add_deduct_taxes(self, ocd, oc, tax_amount, total_amount, total, prev_total, f=1):
+		ocd[oc].total_amount = flt(tax_amount.toFixed(2))		 
+		ocd[oc].total_tax_amount = flt(prev_total.toFixed(2))
+		ocd[oc].tax_amount += flt(tax_amount.toFixed(2))
+			 
+		total_amount = flt(ocd[oc].tax_amount)
+		total_tax_amount = flt(ocd[oc].total_tax_amount) + (f * flt(total_amount))
+		
+		if ocd[oc].category != "For Valuation":	
+			prev_total += f * flt(ocd[oc].total_amount)
+			total += f * flt(ocd[oc].tax_amount)
+			ocd[oc].total = flt(total) + (f * flt(tax[t].tax_amount))
+		else:
+			prev_total = prev_total				
+			ocd[oc].total = flt(total)
+		if ocd[oc].category != "For Total":
+			item_tax += f * ocd[oc].total_amount
+		ocd[oc].save()
+		
+		return total, prev_total
+		
+	# calculate the taxes for these PRs		
+	def calc_pr_other_charges(self, name):
+		
+		# re-calculate other charges
+		obj = get_obj('Purchase Receipt', name, with_children = 1)
+		total = 0
+		net_total = obj.doc.net_total
+
+
+		for prd in getlist(obj.doclist, 'purchase_receipt_details'):
+			prev_total, item_tax = flt(prd.amount), 0
+			total += flt(flt(prd.qty) * flt(prd.purchase_rate))
+			
+			check_tax = prd.item_tax_rate and eval(prd.item_tax_rate) or {}
+			ocd = getlist(obj.doclist, 'purchase_tax_details')
+			
+			# calculate tax for other charges
+			for oc in range(len(ocd)):
+				if check_tax.get(ocd[oc].account_head) and ocd[oc].charge_type != 'Actual':
+					rate = check_tax[ocd[oc].account_head]
+				else:
+					rate = flt(ocd[oc].rate)
+				
+				tax_amount = self.cal_tax(ocd, prd, rate, net_total, oc)
+				if ocd[oc].add_deduct_tax == 'Add':
+					add_deduct_taxes(self, ocd, oc, tax_amount, total_amount, total, prev_total, f=1)
+											
+				elif ocd[oc].add_deduct_tax == 'Deduct':
+					add_deduct_taxes(self, ocd, oc, tax_amount, total_amount, total, prev_total, f=-1)
+
+			prd.item_tax_amount = flt(item_tax)
+			prd.save()
+		obj.doc.save()
+					
+	def cal_tax(self, ocd, prd, rate, net_total, oc):
+		tax_amount = 0
+		if ocd[oc].charge_type == 'Actual':
+			value = flt(flt(rate) / flt(net_total))
+			return flt(flt(value) * flt(prd.amount))
+			
+		elif ocd[oc].charge_type == 'On Net Total':
+			return flt(flt(rate) * flt(prd.amount) / 100)
+			
+		elif ocd[oc].charge_type == 'On Previous Row Amount':
+			
+			row_no = cstr(ocd[oc].row_id)
+			row = (row_no).split("+")
+			for r in range(0, len(row.length)):
+				id = cint(row[r])
+				tax_amount += flt((flt(rate) * flt(ocd[id-1].total_amount) / 100))
+			row_id = row_no.find("/")
+			if row_id != -1:
+				rate = ''
+				row = (row_no).split("/")
+				
+				id1 = cint(row[0])
+				id2 = cint(row[1])
+				tax_amount = flt(flt(ocd[id1-1].total_amount) / flt(ocd[id2-1].total_amount))
+				
+			return tax_amount
+
+  # get details for landed cost table from master
+  # ---------------------------------------------
+  def get_landed_cost_master_details(self):
+    msgprint('fetching details.....' + self.doc.landed_cost)
+    self.doc.clear_table(self.doclist, 'landed_cost_details')
+    idx = 0
+    landed_cost = sql("select account_head, description from `tabLanded Cost Master Detail` where parent=%s", (self.doc.landed_cost), as_dict = 1)
+    msgprint(landed_cost)
+    for cost in landed_cost:
+      lct = addchild(self.doc, 'landed_cost_details', 'Landed Cost Detail', 1, self.doclist)
+      lct.account_head = cost['account_head']
+      lct.description = cost['description']
diff --git a/material_management/doctype/landed_cost_wizard/landed_cost_wizard.txt b/material_management/doctype/landed_cost_wizard/landed_cost_wizard.txt
new file mode 100644
index 0000000..afbfad4
--- /dev/null
+++ b/material_management/doctype/landed_cost_wizard/landed_cost_wizard.txt
@@ -0,0 +1,660 @@
+[
+	{
+		'_last_update': '1303877045',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Landed Cost Wizard',
+		'name_case': None,
+		'owner': None,
+		'parent': None,
+		'parent_node': '',
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 1,
+		'smallicon': None,
+		'use_template': None,
+		'version': 33
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00306',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00307',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00308',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00309',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00310',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00311',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00312',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'PERM00313',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-27 09:34:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Landed Cost Help',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': '000000649',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<div class=\'info-box\'>\nThis wizard helps you add costs to your item valuation. This is useful in cases where the true item cost is know after the items have been accepted in the warehouse. For example if your freight and clearing charges are known much later, hence the term "Landed Cost" <br><br>\n<b>How to use this wizard?</b>\n<ol>\n<li>Select the Purchase Receipts on whose items to want to add the costs</li>\n<li>Enter the costs in the second table</li>\n<li>Click on Update PR</li>\n</ol>\n</div>',
+		'owner': 'Administrator',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_pr_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'From PR Date',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01747',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_pr_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'To PR Date',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01748',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Currency',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01749',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Currency',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Get Purchase Receipt',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01750',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'get_purchase_receipts',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Purchase Receipts',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01751',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'The landed costs will be distributed among items in these Purchase Receipts',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lc_pr_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'LC PR Details',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01752',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'LC PR Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Landed Cost Detail',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01753',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'landed_cost',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Select Landed Cost Details Master',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01754',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Landed Cost Master',
+		'owner': 'Administrator',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Get Details',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01755',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'get_landed_cost_master_details',
+		'owner': 'Administrator',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': 'Additional costs to be loaded to item valuation',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'landed_cost_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Landed Cost Details',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01756',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Landed Cost Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Update PR',
+		'modified': '2011-04-27 09:36:36',
+		'modified_by': 'Administrator',
+		'name': 'FL01757',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'update_pr_lc_se',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Landed Cost Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/purchase_receipt/__init__.py b/material_management/doctype/purchase_receipt/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/purchase_receipt/__init__.py
diff --git a/material_management/doctype/purchase_receipt/purchase_receipt.js b/material_management/doctype/purchase_receipt/purchase_receipt.js
new file mode 100644
index 0000000..da06321
--- /dev/null
+++ b/material_management/doctype/purchase_receipt/purchase_receipt.js
@@ -0,0 +1,285 @@
+cur_frm.cscript.tname = "Purchase Receipt Detail";
+cur_frm.cscript.fname = "purchase_receipt_details";
+cur_frm.cscript.other_fname = "purchase_tax_details";
+
+$import(Purchase Common)
+$import(Purchase Other Charges)
+$import(SMS Control)
+
+//========================== On Load ================================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+
+  if(!doc.fiscal_year && doc.__islocal){ set_default_values(doc);}
+  if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
+  if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
+  if (!doc.status) doc.status = 'Draft';
+
+  if(doc.__islocal){ 
+    cur_frm.cscript.get_default_schedule_date(doc);
+  }  
+  
+  if(doc.__islocal){
+    hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
+  }
+  
+  if(doc.supplier) unhide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
+  
+}
+
+//========================== Refresh ===============================================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
+
+  // Unhide Fields in Next Steps
+  // ---------------------------------
+  cur_frm.clear_custom_buttons();
+  if(doc.docstatus == 1){
+    var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');
+    allow_billing = 0;
+    for(var i in ch){
+      if(ch[i].qty > ch[i].billed_qty) allow_billing = 1;
+    }
+   cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']);
+   cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+  }
+  else{
+    hide_field(['Repair Purchase Receipt']);
+  }
+}
+
+
+//Supplier
+cur_frm.cscript.supplier = function(doc,dt,dn) {
+  if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
+  if(doc.supplier) unhide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
+}
+
+cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  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'].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';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  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';
+}
+
+
+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;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
+  locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
+}
+
+// Get Purchase Order Button
+// -----------------
+cur_frm.cscript['Pull Purchase Order Details'] = function(doc, dt, dn) {
+  var callback = function(r,rt) { 
+	  unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);			  
+	  refresh_many(['supplier','supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email','purchase_receipt_details']);
+  }
+  get_server_fields('get_po_details','','',doc, dt, dn,1,callback);
+}
+
+
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+  tn = createLocal('Contact');
+  locals['Contact'][tn].is_supplier = 1;
+  if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier;
+  loaddoc('Contact', tn);
+}
+
+//======================= posting date =============================
+cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
+  if(doc.__islocal){ 
+    cur_frm.cscript.get_default_schedule_date(doc);
+  }
+}
+
+// ***************** Get project name *****************
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+
+//========================= Overloaded query for link batch_no =============================================================
+cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.item_code){
+    return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50"
+  }
+  else{
+    alert("Please enter Item Code.");
+  }
+}
+
+cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
+  if(doc.select_print_heading){
+    // print heading
+    cur_frm.pformat.print_heading = doc.select_print_heading;
+  }
+  else
+    cur_frm.pformat.print_heading = "Purchase Receipt";
+}
+// ***************** Get Print Heading  *****************
+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';
+}
+
+//========================= Received Qty =============================================================
+
+cur_frm.cscript.received_qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  ret = {
+      'qty' : 0,
+      'stock_qty': 0,
+      'rejected_qty' : 0
+    }
+  set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+  cur_frm.cscript.calc_amount(doc, 2);
+}
+
+//======================== Qty (Accepted Qty) =========================================================
+
+cur_frm.cscript.qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  // Step 1 :=> Check If Qty > Received Qty
+  if (flt(d.qty) > flt(d.received_qty)) {
+    alert("Accepted Qty cannot be greater than Received Qty")
+    ret = {
+      'qty' : 0,
+      'stock_qty': 0,
+      'rejected_qty' : 0
+    }
+    // => Set Qty = 0 and rejected_qty = 0
+    set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+    cur_frm.cscript.calc_amount(doc, 2);
+    // => Return
+    return
+  }
+  // Step 2 :=> Check IF Qty <= REceived Qty
+  else {
+    ret = {
+      'rejected_qty':flt(d.received_qty) - flt(d.qty)
+    }
+    // => Set Rejected Qty = Received Qty - Qty
+    set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+    // => Calculate Amount
+    cur_frm.cscript.calc_amount(doc, 2);
+    cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
+  }  
+}
+
+//======================== Rejected Qty =========================================================
+cur_frm.cscript.rejected_qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  // Step 1 :=> Check If Rejected Qty > Received Qty
+  if (flt(d.rejected_qty) > flt(d.received_qty)) {
+    alert("Rejected Qty cannot be greater than Received Qty") 
+    ret = {
+      'qty' : 0,
+      'stock_qty': 0,
+      'rejected_qty' : 0
+    }
+    // => Set Qty = 0 and rejected_qty = 0
+    set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+    cur_frm.cscript.calc_amount(doc, 2);
+    // => Return
+    return
+  }
+  // Step 2 :=> Check IF Rejected Qty <= REceived Qty
+  else {
+    ret = {
+      'qty':flt(d.received_qty) - flt(d.rejected_qty)
+    }
+    // => Set Qty = Received Qty - Rejected Qty
+    set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+    // Calculate Amount
+    cur_frm.cscript.calc_amount(doc, 2);
+    cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
+  }
+}
+
+//================================= Purchase Order No Get Query ====================================
+cur_frm.fields_dict['purchase_order_no'].get_query = function(doc) {
+  if (doc.supplier)
+    return 'SELECT DISTINCT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`supplier` = "' +doc.supplier + '" and`tabPurchase Order`.`docstatus` = 1 and `tabPurchase Order`.`status` != "Stopped" and ifnull(`tabPurchase Order`.`per_received`, 0) < 100  and `tabPurchase Order`.`currency` = ifnull("' +doc.currency+ '","") and `tabPurchase Order`.company = "'+ doc.company +'" and `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50';
+  else
+    return 'SELECT DISTINCT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 and `tabPurchase Order`.`company` = "'+ doc.company +'" and `tabPurchase Order`.`status` != "Stopped" and ifnull(`tabPurchase Order`.`per_received`, 0) < 100 and `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50';
+}
+
+// QA INspection report get_query
+//---------------------------------
+
+cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = function(doc) {
+  return 'SELECT `tabQA Inspection Report`.name FROM `tabQA Inspection Report` WHERE `tabQA Inspection Report`.docstatus = 1 AND `tabQA Inspection Report`.%(key)s LIKE "%s"';
+}
+
+// On Button Click Functions
+// ------------------------------------------------------------------------------
+
+
+// ================================ Make Purchase Invoice ==========================================
+cur_frm.cscript['Make Purchase Invoice'] = function() {
+  n = createLocal('Payable Voucher');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Payable Voucher'][n]]),
+    'from_doctype': cur_frm.doc.doctype,
+    'to_doctype':'Payable Voucher',
+    'from_docname': cur_frm.doc.name,
+    'from_to_list':"[['Purchase Receipt','Payable Voucher'],['Purchase Receipt Detail','PV Detail']]"
+    }, function(r,rt) {
+       loaddoc('Payable Voucher', n);
+    }
+  );
+}
+
+
+
+
+//****************** For print sales order no and date*************************
+cur_frm.pformat.purchase_order_no = function(doc, cdt, cdn){
+  //function to make row of table
+  
+  var make_row = function(title,val1, val2, bold){
+    var bstart = '<b>'; var bend = '</b>';
+
+    return '<tr><td style="width:39%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+     +'<td style="width:61%;text-align:left;">'+val1+(val2?' ('+dateutil.str_to_user(val2)+')':'')+'</td>'
+     +'</tr>'
+  }
+
+  out ='';
+  
+  var cl = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');
+
+  // outer table  
+  var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
+  
+  // main table
+  out +='<table class="noborder" style="width:100%">';
+
+  // add rows
+  if(cl.length){
+    prevdoc_list = new Array();
+    for(var i=0;i<cl.length;i++){
+      if(cl[i].prevdoc_doctype == 'Purchase Order' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
+        prevdoc_list.push(cl[i].prevdoc_docname);
+        if(prevdoc_list.length ==1)
+          out += make_row(cl[i].prevdoc_doctype, cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
+        else
+          out += make_row('', cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
+      }
+    }
+  }
+
+  out +='</table></td></tr></table></div>';
+
+  return out;
+}
diff --git a/material_management/doctype/purchase_receipt/purchase_receipt.py b/material_management/doctype/purchase_receipt/purchase_receipt.py
new file mode 100644
index 0000000..44cd2c7
--- /dev/null
+++ b/material_management/doctype/purchase_receipt/purchase_receipt.py
@@ -0,0 +1,434 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.defaults = get_defaults()
+    self.tname = 'Purchase Receipt Detail'
+    self.fname = 'purchase_receipt_details'
+    self.count = 0
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+
+  # Client Trigger Functions
+  #----------------------------------------------------------------------------------------------------
+
+  def get_default_schedule_date(self):
+    get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
+    
+#-----------------Validation For Fiscal Year------------------------
+  def validate_fiscal_year(self):
+    get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date')
+    
+  # Get Supplier Details 
+  #def get_supplier_details(self, name = ''):
+  #  return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
+  
+  # Get Item Details
+  def get_item_details(self, arg = ''):
+    return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg))
+  
+  # Get UOM Details
+  def get_uom_details(self, arg = ''):
+    return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
+  
+  # GET TERMS & CONDITIONS
+  # =====================================================================================
+  def get_tc_details(self):
+    return get_obj('Purchase Common').get_tc_details(self)
+
+  # get available qty at warehouse
+  def get_bin_details(self, arg = ''):
+    return cstr(get_obj(dt='Purchase Common').get_bin_details(arg))
+
+  # Pull Purchase Order
+  def get_po_details(self):
+    self.validate_prev_docname()
+    get_obj('DocType Mapper', 'Purchase Order-Purchase Receipt').dt_map('Purchase Order', 'Purchase Receipt', self.doc.purchase_order_no, self.doc, self.doclist, "[['Purchase Order','Purchase Receipt'],['PO Detail', 'Purchase Receipt Detail'],['Purchase Tax Detail','Purchase Tax Detail']]")
+  
+  # validate if PO has been pulled twice
+  def validate_prev_docname(self):
+    for d in getlist(self.doclist, 'purchase_receipt_details'): 
+      if self.doc.purchase_order_no and d.prevdoc_docname and self.doc.purchase_order_no == d.prevdoc_docname:
+        msgprint(cstr(self.doc.purchase_order_no) + " Purchase Order details have already been pulled. ")
+        raise Exception
+
+
+  # validation
+  #-------------------------------------------------------------------------------------------------------------
+  # validate accepted and rejected qty
+  def validate_accepted_rejected_qty(self):
+    for d in getlist(self.doclist, "purchase_receipt_details"):
+      
+      # If Reject Qty than Rejected warehouse is mandatory    
+      if flt(d.rejected_qty) and (not self.doc.rejected_warehouse):
+        msgprint("Rejected Warehouse is necessary if there are rejections. See 'Receipt Items'")
+        raise Exception
+
+      # Check Received Qty = Accepted Qty + Rejected Qty 
+      if ((flt(d.qty) + flt(d.rejected_qty)) != flt(d.received_qty)):
+        
+        msgprint("Sum of Accepted Qty and Rejected Qty must be equal to Received quantity. Error for Item: " + cstr(d.item_code))
+        raise Exception
+
+
+  # update valuation rate
+  def update_valuation_rate(self):
+    total_b_cost = flt(self.doc.buying_cost_transport) + flt(self.doc.buying_cost_taxes) + flt(self.doc.buying_cost_other)
+    for d in getlist(self.doclist, 'purchase_receipt_details'):
+      if flt(self.doc.net_total) and flt(d.qty):
+        #d.valuation_rate = (flt(d.purchase_rate) + ((flt(d.amount) * (total_b_cost)) / (self.doc.net_total * flt(d.qty))) + (flt(d.rm_supp_cost) / flt(d.qty))) / flt(d.conversion_factor)
+        d.valuation_rate = (flt(d.purchase_rate) + ((flt(d.amount) * (total_b_cost)) / (self.doc.net_total * flt(d.qty))) + (flt(d.rm_supp_cost) / flt(d.qty)) + (flt(d.item_tax_amount)/flt(d.qty))) / flt(d.conversion_factor)
+  
+  # Check for Stopped status 
+  def check_for_stopped_status(self, pc_obj):
+    check_list =[]
+    for d in getlist(self.doclist, 'purchase_receipt_details'):
+      if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
+        check_list.append(d.prevdoc_docname)
+        pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
+
+  #check in manage account if purchase order required or not.
+  # ====================================================================================
+  def po_required(self):
+    res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'po_required'")
+    if res and res[0][0]== 'Yes':
+       for d in getlist(self.doclist,'purchase_receipt_details'):
+         if not d.prevdoc_docname:
+           msgprint("Purchse Order No. required against item %s"%d.item_code)
+           raise Exception
+    
+   
+  # validate
+  def validate(self):
+    self.po_required()
+    self.validate_fiscal_year()
+    set(self.doc, 'status', 'Draft')       # set status as "Draft"
+    self.validate_accepted_rejected_qty()
+    self.validate_inspection()             # Validate Inspection
+    get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
+
+    pc_obj = get_obj(dt='Purchase Common')
+    pc_obj.validate_for_items(self)
+    pc_obj.validate_mandatory(self)
+    pc_obj.validate_conversion_rate(self)
+    pc_obj.get_prevdoc_date(self)
+    pc_obj.validate_reference_value(self)
+    self.check_for_stopped_status(pc_obj)
+
+    # get total in words
+    self.doc.in_words = pc_obj.get_total_in_words(get_defaults().get('currency') or 'INR', self.doc.grand_total)
+    self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
+    # update valuation rate
+    self.update_valuation_rate()
+
+  
+  # On Update
+  # ----------------------------------------------------------------------------------------------------    
+  def on_update(self):
+    if self.doc.rejected_warehouse:
+      for d in getlist(self.doclist,'purchase_receipt_details'):
+        d.rejected_warehouse = self.doc.rejected_warehouse
+    
+    self.update_rw_material_detail()
+    get_obj('Stock Ledger').scrub_serial_nos(self)
+
+
+  # On Submit
+  # -----------------------------------------------------------------------------------------------------
+
+ # Update Stock
+  def update_stock(self, is_submit):
+    pc_obj = get_obj('Purchase Common')
+    self.values = []
+    for d in getlist(self.doclist, 'purchase_receipt_details'):
+      # Check if is_stock_item == 'Yes'
+      if sql("select is_stock_item from tabItem where name=%s", d.item_code)[0][0]=='Yes':
+        ord_qty = 0
+        pr_qty = flt(d.qty) * flt(d.conversion_factor) 
+        
+        # Check If Prevdoc Doctype is Purchase Order  
+        if cstr(d.prevdoc_doctype) == 'Purchase Order':
+          # get qty and pending_qty of prevdoc 
+          curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'PO Detail', 'Purchase Order - Purchase Receipt', self.doc.name)
+          max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[0]), 0
+          
+          if flt(qty) + flt(pr_qty) > flt(max_qty):
+            curr_qty = (flt(max_qty) - flt(qty)) * flt(d.conversion_factor)
+          else:
+            curr_qty = flt(pr_qty)
+          
+          ord_qty = -flt(curr_qty)
+          # update order qty in bin
+          bin = get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(ord_qty), 0, 0, d.item_code, self.doc.transaction_date)
+        
+        # UPDATE actual qty to warehouse by pr_qty
+        self.make_sl_entry(d, d.warehouse, flt(pr_qty), d.valuation_rate, is_submit)
+        # UPDATE actual to rejected warehouse by rejected qty
+        if flt(d.rejected_qty) > 0:
+          self.make_sl_entry(d, self.doc.rejected_warehouse, flt(d.rejected_qty) * flt(d.conversion_factor), d.valuation_rate, is_submit)
+
+    self.bk_flush_supp_wh(is_submit)
+
+    if self.values:
+      get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
+
+
+  # make Stock Entry
+  def make_sl_entry(self, d, wh, qty, in_value, is_submit):
+    self.values.append({
+      'item_code'           : d.fields.has_key('item_code') and d.item_code or d.rm_item_code,
+      'warehouse'           : wh,
+      'transaction_date'    : self.doc.transaction_date,
+      'posting_date'        : self.doc.posting_date,
+      'posting_time'        : self.doc.posting_time,
+      'voucher_type'        : 'Purchase Receipt',
+      'voucher_no'          : self.doc.name,
+      'voucher_detail_no'   : d.name, 
+      'actual_qty'          : qty, 
+      'stock_uom'           : d.stock_uom,
+      'incoming_rate'       : in_value,
+      'company'             : self.doc.company,
+      'fiscal_year'         : self.doc.fiscal_year,
+      'is_cancelled'        : (is_submit==1) and 'No' or 'Yes',
+      'batch_no'            : d.batch_no,
+      'serial_no'           : d.serial_no
+      })
+
+
+  def validate_inspection(self):
+    for d in getlist(self.doclist, 'purchase_receipt_details'):     #Enter inspection date for all items that require inspection
+      ins_reqd = sql("select inspection_required from `tabItem` where name = %s", (d.item_code), as_dict = 1)
+      ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No'        
+      if ins_reqd == 'Yes' and not d.qa_no:
+        msgprint("Item: " + d.item_code + " requires QA Inspection. Please enter QA No or report to authorized person to create QA Inspection Report")
+
+  # Check for Stopped status 
+  def check_for_stopped_status(self, pc_obj):
+    check_list =[]
+    for d in getlist(self.doclist, 'purchase_receipt_details'):
+      if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
+        check_list.append(d.prevdoc_docname)
+        pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
+
+
+  # on submit        
+  def on_submit(self):
+    # Check for Approving Authority
+    get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
+
+    # Set status as Submitted
+    set(self.doc,'status', 'Submitted')
+    pc_obj = get_obj('Purchase Common')
+      
+    # Update Previous Doc i.e. update pending_qty and Status accordingly
+    pc_obj.update_prevdoc_detail(self, is_submit = 1)
+        
+    # Update Serial Record
+    get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1)
+
+    # Update Stock 
+    self.update_stock(is_submit = 1)
+    
+    # Update last purchase rate 
+    pc_obj.update_last_purchase_rate(self, 1)
+  
+    # on submit notification
+    get_obj('Notification Control').notify_contact('Purchase Receipt', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
+
+
+
+
+  #On Cancel
+  #----------------------------------------------------------------------------------------------------
+  def check_next_docstatus(self):
+    submit_rv = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % (self.doc.name))
+    if submit_rv:
+      msgprint("Purchase Invoice : " + cstr(self.submit_rv[0][0]) + " has already been submitted !")
+      raise Exception , "Validation Error."
+
+
+  def on_cancel(self):
+    pc_obj = get_obj('Purchase Common')
+    
+    self.check_for_stopped_status(pc_obj)
+    # 1.Check if Payable Voucher has been submitted against current Purchase Order
+    # pc_obj.check_docstatus(check = 'Next', doctype = 'Payable Voucher', docname = self.doc.name, detail_doctype = 'PV Detail')
+    
+    submitted = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % self.doc.name)
+    if submitted:
+      msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
+      raise Exception
+
+    # 2.Set Status as Cancelled
+    set(self.doc,'status','Cancelled')
+    
+    # 3. Cancel Serial No   
+    get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 0, is_incoming = 1)
+
+    # 4.Update Bin  
+    self.update_stock(is_submit = 0)
+    
+    # 5.Update Indents Pending Qty and accordingly it's Status 
+    pc_obj.update_prevdoc_detail(self, is_submit = 0)
+
+    # 6. Update last purchase rate 
+    pc_obj.update_last_purchase_rate(self, 0)
+
+        
+#----------- code for Sub-contracted Items -------------------
+  #--------check for sub-contracted items and accordingly update PR raw material detail table--------
+  def update_rw_material_detail(self):
+  
+    for d in getlist(self.doclist,'purchase_receipt_details'):
+      item_det = sql("select is_sub_contracted_item, is_purchase_item from `tabItem` where name = '%s'"%(d.item_code))
+      
+      if item_det[0][0] == 'Yes':
+        if item_det[0][1] == 'Yes':
+          if not self.doc.is_subcontracted:
+            msgprint("Please enter whether purchase receipt to be made for subcontracting or for purchase in 'Is Subcontracted' field .")
+            raise Exception
+          if self.doc.is_subcontracted == 'Yes':
+            if not self.doc.supplier_warehouse:
+              msgprint("Please Enter Supplier Warehouse for subcontracted Items")
+              raise Exception         
+            self.add_bom(d)
+          else:
+            self.doc.clear_table(self.doclist,'pr_raw_material_details',1)
+            self.doc.save()
+        elif item_det[0][1] == 'No':
+          if not self.doc.supplier_warehouse:
+            msgprint("Please Enter Supplier Warehouse for subcontracted Items")
+            raise Exception
+          self.add_bom(d)
+        
+      self.delete_irrelevant_raw_material()
+      #---------------calculate amt in  PR Raw Material Detail-------------
+      self.calculate_amount(d)
+
+
+  def add_bom(self, d):
+    #----- fetching default bom from Bill of Materials instead of Item Master --
+    bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.description from `tabBill Of Materials` t1, `tabBOM Material` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1 and t2.docstatus =1" % d.item_code)
+    if not bom_det:
+      msgprint("No default BOM exists for item: %s" % d.item_code)
+      raise Exception
+    else:
+      #-------------- add child function--------------------
+      chgd_rqd_qty = []
+      for i in bom_det:
+        
+        if i and not sql("select name from `tabPR Raw Material Detail` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
+
+          rm_child = addchild(self.doc, 'pr_raw_material_details', 'PR Raw Material Detail', 1, self.doclist)
+
+          rm_child.reference_name = d.name
+          rm_child.bom_detail_no = i and i[6] or ''
+          rm_child.main_item_code = i and i[0] or ''
+          rm_child.rm_item_code = i and i[1] or ''
+          rm_child.description = i and i[7] or ''          
+          rm_child.stock_uom = i and i[5] or ''
+          rm_child.rate = i and flt(i[3]) or flt(i[4])
+          rm_child.conversion_factor = d.conversion_factor
+          rm_child.required_qty = flt(i  and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
+          rm_child.consumed_qty = flt(i  and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
+          rm_child.amount = flt(flt(rm_child.consumed_qty)*flt(rm_child.rate))
+          rm_child.save()
+          chgd_rqd_qty.append(cstr(i[1]))
+        else:
+          act_qty = flt(i  and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
+          for pr_rmd in getlist(self.doclist, 'pr_raw_material_details'):
+            if i and i[6] == pr_rmd.bom_detail_no and (flt(act_qty) != flt(pr_rmd.required_qty) or i[1] != pr_rmd.rm_item_code or i[7] != pr_rmd.description):
+              chgd_rqd_qty.append(cstr(i[1]))
+              pr_rmd.main_item_code = i[0]
+              pr_rmd.rm_item_code = i[1]
+              pr_rmd.description = i[7]              
+              pr_rmd.stock_uom = i[5]
+              pr_rmd.required_qty = flt(act_qty)
+              pr_rmd.consumed_qty = flt(act_qty)
+              pr_rmd.rate = i and flt(i[3]) or flt(i[4])
+              pr_rmd.amount = flt(flt(pr_rmd.consumed_qty)*flt(pr_rmd.rate))
+              pr_rmd.save()
+      if chgd_rqd_qty:
+        msgprint("Please check consumed quantity for Raw Material Item Code: '%s'in Raw materials Detail Table" % ((len(chgd_rqd_qty) > 1 and ','.join(chgd_rqd_qty[:-1]) +' and ' + cstr(chgd_rqd_qty[-1:][0]) ) or cstr(chgd_rqd_qty[0])))
+              
+
+  # Delete irrelevant raw material from PR Raw material details
+  #--------------------------------------------------------------  
+  def delete_irrelevant_raw_material(self):
+    for d in getlist(self.doclist,'pr_raw_material_details'):
+      if not sql("select name from `tabPurchase Receipt Detail` where name = '%s' and parent = '%s' and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
+        d.parent = 'old_par:'+self.doc.name
+        d.save()
+    
+  def calculate_amount(self, d):
+    amt = 0
+    for i in getlist(self.doclist,'pr_raw_material_details'):
+      
+      if(i.reference_name == d.name):
+        #if i.consumed_qty == 0:
+         # msgprint("consumed qty cannot be 0. Please Enter consumed qty ")
+          #raise Exception
+        i.amount = flt(i.consumed_qty)* flt(i.rate)
+        amt += i.amount
+    d.rm_supp_cost = amt
+    d.save()
+    
+
+  # --------------- Back Flush function called on submit and on cancel from update stock
+  def bk_flush_supp_wh(self, is_submit):
+    for d in getlist(self.doclist, 'pr_raw_material_details'):
+      #--------- -ve quantity is passed as raw material qty has to be decreased when PR is submitted and it has to be increased when PR is cancelled
+      consumed_qty = - flt(d.consumed_qty)
+      self.make_sl_entry(d, self.doc.supplier_warehouse, flt(consumed_qty), 0, is_submit)
+      
+
+  # get current_stock
+  # ----------------
+  def get_current_stock(self):
+    for d in getlist(self.doclist, 'pr_raw_material_details'):
+      if self.doc.supplier_warehouse:
+        bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.rm_item_code, self.doc.supplier_warehouse), as_dict = 1)
+        d.current_stock = bin and flt(bin[0]['actual_qty']) or 0
+        
+        
+        
+
+# OTHER CHARGES TRIGGER FUNCTIONS
+# ====================================================================================
+  
+  # *********** Get Tax rate if account type is TAX ********************
+  def get_rate(self,arg):
+    return get_obj('Purchase Common').get_rate(arg,self)
+
+  # **** Pull details from other charges master (Get Other Charges) ****
+  def get_purchase_tax_details(self):
+    return get_obj('Purchase Common').get_purchase_tax_details(self)
+
+  # Repair Purchase Order
+  # ===========================================
+  def repair_purchase_receipt(self):
+    get_obj('Purchase Common').repair_curr_doctype_details(self)
diff --git a/material_management/doctype/purchase_receipt/purchase_receipt.txt b/material_management/doctype/purchase_receipt/purchase_receipt.txt
new file mode 100644
index 0000000..7a7b430
--- /dev/null
+++ b/material_management/doctype/purchase_receipt/purchase_receipt.txt
@@ -0,0 +1,3123 @@
+[
+	{
+		'_last_update': '1305630198',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': 1,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 16:33:17',
+		'modified_by': 'Guest',
+		'module': 'Material Management',
+		'name': 'Purchase Receipt',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'status, transaction_date, supplier',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 318
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00423',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00424',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00425',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00426',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': '',
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00427',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00428',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': 'supplier',
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00429',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Supplier',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2010-08-09 09:09:18',
+		'modified_by': 'saumil@webnotestech.com',
+		'name': 'PERM00430',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter Basic Information about the Purchase Receipt',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05270',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05271',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': 'GRN',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02444',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': '\nGRN',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Supplier',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02446',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier',
+		'oldfieldtype': 'Link',
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Supplier Address',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02447',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02448',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL03797',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL05259',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL05260',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL05261',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL05262',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02450',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02451',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05272',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Transaction Date',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02453',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02445',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': '% of materials billed against this Purchase Receipt',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_billed',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': '% Billed',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02454',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'per_billed',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bill_no',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Bill No',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02455',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bill_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bill_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Bill Date',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02456',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bill_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'range',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Range',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02457',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'range',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Transporter Info',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05273',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transporter_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Transporter Name',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02449',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'transporter_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Transporter lorry number',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lr_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'LR No',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02460',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'lr_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Date on which lorry started from supplier warehouse',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lr_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'LR Date',
+		'modified': '2011-05-25 12:45:03',
+		'modified_by': 'Guest',
+		'name': 'FL02461',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'lr_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05274',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'challan_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Challan No',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02462',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'challan_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'challan_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Challan Date',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02463',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'challan_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05275',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'You can make a purchase receipt from multiple purchase orders. Select purchase orders one by one and click on the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_order_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Purchase Order',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02466',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'purchase_order_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Order',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Pull Purchase Order Details',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02467',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_po_details',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': "Supplier's currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Currency',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02458',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': '1.00',
+		'depends_on': None,
+		'description': "Rate at which supplier's currency is converted to your currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Conversion Rate',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02459',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05276',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select "Yes" for sub - contracting items',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_subcontracted',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Is Subcontracted',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02465',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_subcontracted',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Warehouse where you are maintaining stock of rejected items',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rejected_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Rejected Warehouse',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02469',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'rejected_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Supplier warehouse where you have issued raw materials for sub - contracting',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Supplier Warehouse',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02470',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'supplier_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05277',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Purchase Receipt Details',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02472',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_receipt_details',
+		'oldfieldtype': 'Table',
+		'options': 'Purchase Receipt Detail',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Net Total',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02473',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Re-Calculate Values',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02477',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'Add / Edit taxes and other charges',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05278',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'If you have created a standard template in Other Charges master, select one and click on the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_other_charges',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Purchase Other Charges',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02479',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_other_charges',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Other Charges',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Get Tax Detail',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02480',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_purchase_tax_details',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_tax_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Purchase Tax Details',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02481',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_tax_details',
+		'oldfieldtype': 'Table',
+		'options': 'Purchase Tax Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': 'Calculate Tax',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02482',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_tax',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Total Tax',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02483',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_tax',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Tax Calculation',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05279',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'Add Terms and Conditions for the Purchase Receipt. You can also prepare a master Term Sheet and use the Template.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL05280',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02486',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02487',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05281',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Terms1',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02489',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Filing in Additional Information about the Purchase Receipt will help you analyze your data better.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05282',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 54,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02493',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02494',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02491',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Time at which materials were received',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': 0,
+		'label': 'Posting Time',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02492',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:48:03',
+		'default': None,
+		'depends_on': None,
+		'description': 'Track this Purchase Receipt against any Project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 58,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL03798',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05283',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': 1,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'Other Details',
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05284',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': "<div class='columnHeading'>Other Details</div>",
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '30%'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02495',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'instructions',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': None,
+		'label': 'Instructions',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02496',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'instructions',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02499',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02500',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Detailed Breakup of the totals',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05285',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': 'Rounded Total',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02475',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rounded_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': None,
+		'label': 'Grand Total',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02474',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_added',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'Other Charges Added',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02502',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_added',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_deducted',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Other Charges Deducted',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02503',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_deducted',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Purchase Receipt.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02476',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05286',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': 'Net Total (Import)',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02504',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_total_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': None,
+		'label': 'Grand Total (Import)',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02507',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grand_total_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_added_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'Other Charges Added (Import)',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02505',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_added_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_deducted_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 75,
+		'in_filter': None,
+		'label': 'Other Charges Deducted (Import)',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02506',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'other_charges_deducted_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words (Import) will be visible once you save the Purchase Receipt.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_import',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 76,
+		'in_filter': None,
+		'label': 'In Words (Import)',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02508',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words_import',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Following table will show values if items are sub - contracted. These values will be fetched from the master of "Bill of Materials" of sub - contracted items.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 77,
+		'in_filter': None,
+		'label': 'Raw Material Details',
+		'modified': '2011-05-25 12:45:05',
+		'modified_by': 'Guest',
+		'name': 'FL05287',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 78,
+		'in_filter': None,
+		'label': 'Get Current Stock',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02510',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_current_stock',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pr_raw_material_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 79,
+		'in_filter': None,
+		'label': 'PR Raw Material Details',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02511',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'pr_raw_material_details',
+		'oldfieldtype': 'Table',
+		'options': 'PR Raw Material Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 80,
+		'in_filter': None,
+		'label': 'Repair Purchase Receipt',
+		'modified': '2011-05-25 12:45:04',
+		'modified_by': 'Guest',
+		'name': 'FL02515',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_purchase_receipt',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Receipt',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/purchase_receipt_detail/__init__.py b/material_management/doctype/purchase_receipt_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/purchase_receipt_detail/__init__.py
diff --git a/material_management/doctype/purchase_receipt_detail/purchase_receipt_detail.txt b/material_management/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
new file mode 100644
index 0000000..e97bed1
--- /dev/null
+++ b/material_management/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:20', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 58, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'GRND/.#######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Purchase Receipt Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:20', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Code', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01273', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-25 17:29:00', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01471', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Description', 'width': '250px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01274', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'received_qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Recd Quantity', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01278', 'idx': 4, 'default': '0.00', 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'received_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Accepted Quantity', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01279', 'idx': 5, 'default': '0.00', 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'rejected_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rejected Quantity', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL01280', 'idx': 6, 'default': '0.00', 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'rejected_qty', 'fieldtype': 'Currency', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'purchase_rate', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rate (Default Curr.)', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01281', 'idx': 7, 'default': '0.00', 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'purchase_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'UOM', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01282', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount (Default Curr.)', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01286', 'idx': 9, 'default': '0.00', 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'import_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 0, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rate', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01287', 'idx': 10, 'default': '0.00', 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'import_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-05-24 11:36:33', 'doctype': 'DocField', 'oldfieldname': 'import_amount', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05035', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'import_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'warehouse', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 0, 'modified_by': 'nabin@webnotestech.com', 'label': 'Accepted Warehouse', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01285', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2009-03-19 18:22:50', 'doctype': 'DocField', 'oldfieldname': 'rejected_warehouse', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rejected Warehouse', 'width': '100px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01451', 'idx': 13, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'rejected_warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-25 17:29:00', 'doctype': 'DocField', 'oldfieldname': 'brand', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Brand', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01470', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'brand', 'fieldtype': 'Link', 'options': 'Brand', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-12-17 12:07:33', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03523', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Date', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'schedule_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Schedule date', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01275', 'idx': 16, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'schedule_date', 'fieldtype': 'Date', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'serial_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Serial No', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01276', 'idx': 17, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'serial_no', 'fieldtype': 'Text', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-27 14:01:02', 'doctype': 'DocField', 'oldfieldname': 'batch_no', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Batch No', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04912', 'idx': 18, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'batch_no', 'fieldtype': 'Link', 'options': 'Batch', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Link', 'creation': '2009-04-09 13:51:06', 'doctype': 'DocField', 'oldfieldname': 'qa_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'QA No', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01742', 'idx': 19, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'qa_no', 'fieldtype': 'Link', 'options': 'QA Inspection Report', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'conversion_factor', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Conversion Factor', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01283', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'conversion_factor', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Stock UOM', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01284', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-30 11:00:58', 'doctype': 'DocField', 'oldfieldname': 'stock_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Stock Qty', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01553', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'stock_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-09-21 15:01:00', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_doctype', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Prevdoc Doctype', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03054', 'idx': 23, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'prevdoc_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:20', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': 0, 'modified_by': 'nabin@webnotestech.com', 'label': 'PO No', 'width': '150px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01272', 'idx': 24, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Link', 'options': 'Purchase Order', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-06-21 17:47:11', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_date', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'PO Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05393', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'prevdoc_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-09-12 19:10:05', 'doctype': 'DocField', 'oldfieldname': 'rm_supp_cost', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Raw Materials Supplied Cost', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 2, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02960', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'rm_supp_cost', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-02-01 14:25:59', 'doctype': 'DocField', 'oldfieldname': 'item_tax_amount', 'owner': 'wasim@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Tax Amount', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03908', 'idx': 27, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'item_tax_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_detail_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'PO Detail No', 'width': '150px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01288', 'idx': 28, 'default': None, 'colour': 'White:FFF', 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'prevdoc_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:21', 'doctype': 'DocField', 'oldfieldname': 'billed_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Billed Quantity', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01289', 'idx': 29, 'default': '0.00', 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'billed_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-04-08 15:48:00', 'doctype': 'DocField', 'oldfieldname': 'valuation_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Valuation Rate', 'width': '80px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01731', 'idx': 30, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'valuation_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-01-29 12:14:26', 'doctype': 'DocField', 'oldfieldname': 'item_tax_rate', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': 0, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Tax Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': 'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges', 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03894', 'idx': 31, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'item_tax_rate', 'fieldtype': 'Small Text', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-09-03 15:06:01', 'doctype': 'DocField', 'oldfieldname': 'page_break', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'nabin@webnotestech.com', 'label': 'Page Break', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Receipt Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL02915', 'idx': 32, 'default': None, 'colour': None, 'modified': '2010-06-21 17:47:42', 'parenttype': 'DocType', 'fieldname': 'page_break', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/ref_rate_detail/__init__.py b/material_management/doctype/ref_rate_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/ref_rate_detail/__init__.py
diff --git a/material_management/doctype/ref_rate_detail/ref_rate_detail.txt b/material_management/doctype/ref_rate_detail/ref_rate_detail.txt
new file mode 100644
index 0000000..06edea0
--- /dev/null
+++ b/material_management/doctype/ref_rate_detail/ref_rate_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-26 15:17:43', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'RFD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Ref Rate Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-26 15:17:43', 'doctype': 'DocField', 'oldfieldname': 'price_list_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Price List Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Ref Rate Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01475', 'idx': 1, 'default': '', 'colour': None, 'modified': '2010-03-31 10:16:36', 'parenttype': 'DocType', 'fieldname': 'price_list_name', 'fieldtype': 'Select', 'options': 'link:Price List', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-26 15:17:43', 'doctype': 'DocField', 'oldfieldname': 'ref_rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Ref Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Ref Rate Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01476', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:16:36', 'parenttype': 'DocType', 'fieldname': 'ref_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-04-16 12:40:05', 'doctype': 'DocField', 'oldfieldname': 'ref_currency', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Currency', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Ref Rate Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01916', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:16:36', 'parenttype': 'DocType', 'fieldname': 'ref_currency', 'fieldtype': 'Select', 'options': 'link:Currency', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/sales_and_purchase_return_wizard/__init__.py b/material_management/doctype/sales_and_purchase_return_wizard/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/sales_and_purchase_return_wizard/__init__.py
diff --git a/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.js b/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.js
new file mode 100644
index 0000000..ed071fa
--- /dev/null
+++ b/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.js
@@ -0,0 +1,176 @@
+// Onload
+//-------------------------------
+cur_frm.cscript.onload = function(doc,dt,dn){
+  if(!doc.return_date) set_multiple(dt,dn,{return_date:get_today()});
+  doc.delivery_note_no = '';
+  doc.purchase_receipt_no = '';
+  doc.sales_invoice_no = '';
+  doc.return_type ='';
+  refresh_many(['delivery_note_no', 'sales_invoice_no', 'purchase_receipt_no', 'return_type']);
+}
+
+// Link field query
+//--------------------------------
+cur_frm.fields_dict.delivery_note_no.get_query = function(doc) {
+  return 'SELECT DISTINCT `tabDelivery Note`.name FROM `tabDelivery Note` WHERE `tabDelivery Note`.docstatus = 1 AND `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.name desc LIMIT 50';
+}
+
+cur_frm.fields_dict.sales_invoice_no.get_query = function(doc) {
+  return 'SELECT DISTINCT `tabReceivable Voucher`.name FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.docstatus = 1 AND `tabReceivable Voucher`.%(key)s LIKE "%s" ORDER BY `tabReceivable Voucher`.name desc LIMIT 50';
+}
+
+cur_frm.fields_dict.purchase_receipt_no.get_query = function(doc) {
+  return 'SELECT DISTINCT `tabPurchase Receipt`.name FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.docstatus = 1 AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.name desc LIMIT 50';
+}
+
+// Hide/unhide based on return type
+//----------------------------------
+cur_frm.cscript.return_type = function(doc, cdt, cdn) {
+  hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no', 'return_details', 'Get Items', 'Make Excise Invoice', 'Make Stock Entry', 'Make Debit Note', 'Make Credit Note']);
+  if(doc.return_type == 'Sales Return')
+    unhide_field(['delivery_note_no', 'sales_invoice_no', 'Get Items', 'return_details', 'Make Credit Note', 'Make Stock Entry', 'Make Excise Invoice']);
+  else if(doc.return_type == 'Purchase Return')
+    unhide_field(['purchase_receipt_no', 'Get Items', 'return_details', 'Make Debit Note', 'Make Stock Entry', 'Make Excise Invoice']);
+
+  cur_frm.cscript.clear_fields(doc);
+}
+
+// Create item table
+//-------------------------------
+cur_frm.cscript['Get Items'] = function(doc, cdt, cdn) {
+  flag = 0
+  if(doc.return_type == 'Sales Return') {
+    if (doc.delivery_note_no && doc.sales_invoice_no) {
+      msgprint("You can not enter both Delivery Note No and Sales Invoice No. Please enter any one.");
+      flag = 1;
+    } else if (!doc.delivery_note_no && !doc.sales_invoice_no) {
+      msgprint("Please enter Delivery Note No or Sales Invoice No to proceed");
+      flag = 1;
+    }
+  } else if (doc.return_type == 'Purchase Return' && !doc.purchase_receipt_no) {
+    msgprint("Please enter Purchase Receipt No to proceed");
+    flag = 1;
+  }
+  if (!flag)
+    $c_obj(make_doclist(doc.doctype, doc.name),'pull_item_details','', function(r, rt) {
+      refresh_many(['return_details', 'cust_supp', 'cust_supp_name', 'cust_supp_address']);
+    });
+}
+
+// Clear fields
+//-------------------------------
+cur_frm.cscript.clear_fields = function(doc) {
+  doc.purchase_receipt_no, doc.delivery_note_no, doc.sales_invoice_no = '', '', '';
+  var cl = getchildren('Return Detail', doc.name, 'return_details')
+  if(cl.length) $c_obj(make_doclist(doc.doctype, doc.name),'clear_return_table','', function(r, rt) {refresh_field('return_details')});
+  refresh_many(['delivery_note_no', 'sales_invoice_no', 'purchase_receipt_no', 'return_details']);
+}
+
+// Make Stock Entry
+//-------------------------------
+cur_frm.cscript['Make Stock Entry'] = function(doc, cdt, cdn) {
+  var cl = getchildren('Return Detail', doc.name, 'return_details');
+  if (!cl.length)
+    msgprint("Item table can not be blank. Please click on 'Get Items'.");
+  else if (!cur_frm.cscript.validate_returned_qty(cl)) {
+    se = cur_frm.cscript.map_parent_fields(doc,cdt,cdn);
+    cur_frm.cscript.map_child_fields(cl, se);
+    loaddoc('Stock Entry', se.name);
+  }
+}
+
+// Validate returned qty
+//---------------------------
+cur_frm.cscript.validate_returned_qty = function(cl) {
+  flag = 0
+  for(var i = 0; i<cl.length; i++){
+    if(cl[i].returned_qty > cl[i].qty) {
+      msgprint("Returned Qty can not be greater than qty. Please check for item: " + cl[i].item_code);
+      flag = 1
+    }
+  }
+  return flag
+}
+
+
+// map parent fields of stock entry
+//----------------------------------
+cur_frm.cscript.map_parent_fields = function(doc, cdt, cdn) {
+  var se = LocalDB.create('Stock Entry');
+  se = locals['Stock Entry'][se];
+  se.posting_date = dateutil.obj_to_str(new Date());
+  se.transfer_date = dateutil.obj_to_str(new Date());
+  se.fiscal_year = sys_defaults.fiscal_year;
+  se.purpose = doc.return_type;
+  se.remarks = doc.return_type + ' of ' + (doc.delivery_note_no || doc.sales_invoice_no || doc.purchase_receipt_no);
+  if(doc.return_type == 'Sales Return'){
+    se.delivery_note_no = doc.delivery_note_no;
+    se.sales_invoice_no = doc.sales_invoice_no;
+    se.customer = doc.cust_supp_name;
+    se.customer_name = doc.cust_supp_name;
+    se.customer_address = doc.cust_supp_address;
+  }
+  else if(doc.return_type == 'Purchase Return'){
+    se.purchase_receipt_no = doc.purchase_receipt_no;
+    se.supplier = doc.cust_supp_name;
+    se.supplier_name = doc.cust_supp_name;
+    se.supplier_address = doc.cust_supp_address;
+  }
+  return se
+}
+
+// map child fields of stock entry
+//---------------------------------
+cur_frm.cscript.map_child_fields = function(cl, se) {
+  for(var i = 0; i<cl.length; i++){
+    if (cl[i].returned_qty) {
+      var d1 = LocalDB.add_child(se, 'Stock Entry Detail', 'mtn_details');
+      d1.detail_name = cl[i].detail_name;
+      d1.item_code = cl[i].item_code;
+      d1.description = cl[i].description;
+      d1.transfer_qty = cl[i].returned_qty;
+      d1.qty = cl[i].returned_qty;
+      d1.stock_uom = cl[i].uom;
+      d1.uom = cl[i].uom;
+      d1.conversion_factor = 1;
+      d1.incoming_rate = cl[i].rate;
+      d1.serial_no = cl[i].serial_no;
+      d1.batch_no = cl[i].batch_no;
+    }
+  }
+}
+
+// Make excise voucher
+//-------------------------------
+cur_frm.cscript['Make Excise Invoice'] = function(doc) {
+  var excise = LocalDB.create('Journal Voucher');
+  excise = locals['Journal Voucher'][excise];
+  excise.voucher_type = 'Excise Voucher';
+  loaddoc('Journal Voucher',excise.name);
+}
+// Make debit note
+//------------------------------
+cur_frm.cscript['Make Debit Note'] = function(doc) {
+  cur_frm.cscript.make_jv(doc, 'Debit Note');
+}
+// Make credit note
+//------------------------------
+cur_frm.cscript['Make Credit Note'] = function(doc) {
+  cur_frm.cscript.make_jv(doc, 'Credit Note');
+}
+
+// Make JV
+//--------------------------------
+cur_frm.cscript.make_jv = function(doc, dr_or_cr) {
+  var jv = LocalDB.create('Journal Voucher');
+  jv = locals['Journal Voucher'][jv];
+  
+  jv.voucher_type = dr_or_cr;
+  jv.company = sys_defaults.company;
+  jv.fiscal_year = sys_defaults.fiscal_year;
+  jv.is_opening = 'No';
+  jv.posting_date = dateutil.obj_to_str(new Date());
+  jv.voucher_date = dateutil.obj_to_str(new Date());
+
+  loaddoc('Journal Voucher',jv.name);
+}
diff --git a/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py b/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py
new file mode 100644
index 0000000..ca6761e
--- /dev/null
+++ b/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py
@@ -0,0 +1,61 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+class DocType :
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Pull Item Details
+  # ---------------------------
+  def pull_item_details(self):
+    if self.doc.return_type == 'Sales Return':
+      if self.doc.delivery_note_no:
+        det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.basic_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Detail` t1, `tabDelivery Note Detail` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no)
+      elif self.doc.sales_invoice_no:
+        det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.basic_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabRV Detail` t1, `tabReceivable Voucher` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no)
+    elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no:
+      det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Detail` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no)
+
+    self.doc.cust_supp = det and det[0][6] or ''
+    self.doc.cust_supp_name = det and det[0][7] or ''
+    self.doc.cust_supp_address = det and det[0][8] or ''
+    self.create_item_table(det)
+    self.doc.save()
+ 
+  # Create Item Table
+  # -----------------------------
+  def create_item_table(self, det):
+    self.doc.clear_table(self.doclist, 'return_details', 1)
+    for i in det:
+      ch = addchild(self.doc, 'return_details', 'Return Detail', 1, self.doclist)
+      ch.detail_name = i and i[0] or ''
+      ch.item_code = i and i[1] or ''
+      ch.description = i and i[2] or ''
+      ch.qty = i and flt(i[3]) or 0
+      ch.uom = i and i[4] or ''
+      ch.rate = i and flt(i[5]) or 0
+      ch.serial_no = i and i[9] or ''
+      ch.batch_no = (len(i) == 11) and i[10] or ''
+      ch.save()
+
+  # Clear return table
+  # --------------------------------
+  def clear_return_table(self):
+    self.doc.clear_table(self.doclist, 'return_details', 1)
+    self.doc.save()
diff --git a/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.txt b/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.txt
new file mode 100644
index 0000000..b6f426b
--- /dev/null
+++ b/material_management/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.txt
@@ -0,0 +1,1005 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': 0,
+		'issingle': 1,
+		'istable': 0,
+		'max_attachments': None,
+		'menu_index': 1,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Sales and Purchase Return Wizard',
+		'name_case': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': None,
+		'parent_node': 'Materials',
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 1,
+		'smallicon': None,
+		'use_template': None,
+		'version': 64
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00468',
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00469',
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00470',
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00471',
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00472',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00473',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00474',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00475',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 9,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00476',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 10,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00477',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 11,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00478',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 12,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00479',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 13,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00480',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 14,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00481',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 15,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00482',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 16,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00483',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Accounts User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 17,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00484',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 18,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00485',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 19,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00486',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 20,
+		'match': None,
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'PERM00487',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'return_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Return Date',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02979',
+		'no_copy': 1,
+		'oldfieldname': 'return_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'return_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Return Type',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02980',
+		'no_copy': 1,
+		'oldfieldname': 'return_type',
+		'oldfieldtype': 'Select',
+		'options': '\nSales Return\nPurchase Return',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Delivery Note No',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02981',
+		'no_copy': 1,
+		'oldfieldname': 'delivery_note_no',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-30 14:43:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_invoice_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Sales Invoice No',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04423',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Receivable Voucher',
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Purchase Receipt No',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02982',
+		'no_copy': 1,
+		'oldfieldname': 'purchase_receipt_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-25 13:45:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cust_supp',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Customer/Supplier',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04418',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-25 13:53:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cust_supp_name',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Cust/Supp Name',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04419',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-01-25 13:53:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cust_supp_address',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Cust/Supp Address',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04420',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02983',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'return_details',
+		'fieldtype': 'Table',
+		'hidden': 1,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Return Details',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02984',
+		'no_copy': 1,
+		'oldfieldname': 'return_details',
+		'oldfieldtype': 'Table',
+		'options': 'Return Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Make Stock Entry',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02985',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Make Excise Invoice',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02986',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Make Credit Note',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02987',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Make Debit Note',
+		'modified': '2011-02-23 19:09:18',
+		'modified_by': 'Administrator',
+		'name': 'FL02988',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Sales and Purchase Return Wizard',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/sales_bom/__init__.py b/material_management/doctype/sales_bom/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/sales_bom/__init__.py
diff --git a/material_management/doctype/sales_bom/sales_bom.js b/material_management/doctype/sales_bom/sales_bom.js
new file mode 100644
index 0000000..0581325
--- /dev/null
+++ b/material_management/doctype/sales_bom/sales_bom.js
@@ -0,0 +1,30 @@
+$import(Tips Common)
+
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn); 
+  if(!doc.price_list) set_multiple(cdt,cdn,{price_list:sys_defaults.price_list_name});
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+/* Get Item Code */
+cur_frm.cscript.item_code = function(doc, dt, dn) {
+  var d = locals[dt][dn];
+  if (d.item_code){
+    get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
+  }
+}
+
+cur_frm.cscript.price_list = function(doc, cdt, cdn) {
+  $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');});
+}
+
+cur_frm.cscript.currency = function(doc, cdt, cdn) {
+  $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');});
+}
+
+cur_frm.cscript['Find Sales BOM'] = function(doc, dt, dn) {
+  $c_obj(make_doclist(dt,dn), 'check_duplicate', 1, '');
+}
\ No newline at end of file
diff --git a/material_management/doctype/sales_bom/sales_bom.py b/material_management/doctype/sales_bom/sales_bom.py
new file mode 100644
index 0000000..3bd6fa5
--- /dev/null
+++ b/material_management/doctype/sales_bom/sales_bom.py
@@ -0,0 +1,205 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.new_item_code)
+
+  
+  # Get Ref Rates
+  # --------------
+  def get_rates(self):
+    for d in getlist(self.doclist, "sales_bom_items"):
+      r = sql("select ref_rate from `tabRef Rate Detail` where price_list_name=%s and parent=%s and ref_currency = %s", (self.doc.price_list, d.item_code, self.doc.currency))
+      d.rate = r and flt(r[0][0]) or 0.00
+
+
+  # Get Item Details
+  # -----------------
+  def get_item_details(self, name):
+    det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name))
+    rate = sql("select ref_rate from `tabRef Rate Detail` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
+    return cstr({'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00})
+
+
+  def get_main_item(self):
+    is_main_item = []
+    for d in getlist(self.doclist,'sales_bom_items'):
+      if d.is_main_item == 'Yes':
+        is_main_item.append(d.item_code)
+      # Check that Sales Bom Item cannot be child of Sales Bom.
+      if sql("select name from `tabSales BOM` where name = '%s' " % d.item_code):
+        msgprint("Sales Bom Item " + d.item_code +" cannot be child item.")
+        raise Exception
+      # Check if is_main_item is modified once saved
+      if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.name)[:-3] :
+        msgprint("Modifying the main item is not allowed.")
+        raise Exception
+    if len(is_main_item) > 1:
+      msgprint('Main item cannot be more than one.')
+      raise Exception , " Validation Error."
+    if len(is_main_item) == 0:
+      msgprint("At least one item should be main item.")
+      raise Exception , " Validation Error."
+    return is_main_item[0]
+
+
+  # Make Item
+  # ---------
+  def create_new_item(self):
+    i = Document("Item")
+    
+    i.item_code = self.doc.new_item_code
+    i.item_name = self.doc.new_item_name
+    i.name = i.item_code
+    i.is_sales_item = 'Yes'
+    i.is_stock_item = 'No'
+    i.save(1)
+
+# This function is deprecated as we will see only pricelist which is selected 
+#  def get_price_lists(self):
+#    return [i[0] for i in sql("select name from `tabPrice List` where docstatus != 2")]
+
+  # Update Rate
+  # -----------
+  
+  def update_ref_rate(self, i):
+    ref_rate,count, p, currency  =  0,0, self.doc.price_list, self.doc.currency
+    if not cstr(self.doc.price_list):
+      msgprint("Please enter Price List.")
+      raise Exception
+    if not cstr(self.doc.currency):
+      msgprint("Please enter Currency.")
+      raise Exception
+    for d in getlist(self.doclist, "sales_bom_items"):
+      item_rate = sql("select ref_rate,ref_currency from `tabRef Rate Detail` where price_list_name=%s and parent=%s", (p, d.item_code))      
+      if not item_rate:
+        msgprint("Item %s does not have a rate for Price List %s. Did not update rates for this Price List" % (d.item_code, p))
+        raise Exception
+      # if count == 0 : currency = cstr(item_rate[0][1])
+      if not cstr(currency) == cstr(item_rate[0][1]):
+        msgprint("Item %s currency %s does not match with other items currency i.e. %s " %(d.item_code,item_rate[0][1],currency))
+        raise Exception
+      count += 1
+      ref_rate += (flt(d.qty) * flt(item_rate[0][0]))
+      
+    pld = addchild(i,"ref_rate_details", "Ref Rate Detail")
+    pld.price_list_name = p
+    pld.ref_rate = flt(ref_rate)
+    pld.ref_currency = currency
+    pld.save()
+
+      
+  # Update Items
+  # ------------
+  def update_item(self):
+    i = Document("Item", self.doc.new_item_code)
+    
+    # update fields
+    i.brand = self.doc.new_item_brand
+    i.stock_uom = self.doc.stock_uom 
+    i.item_group = self.doc.item_group
+	
+    # clear old rates
+    sql("delete from `tabRef Rate Detail` where parent=%s", i.name)
+    
+    # update rates
+    new_rates = {}
+    # pl_list = self.get_price_lists()
+    #for p in self.get_price_lists():
+    self.update_ref_rate(i)
+
+    # update description and item name
+    n1, n2 = [], []
+    for d in getlist(self.doclist, "sales_bom_items"):
+      n, desc = sql("select item_name, description from tabItem where name=%s", d.item_code)[0]
+      n1.append(n)
+      n2.append(desc)
+    
+    self.doc.new_item_name = (' ').join(n1)
+    self.doc.description = ("\n" + "\n").join(n2)
+
+    i.item_name = self.doc.new_item_name
+    i.description = self.doc.description
+
+    # set default as 'No' or 0 in Item Master  as per TIC/3456
+    i.is_sample_item = 'No'
+    i.is_asset_item = 'No'
+    i.is_purchase_item = 'No'
+    i.is_manufactured_item = 'No'
+    i.is_sub_contracted_item = 'No'
+    i.is_service_item = 'No'
+    i.inspection_required = 'No'
+    i.has_serial_no = 'No'
+    i.lead_time_days = flt(0)
+    i.save()
+    msgprint("Items updated successfully.")
+
+
+  def validate(self):
+    # check for duplicate
+    self.check_duplicate()
+    item_code = self.get_main_item()
+    if not self.doc.new_item_code:
+      self.doc.new_item_code = make_autoname(item_code +'.###')
+
+ 
+  def on_update(self):
+    # if no item code, create new item code
+    if not sql("select name from tabItem where name=%s", self.doc.new_item_code):
+      self.create_new_item()
+    self.update_item()
+
+
+  def check_duplicate(self, finder=0):
+    il = getlist(self.doclist, "sales_bom_items")
+    if not il:
+      msgprint("Add atleast one item")
+      return
+    
+    # get all Sales BOM that have the first item  
+    sbl = sql("select distinct parent from `tabSales BOM Detail` where item_code=%s", il[0].item_code)
+    
+    # check all siblings
+    sub_items = [[d.item_code, flt(d.qty)] for d in il]
+    
+    for s in sbl:
+      if not cstr(s[0]) == cstr(self.doc.name) :
+        t = sql("select item_code, qty from `tabSales BOM Detail` where parent=%s", s[0])
+        t = [[d[0], flt(d[1])] for d in t]
+  
+        if self.has_same_items(sub_items, t):
+          msgprint("%s has the same Sales BOM details" % s[0])
+          raise Exception
+    if finder:
+      msgprint("There is no Sales BOM present with the following Combination.")
+
+
+  def has_same_items(self, l1, l2):
+    if len(l1)!=len(l2): return 0
+    for l in l2:
+      if l not in l1:
+        return 0
+    for l in l1:
+      if l not in l2:
+        return 0
+    return 1
\ No newline at end of file
diff --git a/material_management/doctype/sales_bom/sales_bom.txt b/material_management/doctype/sales_bom/sales_bom.txt
new file mode 100644
index 0000000..c7a31de
--- /dev/null
+++ b/material_management/doctype/sales_bom/sales_bom.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-28 10:22:45', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 40, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': 'Master', 'name': 'Sales BOM', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-11 14:28:31', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00888', 'parent': 'Sales BOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:50:52', 'modified': '2010-10-11 14:28:31', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00889', 'parent': 'Sales BOM', 'read': 1, 'create': 1, 'creation': '2010-04-26 16:50:52', 'modified': '2010-10-11 14:28:31', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00913', 'parent': 'Sales BOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:53:11', 'modified': '2010-10-11 14:28:31', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00914', 'parent': 'Sales BOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:53:11', 'modified': '2010-10-11 14:28:31', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00263', 'parent': 'Sales BOM', 'read': 1, 'create': 1, 'creation': '2009-03-28 10:22:45', 'modified': '2010-10-11 14:28:31', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00269', 'parent': 'Sales BOM', 'read': 1, 'create': 0, 'creation': '2009-04-02 10:51:59', 'modified': '2010-10-11 14:28:31', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 6, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04858', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-28 10:22:45', 'doctype': 'DocField', 'oldfieldname': 'new_item_code', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'New Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01490', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'new_item_code', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 14:12:17', 'doctype': 'DocField', 'oldfieldname': 'new_item_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'New Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01541', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'new_item_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 14:12:17', 'doctype': 'DocField', 'oldfieldname': 'new_item_brand', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'New Item Brand', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01540', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'new_item_brand', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-28 11:53:18', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'New Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01496', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-30 15:34:20', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01563', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-30 15:34:20', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01564', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-04-02 10:41:37', 'doctype': 'DocField', 'oldfieldname': 'price_list', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Price List', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01607', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'price_list', 'fieldtype': 'Select', 'options': 'link:Price List', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-05-18 16:57:53', 'doctype': 'DocField', 'oldfieldname': 'currency', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Currency', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02086', 'idx': 9, 'default': '', 'colour': 'White:FFF', 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'currency', 'fieldtype': 'Select', 'options': 'link:Currency', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-05-07 16:37:53', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Find Sales BOM', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04989', 'idx': 10, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-03-28 10:22:45', 'doctype': 'DocField', 'oldfieldname': 'sales_bom_items', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Sales BOM Items', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01488', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-10-11 14:28:31', 'parenttype': 'DocType', 'fieldname': 'sales_bom_items', 'fieldtype': 'Table', 'options': 'Sales BOM Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/sales_bom_detail/__init__.py b/material_management/doctype/sales_bom_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/sales_bom_detail/__init__.py
diff --git a/material_management/doctype/sales_bom_detail/sales_bom_detail.txt b/material_management/doctype/sales_bom_detail/sales_bom_detail.txt
new file mode 100644
index 0000000..fc88802
--- /dev/null
+++ b/material_management/doctype/sales_bom_detail/sales_bom_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-28 10:26:00', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Sales BOM Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-04-13 11:07:04', 'doctype': 'DocField', 'oldfieldname': 'is_main_item', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Is Main Item', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01783', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-13 14:11:40', 'parenttype': 'DocType', 'fieldname': 'is_main_item', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-28 10:26:00', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01491', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-13 14:11:40', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-28 10:26:00', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01492', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-13 14:11:40', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-09-18 17:28:03', 'doctype': 'DocField', 'oldfieldname': 'uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Sales BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03047', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-07-13 14:11:40', 'parenttype': 'DocType', 'fieldname': 'uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-28 10:26:00', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01493', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-07-13 14:11:40', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-04-02 10:40:17', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Sales BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01605', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-07-13 14:11:40', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/serial_no/__init__.py b/material_management/doctype/serial_no/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/serial_no/__init__.py
diff --git a/material_management/doctype/serial_no/serial_no.js b/material_management/doctype/serial_no/serial_no.js
new file mode 100644
index 0000000..32620dd
--- /dev/null
+++ b/material_management/doctype/serial_no/serial_no.js
@@ -0,0 +1,57 @@
+// ************************************** onload ****************************************************
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  if(!doc.status) set_multiple(cdt, cdn, {status:'In Store'});
+  if(doc.__islocal) hide_field(['supplier_name','address_display'])
+}
+
+
+// ************************************** refresh ***************************************************
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  if(!doc.__islocal && doc.warehouse) set_field_permlevel('warehouse', 1);
+  if(!doc.__islocal && doc.item_code) set_field_permlevel('item_code', 1);
+  if(doc.__islocal) set_field_permlevel('status', 0);
+}
+
+
+// ************************************** triggers **************************************************
+
+// -------------
+// item details
+// -------------
+cur_frm.add_fetch('item_code', 'item_name', 'item_name')
+cur_frm.add_fetch('item_code', 'item_group', 'item_group')
+cur_frm.add_fetch('item_code', 'brand', 'brand')
+cur_frm.add_fetch('item_code', 'description', 'description')
+cur_frm.add_fetch('item_code', 'warranty_period', 'warranty_period')
+
+
+// ---------
+// customer
+// ---------
+cur_frm.add_fetch('customer', 'customer_name', 'customer_name')
+cur_frm.add_fetch('customer', 'address', 'delivery_address')
+cur_frm.add_fetch('customer', 'territory', 'territory')
+
+
+// ---------
+// supplier
+// ---------
+//cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name')
+//cur_frm.add_fetch('customer', 'address', 'supplier_address')
+
+
+// ----------
+// territory
+// ----------
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+// Supplier
+cur_frm.cscript.supplier = function(doc,dt,dn) {
+  if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
+  if(doc.supplier) unhide_field(['supplier_name','address_display']);
+}
+
+
+
diff --git a/material_management/doctype/serial_no/serial_no.py b/material_management/doctype/serial_no/serial_no.py
new file mode 100644
index 0000000..9c99357
--- /dev/null
+++ b/material_management/doctype/serial_no/serial_no.py
@@ -0,0 +1,127 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cint, flt, cstr, getdate, nowdate
+import datetime
+
+sql = webnotes.conn.sql
+msgprint = webnotes.msgprint
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+
+# ********************************* validate warranty / amc status ***************************************
+
+	# --------------------
+	# validate amc status
+	# --------------------
+	def validate_amc_status(self):
+		if self.doc.amc_expiry_date and getdate(self.doc.amc_expiry_date) >= datetime.date.today() and self.doc.maintenance_status == 'Out of AMC':
+			msgprint("AMC expiry date and maintenance status mismatch. Please verify")
+			raise Exception
+		elif (not self.doc.amc_expiry_date or getdate(self.doc.amc_expiry_date) < datetime.date.today()) and self.doc.maintenance_status == 'Under AMC':
+			msgprint("AMC expiry date and maintenance status mismatch. Please verify")
+			raise Exception
+
+
+	# -------------------------
+	# validate warranty status
+	# -------------------------
+	def validate_warranty_status(self):
+		if self.doc.warranty_expiry_date and getdate(self.doc.warranty_expiry_date) >= datetime.date.today() and self.doc.maintenance_status == 'Out of Warranty':
+			msgprint("Warranty expiry date and maintenance status mismatch. Please verify")
+			raise Exception
+		elif (not self.doc.warranty_expiry_date or getdate(self.doc.warranty_expiry_date) < datetime.date.today()) and self.doc.maintenance_status == 'Under Warranty':
+			msgprint("Warranty expiry date and maintenance status mismatch. Please verify")
+			raise Exception
+
+
+	# -------------------------------
+	# validate warranty / amc status
+	# -------------------------------
+	def validate_warranty_amc_status(self):
+		self.validate_warranty_status()
+		self.validate_amc_status()
+
+
+	def validate_warehouse(self):
+		if self.doc.status=='In Store' and not self.doc.warehouse:
+			msgprint("Warehouse is mandatory if this Serial No is <b>In Store</b>", raise_exception=1)
+
+	def validate_item(self):
+		item = sql("select name, has_serial_no from tabItem where name = '%s'" % self.doc.item_code)
+		if not item:
+			msgprint("Item is not exists in the system", raise_exception=1)
+		elif item[0][1] == 'No':
+			msgprint("To proceed please select 'Yes' in 'Has Serial No' in Item master: '%s'" % self.doc.item_code, raise_exception=1)
+			
+
+	# ---------
+	# validate
+	# ---------
+	def validate(self):
+		self.validate_warranty_amc_status()
+		self.validate_warehouse()
+		self.validate_item()
+
+
+	# ------------------------
+	# make stock ledger entry
+	# ------------------------
+	def make_stock_ledger_entry(self, update_stock):
+		from webnotes.model.code import get_obj
+		values = [{
+			'item_code'				: self.doc.item_code,
+			'warehouse'				: self.doc.warehouse,
+			'transaction_date'		: nowdate(),
+			'posting_date'			: self.doc.purchase_date or (self.doc.creation and self.doc.creation.split(' ')[0]) or nowdate(),
+			'posting_time'			: self.doc.purchase_time or '00:00',
+			'voucher_type'			: 'Serial No',
+			'voucher_no'			: self.doc.name,
+			'voucher_detail_no'	 	: '', 
+			'actual_qty'			: 1, 
+			'stock_uom'				: webnotes.conn.get_value('Item', self.doc.item_code, 'stock_uom'),
+			'incoming_rate'			: self.doc.purchase_rate,
+			'company'				: self.doc.company,
+			'fiscal_year'			: self.doc.fiscal_year,
+			'is_cancelled'			: update_stock and 'No' or 'Yes',
+			'batch_no'				: '',
+			'serial_no'				: self.doc.name
+		}]
+		get_obj('Stock Ledger', 'Stock Ledger').update_stock(values)
+
+
+	# ----------
+	# on update
+	# ----------
+	def on_update(self):
+		if self.doc.warehouse and not sql("select name from `tabStock Ledger Entry` where serial_no = '%s'" % (self.doc.name)) and self.doc.status == 'In Store':
+			self.make_stock_ledger_entry(update_stock = 1)
+
+
+	# ---------
+	# on trash
+	# ---------
+	def on_trash(self):
+		if self.doc.status == 'Delivered':
+			msgprint("Cannot trash Serial No : %s as it is already Delivered" % (self.doc.name), raise_exception = 1)
+		else:
+			webnotes.conn.set(self.doc, 'status', 'Not in Use')
+			self.make_stock_ledger_entry(update_stock = 0)
+
+
+	def on_cancel(self):
+		self.on_trash()
+
+	# -----------
+	# on restore
+	# -----------
+	def on_restore(self):
+		self.make_stock_ledger_entry(update_stock = 1)
diff --git a/material_management/doctype/serial_no/serial_no.txt b/material_management/doctype/serial_no/serial_no.txt
new file mode 100644
index 0000000..53e8f19
--- /dev/null
+++ b/material_management/doctype/serial_no/serial_no.txt
@@ -0,0 +1,1935 @@
+[
+	{
+		'_last_update': '1305616095',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:serial_no',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:23',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 12:38:15',
+		'modified_by': 'Guest',
+		'module': 'Material Management',
+		'name': 'Serial No',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'item_code,status',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(item_code)s',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 188
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00518',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00519',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00520',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00521',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00522',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00523',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Master Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00524',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:23',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2010-08-08 17:09:23',
+		'modified_by': 'Administrator',
+		'name': 'PERM00525',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Details',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05450',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05451',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': 'In Store',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03193',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nIn Store\nDelivered\nNot in Use',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 0,
+		'label': 'Serial No',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03181',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'serial_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03182',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05452',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Item Name',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002038',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Description',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03185',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 0,
+		'label': 'Item Group',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03183',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 0,
+		'label': 'Brand',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03184',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Link',
+		'options': 'Brand',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Purchase Details',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05453',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05454',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_document_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Purchase Document Type',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002040',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nPurchase Receipt\nStock Entry',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_document_no',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Purchase Document No',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002041',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Purchase Date',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03187',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'purchase_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Incoming Time',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002042',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 0,
+		'label': 'Incoming Rate',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03188',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'purchase_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05455',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': 1,
+		'label': 'Warehouse',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03195',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 1,
+		'label': 'Supplier',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002043',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Supplier Name',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002044',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Supplier Address',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05445',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Delivery Details',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05456',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05457',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_document_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'Delivery Document Type',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002047',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nDelivery Note\nReceivable Voucher\nStock Entry',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_document_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Delivery Document No',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002048',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03201',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_address',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Delivery Date',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03199',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'delivery_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Delivery Time',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002049',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_cancelled',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Is Cancelled',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03203',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_cancelled',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05458',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03799',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': 1,
+		'label': 'Customer Name',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03200',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_address',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Delivery Address',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002050',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03202',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Warranty / AMC Details',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05459',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05460',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'maintenance_status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': 1,
+		'label': 'Maintenance Status',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03194',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'maintenance_status',
+		'oldfieldtype': 'Select',
+		'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warranty_period',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Warranty Period (Days)',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03189',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'warranty_period',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05461',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warranty_expiry_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': 1,
+		'label': 'Warranty Expiry Date',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03190',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'warranty_expiry_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amc_expiry_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': 1,
+		'label': 'AMC Expiry Date',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03191',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'amc_expiry_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL05462',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-25 15:45:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no_details',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Serial No Details',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002053',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-26 17:02:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002814',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Company',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-26 17:02:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': '000002815',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-25 12:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL03207',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Serial No',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/stock_entry/__init__.py b/material_management/doctype/stock_entry/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/stock_entry/__init__.py
diff --git a/material_management/doctype/stock_entry/stock_entry.js b/material_management/doctype/stock_entry/stock_entry.js
new file mode 100644
index 0000000..f202235
--- /dev/null
+++ b/material_management/doctype/stock_entry/stock_entry.js
@@ -0,0 +1,191 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
+  if (!doc.transfer_date) doc.transfer_date = dateutil.obj_to_str(new Date());
+  cfn_set_fields(doc, cdt, cdn);
+}
+
+
+var cfn_set_fields = function(doc, cdt, cdn) {
+  lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address']; 
+  if (doc.purpose == 'Production Order'){
+    unhide_field(['production_order', 'process', 'Get Items']);
+    hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML']);
+    doc.from_warehouse = '';
+    doc.to_warehosue = '';
+    if (doc.process == 'Backflush'){
+      unhide_field('fg_completed_qty');
+    }
+    else{
+      hide_field('fg_completed_qty');
+      doc.fg_completed_qty = 0;
+    }
+  }
+  else{
+    unhide_field(['from_warehouse', 'to_warehouse']);
+    hide_field(['production_order', 'process', 'Get Items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
+    hide_field(lst);
+    doc.production_order = '';
+    doc.process = '';
+    doc.fg_completed_qty = 0;
+  }
+  
+ 
+  if(doc.purpose == 'Purchase Return'){
+    doc.customer=doc.customer_name = doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no='';
+    hide_field(lst);
+    unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']);
+  }
+  if(doc.purpose == 'Sales Return'){
+    doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
+    hide_field(lst);
+    unhide_field(['customer','customer_name','customer_address','delivery_note_no', 'sales_invoice_no']);
+  } else{
+    doc.customer=doc.customer_name=doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no=doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
+  }
+  refresh_many(lst);
+}
+
+cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
+  if(doc.delivery_note_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript.sales_invoice_no = function(doc,cdt,cdn){
+  if(doc.sales_invoice_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript.customer = function(doc,cdt,cdn){
+  if(doc.customer)  get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript.purchase_receipt_no = function(doc,cdt,cdn){
+  if(doc.purchase_receipt_no)  get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript.supplier = function(doc,cdt,cdn){
+  if(doc.supplier)  get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
+
+}
+
+cur_frm.fields_dict['production_order'].get_query = function(doc) {
+   return 'SELECT DISTINCT `tabProduction Order`.`name` FROM `tabProduction Order` WHERE `tabProduction Order`.`docstatus` = 1 AND `tabProduction Order`.`qty` > ifnull(`tabProduction Order`.`produced_qty`,0) AND `tabProduction Order`.`name` like "%s" ORDER BY `tabProduction Order`.`name` DESC LIMIT 50';
+}
+
+cur_frm.cscript.purpose = function(doc, cdt, cdn) {
+  cfn_set_fields(doc, cdt, cdn);
+}
+
+
+cur_frm.cscript.process = function(doc, cdt, cdn) {
+  cfn_set_fields(doc, cdt, cdn);
+}
+
+//
+// item code - only if quantity present in source warehosue
+//
+var fld = cur_frm.fields_dict['mtn_details'].grid.get_field('item_code');
+fld.query_description = "If Source Warehouse is selected, only items present in the warehouse with actual qty > 0 will be selected"
+fld.get_query = function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+		
+	if(d.s_warehouse) {
+		return 'SELECT tabItem.name, tabItem.description, tabBin.actual_qty '
+		+'FROM tabItem, tabBin '
+		+'WHERE tabItem.name = tabBin.item_code '
+		+'AND ifnull(`tabBin`.`actual_qty`,0) > 0 '
+		+'AND tabBin.warehouse="'+ d.s_warehouse +'" '
+		+'AND tabItem.docstatus < 2 '
+		+'AND tabItem.%(key)s LIKE "%s" '
+		+'ORDER BY tabItem.name ASC '
+		+'LIMIT 50'
+	} else {
+		return 'SELECT tabItem.name, tabItem.description '
+		+'FROM tabItem '
+		+'WHERE tabItem.docstatus < 2 '
+		+'AND tabItem.%(key)s LIKE "%s" '
+		+'ORDER BY tabItem.name ASC '
+		+'LIMIT 50'
+	}
+}
+
+//
+// copy over source and target warehouses
+//
+cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
+	var d = locals[cdt][cdn];
+	if(!d.s_warehouse && doc.from_warehouse) {
+		d.s_warehouse = doc.from_warehouse
+		refresh_field('s_warehouse', cdn, 'mtn_details')
+	}
+	if(!d.t_warehouse && doc.to_warehouse) {
+		d.t_warehouse = doc.to_warehouse
+		refresh_field('t_warehouse', cdn, 'mtn_details')
+	}
+}
+
+//========================= Overloaded query for link batch_no =============================================================
+cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.item_code){
+    return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50"
+  }
+  else{
+    alert("Please enter Item Code.");
+  }
+}
+
+//==================================================================================================================
+
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  cal_back = function(r, rt){ /*cur_frm.cscript.calc_amount(doc)*/}
+  // get values
+  args = {
+  	item_code: d.item_code,
+  	warehouse: cstr(d.s_warehouse)
+  };
+  get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1,cal_back);
+}
+
+//==================================================================================================================
+
+cur_frm.cscript.transfer_qty = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (doc.from_warehouse && (flt(d.transfer_qty) > flt(d.actual_qty))) {
+    alert("Transfer Quantity is more than Available Qty");
+  }
+}
+
+
+//==================================================================================================================
+
+cur_frm.cscript.qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  set_multiple('Stock Entry Detail', d.name, {'transfer_qty': flt(d.qty) * flt(d.conversion_factor)}, 'mtn_details');
+  refresh_field('mtn_details');
+}
+
+//==================================================================================================================
+
+cur_frm.cscript.uom = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.uom && d.item_code){
+    var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
+    get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
+  }
+}
+
+//==================================================================================================================
+//validate
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+  cur_frm.cscript.validate_items(doc);
+}
+
+//==================================================================================================================
+//validate items
+cur_frm.cscript.validate_items = function(doc) {
+  cl =  getchildren('Stock Entry Detail',doc.name,'mtn_details');
+  if (!cl.length) {
+    alert("Item table can not be blank");
+    validated = false;
+  }
+}
diff --git a/material_management/doctype/stock_entry/stock_entry.py b/material_management/doctype/stock_entry/stock_entry.py
new file mode 100644
index 0000000..55cd1f0
--- /dev/null
+++ b/material_management/doctype/stock_entry/stock_entry.py
@@ -0,0 +1,416 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists, delete_doc
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+		self.item_dict = {}
+		self.fname = 'mtn_details' 
+
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+  
+	# get item details
+	# ----------------
+	def get_item_details(self, arg):
+		arg, bin, in_rate = eval(arg), None, 0
+		item = sql("select stock_uom, description, item_name from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' or end_of_life >	now())", (arg['item_code']), as_dict = 1)
+		if not item:
+			if arg['item_code']: 
+				msgprint("Item is not active. You can restore it from Trash")
+			raise webnotes.ValidationError
+			
+		if arg['warehouse']:
+			bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict = 1)
+			in_rate = get_obj('Valuation Control').get_incoming_rate(self.doc.posting_date, self.doc.posting_time, arg['item_code'],arg['warehouse'])
+		ret = {
+			'uom'			      	: item and item[0]['stock_uom'] or '',
+			'stock_uom'			  	: item and item[0]['stock_uom'] or '',
+			'description'		  	: item and item[0]['description'] or '',
+			'item_name' 		  	: item and item[0]['item_name'] or '',
+			'actual_qty'		  	: bin and flt(bin[0]['actual_qty']) or 0,
+			'qty'					: 0,
+			'transfer_qty'			: 0,
+			'incoming_rate'	  		: flt(in_rate),
+			'conversion_factor'		: 1,
+     		'batch_no'          	: ''
+		}
+		return str(ret)
+
+
+	# Get UOM Details
+	def get_uom_details(self, arg = ''):
+		arg, ret = eval(arg), {}
+		uom = sql("select conversion_factor from `tabUOM Conversion Detail` where parent = %s and uom = %s", (arg['item_code'],arg['uom']), as_dict = 1)
+		if not uom:
+			msgprint("There is no Conversion Factor for UOM '%s' in Item '%s'" % (arg['uom'], arg['item_code']))
+			ret = {'uom' : ''}
+		else:
+			ret = {
+				'conversion_factor'		: flt(uom[0]['conversion_factor']),
+				'transfer_qty'			: flt(arg['qty']) * flt(uom[0]['conversion_factor']),
+			}
+		return str(ret)
+
+		
+	# get rate of FG item 
+	#---------------------------
+	def get_in_rate(self, pro_obj):
+		# calculate_cost for production item
+		get_obj('BOM Control').calculate_cost(pro_obj.doc.bom_no)
+		# return cost
+		return flt(get_obj('Bill Of Materials', pro_obj.doc.bom_no).doc.cost_as_per_mar)
+
+	# get current_stock
+	# ----------------
+	def get_current_stock(self, pro_obj = ''):
+		for d in getlist(self.doclist, 'mtn_details'):
+			d.s_warehouse = (self.doc.purpose != 'Production Order') and	self.doc.from_warehouse or cstr(d.s_warehouse)
+			d.t_warehouse = (self.doc.purpose != 'Production Order') and	self.doc.to_warehouse or cstr(d.t_warehouse)
+			
+			if d.s_warehouse:
+				bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.s_warehouse), as_dict = 1)
+				d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
+			else: 
+				d.actual_qty = 0
+			if d.fg_item:
+				d.incoming_rate = pro_obj and self.get_in_rate(pro_obj) or ''
+			elif self.doc.purpose not in ['Material Receipt', 'Sales Return'] and not d.incoming_rate and d.s_warehouse:
+				d.incoming_rate = flt(get_obj('Valuation Control').get_incoming_rate(self.doc.posting_date, self.doc.posting_time, d.item_code, d.s_warehouse, d.transfer_qty, d.serial_no))
+			d.save()
+
+
+	# makes dict of unique items with it's qty
+	#-----------------------------------------
+	def make_items_dict(self, items_list):
+		# items_list = [[item_name, qty]]
+		for i in items_list:
+			if self.item_dict.has_key(i[0]):
+				self.item_dict[i[0]][0] = flt(self.item_dict[i[0]][0]) + flt(i[1])
+			else:
+				self.item_dict[i[0]] = [flt(i[1]), cstr(i[2]), cstr(i[3])]
+				
+	def get_raw_materials(self,pro_obj):
+		# get all items from flat bom except, child items of sub-contracted and sub assembly items and sub assembly items itself.
+		flat_bom_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s', description, stock_uom	from `tabFlat BOM Detail` where parent = '%s' and parent_bom = '%s' and is_pro_applicable = 'No' and docstatus < 2 group by item_code" % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no), cstr(pro_obj.doc.bom_no)))
+		self.make_items_dict(flat_bom_items)
+		if pro_obj.doc.consider_sa_items == 'Yes':
+			# get all Sub Assembly items only from flat bom
+			fl_bom_sa_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s', description, stock_uom from `tabFlat BOM Detail` where parent = '%s' and parent_bom != '%s' and is_pro_applicable = 'Yes' and docstatus < 2 group by item_code" % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no), cstr(pro_obj.doc.bom_no)))
+			self.make_items_dict(fl_bom_sa_items)
+		
+		if pro_obj.doc.consider_sa_items == 'No':
+			# get all sub assembly childs only from flat bom
+			fl_bom_sa_child_item = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s', description, stock_uom from `tabFlat BOM Detail` where parent = '%s' and parent_bom in (select distinct parent_bom from `tabFlat BOM Detail` where parent = '%s' and parent_bom != '%s' and is_pro_applicable = 'Yes' and docstatus < 2 ) and is_pro_applicable = 'No' and docstatus < 2 group by item_code" % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no), cstr(pro_obj.doc.bom_no), cstr(pro_obj.doc.bom_no)))
+			self.make_items_dict(fl_bom_sa_child_item)
+
+	def add_to_stock_entry_detail(self, pro_obj, item_dict, fg_item = 0):
+		sw, tw = '', ''
+		if self.doc.process == 'Material Transfer':
+			tw = cstr(pro_obj.doc.wip_warehouse)
+		if self.doc.process == 'Backflush':
+			tw = fg_item and cstr(pro_obj.doc.fg_warehouse) or ''
+			if not fg_item: sw = cstr(pro_obj.doc.wip_warehouse)
+		for d in item_dict:
+			se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail', 0, self.doclist)
+			se_child.s_warehouse = sw
+			se_child.t_warehouse = tw
+			se_child.fg_item	= fg_item
+			se_child.item_code = cstr(d)
+			se_child.description = item_dict[d][1]
+			se_child.uom = item_dict[d][2]
+			se_child.stock_uom = item_dict[d][2]
+			se_child.reqd_qty = flt(item_dict[d][0])
+			se_child.qty = flt(item_dict[d][0])
+			se_child.transfer_qty = flt(item_dict[d][0])
+			se_child.conversion_factor = 1.00
+
+	
+	# get items 
+	#------------------
+	def get_items(self):
+		pro_obj = self.doc.production_order and get_obj('Production Order', self.doc.production_order) or ''
+		
+		self.validate_for_production_order(pro_obj)
+		self.get_raw_materials(pro_obj)
+		
+		self.doc.clear_table(self.doclist, 'mtn_details', 1)
+		
+		self.add_to_stock_entry_detail(pro_obj, self.item_dict)
+		if self.doc.process == 'Backflush':
+			item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]}
+			self.add_to_stock_entry_detail(pro_obj, item_dict, fg_item = 1)
+
+	def validate_transfer_qty(self):
+		for d in getlist(self.doclist, 'mtn_details'):
+			if flt(d.transfer_qty) <= 0:
+				msgprint("Transfer Quantity can not be less than or equal to zero at Row No " + cstr(d.idx))
+				raise Exception
+			if d.s_warehouse:
+				if flt(d.transfer_qty) > flt(d.actual_qty):
+					msgprint("Transfer Quantity is more than Available Qty at Row No " + cstr(d.idx))
+					raise Exception
+	
+	def calc_amount(self):
+		total_amount = 0
+		for d in getlist(self.doclist, 'mtn_details'):
+			d.amount = flt(d.transfer_qty) * flt(d.incoming_rate)
+			total_amount += flt(d.amount)
+		self.doc.total_amount = flt(total_amount)
+
+	def add_to_values(self, d, wh, qty, is_cancelled):
+		self.values.append({
+				'item_code'			    : d.item_code,
+				'warehouse'			    : wh,
+				'transaction_date'	: self.doc.transfer_date,
+				'posting_date'		  : self.doc.posting_date,
+				'posting_time'		  : self.doc.posting_time,
+				'voucher_type'		  : 'Stock Entry',
+				'voucher_no'		    : self.doc.name, 
+				'voucher_detail_no'	: d.name,
+				'actual_qty'		    : qty,
+				'incoming_rate'		  : flt(d.incoming_rate) or 0,
+				'stock_uom'			    : d.stock_uom,
+				'company'			      : self.doc.company,
+				'fiscal_year'		    : self.doc.fiscal_year,
+				'is_cancelled'		  : (is_cancelled ==1) and 'Yes' or 'No',
+				'batch_no'			    : d.batch_no,
+        'serial_no'         : d.serial_no
+		})
+
+	
+	def update_stock_ledger(self, is_cancelled=0):
+		self.values = []			
+		for d in getlist(self.doclist, 'mtn_details'):
+			if cstr(d.s_warehouse):
+				self.add_to_values(d, cstr(d.s_warehouse), -flt(d.transfer_qty), is_cancelled)
+			if cstr(d.t_warehouse):
+				self.add_to_values(d, cstr(d.t_warehouse), flt(d.transfer_qty), is_cancelled)
+		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
+
+	
+	def validate_for_production_order(self, pro_obj):
+		if self.doc.purpose == 'Production Order' or self.doc.process or self.doc.production_order or flt(self.doc.fg_completed_qty):
+			if self.doc.purpose != 'Production Order':
+				msgprint("Purpose should be 'Production Order'.")
+				raise Exception
+			if not self.doc.process:
+				msgprint("Process Field is mandatory.")
+				raise Exception
+			if self.doc.process == 'Backflush' and not flt(self.doc.fg_completed_qty):
+				msgprint("FG Completed Qty is mandatory as the process selected is 'Backflush'")
+				raise Exception
+			if self.doc.process == 'Material Transfer' and flt(self.doc.fg_completed_qty):
+				msgprint("FG Completed Qty should be zero. As the Process selected is 'Material Transfer'.")
+				raise Exception
+			if not self.doc.production_order:
+				msgprint("Production Order field is mandatory")
+				raise Exception
+			if flt(pro_obj.doc.qty) < flt(pro_obj.doc.produced_qty) + flt(self.doc.fg_completed_qty) :
+				msgprint("error:Already Produced Qty for %s is %s and maximum allowed Qty is %s" % (pro_obj.doc.production_item, cstr(pro_obj.doc.produced_qty) or 0.00 , cstr(pro_obj.doc.qty)))
+				raise Exception
+	
+	# Validate
+	# ------------------
+	def validate(self):
+		sl_obj = get_obj("Stock Ledger", "Stock Ledger")
+		sl_obj.scrub_serial_nos(self)
+		sl_obj.validate_serial_no(self, 'mtn_details')
+		pro_obj = ''
+		if self.doc.production_order:
+			pro_obj = get_obj('Production Order', self.doc.production_order)
+		self.validate_for_production_order(pro_obj)
+		self.validate_incoming_rate()
+		self.validate_warehouse(pro_obj)
+		self.get_current_stock(pro_obj)
+		self.calc_amount()
+		get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+				
+	# If target warehouse exists, incoming rate is mandatory
+	# --------------------------------------------------------
+	def validate_incoming_rate(self):
+		for d in getlist(self.doclist, 'mtn_details'):
+			if not flt(d.incoming_rate) and d.t_warehouse:
+				msgprint("Rate is mandatory for Item: %s at row %s" % (d.item_code, d.idx), raise_exception=1)
+
+	# Validate warehouse
+	# -----------------------------------
+	def validate_warehouse(self, pro_obj):
+		fg_qty = 0
+		for d in getlist(self.doclist, 'mtn_details'):
+			if not d.s_warehouse and not d.t_warehouse:
+				d.s_warehouse = self.doc.from_warehouse
+				d.t_warehouse = self.doc.to_warehouse
+
+			if not (d.s_warehouse or d.t_warehouse):
+				msgprint("Atleast one warehouse is mandatory for Stock Entry ")
+				raise Exception
+			if d.s_warehouse and not sql("select name from tabWarehouse where name = '%s'" % d.s_warehouse):
+				msgprint("Invalid Warehouse: %s" % self.doc.s_warehouse)
+				raise Exception
+			if d.t_warehouse and not sql("select name from tabWarehouse where name = '%s'" % d.t_warehouse):
+				msgprint("Invalid Warehouse: %s" % self.doc.t_warehouse)
+				raise Exception
+			if d.s_warehouse == d.t_warehouse:
+				msgprint("Source and Target Warehouse Cannot be Same.")
+				raise Exception
+			if self.doc.purpose == 'Material Issue':
+				if not cstr(d.s_warehouse):
+					msgprint("Source Warehouse is Mandatory for Purpose => 'Material Issue'")
+					raise Exception
+				if cstr(d.t_warehouse):
+					msgprint("Target Warehouse is not Required for Purpose => 'Material Issue'")
+					raise Exception
+			if self.doc.purpose == 'Material Transfer':
+				if not cstr(d.s_warehouse) or not cstr(d.t_warehouse):
+					msgprint("Source Warehouse and Target Warehouse both are Mandatory for Purpose => 'Material Transfer'")
+					raise Exception
+			if self.doc.purpose == 'Material Receipt':
+				if not cstr(d.t_warehouse):
+					msgprint("Target Warehouse is Mandatory for Purpose => 'Material Receipt'")
+					raise Exception
+				if cstr(d.s_warehouse):
+					msgprint("Source Warehouse is not Required for Purpose => 'Material Receipt'")
+					raise Exception
+			if self.doc.process == 'Material Transfer':
+				if cstr(d.t_warehouse) != (pro_obj.doc.wip_warehouse):
+					msgprint(" Target Warehouse should be same as WIP Warehouse %s in Production Order %s at Row No %s" % (cstr(pro_obj.doc.wip_warehouse), cstr(pro_obj.doc.name), cstr(d.idx)) )
+					raise Exception
+				if not cstr(d.s_warehouse):
+					msgprint("Please Enter Source Warehouse at Row No %s is mandatory." % (cstr(d.idx)))
+					raise Exception
+			if self.doc.process == 'Backflush':
+				if flt(d.fg_item):
+					if cstr(pro_obj.doc.production_item) != cstr(d.item_code):
+						msgprint("Item %s in Stock Entry Detail as Row No %s do not match with Item %s in Production Order %s" % (cstr(d.item_code), cstr(d.idx), cstr(pro_obj.doc.production_item), cstr(pro_obj.doc.name)))
+						raise Exception
+					fg_qty = flt(fg_qty) + flt(d.transfer_qty)
+					if cstr(d.t_warehouse) != cstr(pro_obj.doc.fg_warehouse):
+						msgprint("As Item %s is FG Item. Target Warehouse should be same as FG Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.fg_warehouse), cstr(pro_obj.doc.name), cstr(d.idx)))
+						raise Exception
+					if cstr(d.s_warehouse):
+						msgprint("As Item %s is a FG Item. There should be no Source Warehouse at Row No %s" % (cstr(d.item_code), cstr(d.idx)))
+						raise Exception
+				if not flt(d.fg_item):
+					if cstr(d.t_warehouse):
+						msgprint("As Item %s is not a FG Item. There should no Tareget Warehouse at Row No %s" % (cstr(d.item_code), cstr(d.idx)))
+						raise Exception
+					if cstr(d.s_warehouse) != cstr(pro_obj.doc.wip_warehouse):
+						msgprint("As Item %s is Raw Material. Source Warehouse should be same as WIP Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.wip_warehouse), cstr(pro_obj.doc.name), cstr(d.idx)))
+						raise Exception
+			d.save()
+		if self.doc.fg_completed_qty and flt(self.doc.fg_completed_qty) != flt(fg_qty):
+			msgprint("The Total of FG Qty %s in Stock Entry Detail do not match with FG Completed Qty %s" % (flt(fg_qty), flt(self.doc.fg_completed_qty)))
+			raise Exception
+
+	def update_production_order(self, is_submit):
+		if self.doc.production_order:
+			pro_obj = get_obj("Production Order", self.doc.production_order)
+			if flt(pro_obj.doc.docstatus) != 1:
+				msgprint("One cannot do any transaction against Production Order : %s, as it's not submitted" % (pro_obj.doc.name))
+				raise Exception
+			if pro_obj.doc.status == 'Stopped':
+				msgprint("One cannot do any transaction against Production Order : %s, as it's status is 'Stopped'" % (pro_obj.doc.name))
+				raise Exception
+			if getdate(pro_obj.doc.posting_date) > getdate(self.doc.posting_date):
+				msgprint("Posting Date of Stock Entry cannot be before Posting Date of Production Order "+ cstr(self.doc.production_order))
+				raise Exception
+			if self.doc.process == 'Backflush':
+				pro_obj.doc.produced_qty = flt(pro_obj.doc.produced_qty) + (is_submit and 1 or -1 ) * flt(self.doc.fg_completed_qty)
+				get_obj('Warehouse',	pro_obj.doc.fg_warehouse).update_bin(0, 0, 0, 0, (is_submit and 1 or -1 ) *	flt(self.doc.fg_completed_qty), pro_obj.doc.production_item, now())
+			pro_obj.doc.status = (flt(pro_obj.doc.qty) == flt(pro_obj.doc.produced_qty)) and	'Completed' or 'In Process'
+			pro_obj.doc.save()
+	
+	# Create / Update Serial No
+	# ----------------------------------
+	def update_serial_no(self, is_submit):
+		sl_obj = get_obj('Stock Ledger')
+		for d in getlist(self.doclist, 'mtn_details'):
+			if d.serial_no:
+				serial_nos = sl_obj.get_sr_no_list(d.serial_no)
+				for x in serial_nos:
+					serial_no = x.strip()
+					if d.s_warehouse:
+						sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit)
+					if d.t_warehouse:
+						sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, (self.doc.purpose in ['Material Transfer', 'Sales Return']) and 1 or 0)
+					
+					if self.doc.purpose == 'Purchase Return':
+						delete_doc("Serial No", serial_no)
+
+	# On Submit
+	# ------------------
+	def on_submit(self):
+		self.validate_transfer_qty()
+		# Check for Approving Authority
+		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.total_amount)
+		self.update_serial_no(1)
+		self.update_stock_ledger(0)
+		# update Production Order
+		self.update_production_order(1)
+
+	# On Cancel
+	# -------------------
+	def on_cancel(self):
+		self.update_serial_no(0)
+		self.update_stock_ledger(1)
+		# update Production Order
+		self.update_production_order(0)
+		
+	def get_cust_values(self):
+		tbl = self.doc.delivery_note_no and 'Delivery Note' or 'Receivable Voucher'
+		record_name = self.doc.delivery_note_no or self.doc.sales_invoice_no
+		res = sql("select customer,customer_name, customer_address from `tab%s` where name = '%s'" % (tbl, record_name))
+		ret = {
+			'customer'				 : res and res[0][0] or '',
+			'customer_name'		: res and res[0][1] or '',
+			'customer_address' : res and res[0][2] or ''}
+
+		return str(ret)
+
+
+	def get_cust_addr(self):
+		res = sql("select customer_name,address from `tabCustomer` where name = '%s'"%self.doc.customer)
+		ret = { 
+			'customer_name'		: res and res[0][0] or '',
+			'customer_address' : res and res[0][1] or ''}
+
+		return str(ret)
+
+
+		
+	def get_supp_values(self):
+		res = sql("select supplier,supplier_name,supplier_address from `tabPurchase Receipt` where name = '%s'"%self.doc.purchase_receipt_no)
+		ret = {
+			'supplier' : res and res[0][0] or '',
+			'supplier_name' :res and res[0][1] or '',
+			'supplier_address' : res and res[0][2] or ''}
+		return str(ret)
+		
+
+	def get_supp_addr(self):
+		res = sql("select supplier_name,address from `tabSupplier` where name = '%s'"%self.doc.supplier)
+		ret = {
+			'supplier_name' : res and res[0][0] or '',
+			'supplier_address' : res and res[0][1] or ''}
+		return str(ret)
diff --git a/material_management/doctype/stock_entry/stock_entry.txt b/material_management/doctype/stock_entry/stock_entry.txt
new file mode 100644
index 0000000..09617ab
--- /dev/null
+++ b/material_management/doctype/stock_entry/stock_entry.txt
@@ -0,0 +1,1836 @@
+[
+	{
+		'_last_update': '1301989672',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Stock Entry',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': 'No',
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'transfer_date, from_warehouse, to_warehouse, purpose, remarks',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'eval:"%(remarks)s | " + ("%(from_warehouse)s" ? "From %(from_warehouse)s" : "") + ("%(to_warehouse)s" ? "To %(to_warehouse)s" : "")',
+		'tag_fields': 'purpose',
+		'use_template': None,
+		'version': 227
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00541',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00542',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00543',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00544',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00545',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Production User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00546',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Production User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 0,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00547',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Production User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00548',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Production Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 9,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00549',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Production Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 10,
+		'match': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00550',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Production Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Warehouse',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03366',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03367',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': 'STE',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03368',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'STE',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03369',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purpose',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Purpose',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03370',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purpose',
+		'oldfieldtype': 'Select',
+		'options': 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Delivery Note No',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03371',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'delivery_note_no',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Purchase Receipt No',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03372',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'purchase_receipt_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-04 17:22:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_invoice_no',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Sales Invoice No',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04499',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Receivable Voucher',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Supplier',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03373',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier',
+		'oldfieldtype': 'Link',
+		'options': 'Supplier',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Supplier Name',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03788',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_address',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Supplier Address',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03374',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03375',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03789',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03376',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'process',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Process',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03377',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'process',
+		'oldfieldtype': 'Select',
+		'options': '\nMaterial Transfer\nBackflush',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'production_order',
+		'fieldtype': 'Link',
+		'hidden': 1,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Production Order',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03378',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'production_order',
+		'oldfieldtype': 'Link',
+		'options': 'Production Order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fg_completed_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'FG Completed Qty',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03379',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fg_completed_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Warehouse HTML',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03380',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': "<div class='columnHeading'>Warehouse</div>",
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Source Warehouse',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03381',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'from_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': '<b>Notes:</b> Either Source or Target is Mandatory',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 0,
+		'label': 'Target Warehouse',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03382',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'to_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04203',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03383',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transfer_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Transfer Date',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03384',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transfer_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03385',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 0,
+		'label': 'Posting Time',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03386',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'posting_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03387',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Link',
+		'options': 'Stock Entry',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transporter',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Transporter',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03388',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'transporter',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_excisable_goods',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Is Excisable Goods',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03389',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_excisable_goods',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'excisable_goods',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Excisable Goods',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03390',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'excisable_goods',
+		'oldfieldtype': 'Select',
+		'options': '\nReturnable\nNon-Returnable',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'under_rule',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Under Rule',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03391',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'under_rule',
+		'oldfieldtype': 'Select',
+		'options': '\nOrdinary\n57 AC (5) a\n57 F (2) Non-Exc.',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03392',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 32,
+		'in_filter': 0,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03393',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03394',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Get Current Stock',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03395',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_current_stock',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03396',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03397',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_items',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03398',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mtn_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'MTN Details',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03399',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'mtn_details',
+		'oldfieldtype': 'Table',
+		'options': 'Stock Entry Detail',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Total Amount',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03400',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Other Details',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03401',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03402',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': 0,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03403',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-19 11:08:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-05-19 09:46:27',
+		'modified_by': 'Administrator',
+		'name': 'FL03754',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/stock_entry_detail/__init__.py b/material_management/doctype/stock_entry_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/stock_entry_detail/__init__.py
diff --git a/material_management/doctype/stock_entry_detail/stock_entry_detail.txt b/material_management/doctype/stock_entry_detail/stock_entry_detail.txt
new file mode 100644
index 0000000..509332d
--- /dev/null
+++ b/material_management/doctype/stock_entry_detail/stock_entry_detail.txt
@@ -0,0 +1,651 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'MTND/.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Stock Entry Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 24
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 's_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Source Warehouse',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03404',
+		'no_copy': None,
+		'oldfieldname': 's_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 't_warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Target Warehouse',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03405',
+		'no_copy': None,
+		'oldfieldname': 't_warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fg_item',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'FG Item',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03406',
+		'no_copy': None,
+		'oldfieldname': 'fg_item',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03407',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-26 11:47:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Item Name',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': '000002665',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03408',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'batch_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Batch No',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03409',
+		'no_copy': None,
+		'oldfieldname': 'batch_no',
+		'oldfieldtype': 'Link',
+		'options': 'Batch',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_qty',
+		'fieldtype': 'Read Only',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Actual Qty (at source)',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03410',
+		'no_copy': 1,
+		'oldfieldname': 'actual_qty',
+		'oldfieldtype': 'Read Only',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:23:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Qty',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04245',
+		'no_copy': None,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reqd_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 0,
+		'label': 'Reqd Qty',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03412',
+		'no_copy': None,
+		'oldfieldname': 'reqd_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 3,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 16:34:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'UOM',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04299',
+		'no_copy': None,
+		'oldfieldname': 'uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:23:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_factor',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Conversion Factor',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL04246',
+		'no_copy': None,
+		'oldfieldname': 'conversion_factor',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 0,
+		'label': 'Stock UOM',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03411',
+		'no_copy': None,
+		'oldfieldname': 'stock_uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transfer_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Stock Qty',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03413',
+		'no_copy': None,
+		'oldfieldname': 'transfer_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Serial No',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03414',
+		'no_copy': None,
+		'oldfieldname': 'serial_no',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'incoming_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Incoming Rate',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03415',
+		'no_copy': None,
+		'oldfieldname': 'incoming_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-04-26 11:47:18',
+		'modified_by': 'Administrator',
+		'name': 'FL03416',
+		'no_copy': None,
+		'oldfieldname': 'amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Entry Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/stock_ledger/__init__.py b/material_management/doctype/stock_ledger/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/stock_ledger/__init__.py
diff --git a/material_management/doctype/stock_ledger/stock_ledger.py b/material_management/doctype/stock_ledger/stock_ledger.py
new file mode 100644
index 0000000..a4498ca
--- /dev/null
+++ b/material_management/doctype/stock_ledger/stock_ledger.py
@@ -0,0 +1,237 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+def get_sr_no_list(sr_nos, qty = 0):
+	serial_nos = cstr(sr_nos).strip().replace(',', '\n').split('\n')
+	valid_serial_nos = []
+	for val in serial_nos:
+		if val:
+			if val in valid_serial_nos:
+				msgprint("You have entered duplicate serial no: %s" % val, raise_exception=1)
+			else:
+				valid_serial_nos.append(val.strip())
+
+	if qty > 0 and cstr(sr_nos).strip() and len(valid_serial_nos) != flt(qty):
+		msgprint("Please enter serial nos for all "+ cstr(qty) + " quantity", raise_exception = 1)
+	return valid_serial_nos
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+
+	# -----------------
+	# scrub serial nos
+	# -----------------
+	def scrub_serial_nos(self, obj):
+		for d in getlist(obj.doclist, obj.fname):
+			if d.serial_no:
+				d.serial_no = d.serial_no.replace(',', '\n')
+				d.save()
+
+
+	# -----------------------------
+	# validate serial no warehouse
+	# -----------------------------
+	def validate_serial_no_warehouse(self, obj, fname):
+		for d in getlist(obj.doclist, fname):
+			if d.serial_no:
+				serial_nos = self.get_sr_no_list(d.serial_no)
+				for s in serial_nos:
+					s = s.strip()
+					sr_war =	sql("select warehouse from `tabSerial No` where name = '%s'" % (s))
+					if not sr_war:
+						msgprint("Please set a warehouse in the Serial No <b>%s</b>" % s, raise_exception = 1)
+					if sr_war[0][0] != d.warehouse:
+						msgprint("Serial No : %s for Item : %s doesn't exists in Warehouse : %s" % (s, d.item_code, d.warehouse), raise_exception = 1)
+					
+
+	# ------------------------------------
+	# check whether serial no is required	
+	# ------------------------------------
+	def validate_serial_no(self, obj, fname):
+		for d in getlist(obj.doclist, fname):
+			is_stock_item = get_value('Item', d.item_code, 'is_stock_item')
+			ar_required = get_value('Item', d.item_code, 'has_serial_no')
+			if cstr(d.serial_no).strip():
+				if is_stock_item != 'Yes':
+					msgprint("Serial No is not required for non-stock item: %s" % d.item_code, raise_exception=1)
+				elif ar_required != 'Yes':
+					msgprint("If serial no required, please select 'Yes' in 'Has Serial No' in Item :" + d.item_code + ', otherwise please remove serial no', raise_exception=1)
+			elif ar_required == 'Yes' and not d.serial_no:
+				msgprint("Serial no is mandatory for item: "+ d.item_code, raise_exception = 1)
+			
+
+	
+	# -------------------
+	# get serial no list
+	# -------------------
+	def get_sr_no_list(self, sr_nos, qty = 0):
+		return get_sr_no_list(sr_nos, qty)
+
+	# ---------------------
+	# set serial no values
+	# ---------------------
+	def set_pur_serial_no_values(self, obj, serial_no, d, s, new_rec):
+		item_details = sql("select item_group, warranty_period from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) " %(d.item_code), as_dict=1)
+		s.purchase_document_type =	 obj.doc.doctype
+		s.purchase_document_no	 =	 obj.doc.name
+		s.purchase_date					=	 obj.doc.posting_date
+		s.purchase_time					=	 obj.doc.posting_time
+		s.purchase_rate					=	 d.purchase_rate or d.incoming_rate
+		s.item_code						=	 d.item_code
+		s.brand							=	 d.brand
+		s.description					=	 d.description
+		s.item_group					=	 item_details and item_details[0]['item_group'] or ''
+		s.warranty_period				=	 item_details and item_details[0]['warranty_period'] or 0
+		s.supplier						=	 obj.doc.supplier
+		s.supplier_name					=	 obj.doc.supplier_name
+		s.supplier_address			 	=	 obj.doc.supplier_address
+		s.warehouse						=	 d.warehouse or d.t_warehouse
+		s.docstatus						=	 0
+		s.status						=	 'In Store'
+		s.modified						=	 nowdate()
+		s.modified_by					=	 session['user']
+		s.serial_no						=	 serial_no
+		s.fiscal_year					=	 obj.doc.fiscal_year
+		s.company						=	 obj.doc.company
+		s.save(new_rec)
+
+
+	# ----------------------------------
+	# update serial no purchase details
+	# ----------------------------------
+	def update_serial_purchase_details(self, obj, d, serial_no, is_submit, is_transfer = 0):
+		exists = sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no))
+		if is_submit:
+			if exists and exists[0][2] != 2 and not is_transfer:
+				msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1)
+			elif exists:
+				s = Document('Serial No', exists and exists[0][0])
+				self.set_pur_serial_no_values(obj, serial_no, d, s, new_rec = 0)
+			else:
+				s = Document('Serial No')
+				self.set_pur_serial_no_values(obj, serial_no, d, s, new_rec = 1)
+		else:
+			if exists and exists[0][1] == 'Delivered' and exists[0][2] != 2:
+				msgprint("Serial No: %s is already delivered, you can not cancel the document." % serial_no, raise_exception=1)
+			else:
+				sql("update `tabSerial No` set docstatus = '%s', status = '%s', purchase_document_type = '', purchase_document_no = '', purchase_date = '', purchase_rate = '', supplier = null, supplier_name = '', supplier_address = '', warehouse = null where name = '%s'" % (not is_transfer and 2 or 0, is_transfer and 'In Store' or 'Not in Use', serial_no))
+
+
+	# -------------------------------
+	# check whether serial no exists
+	# -------------------------------
+	def check_serial_no_exists(self, serial_no, item_code):
+		chk = sql("select name, status, docstatus, item_code from `tabSerial No` where name = %s", (serial_no), as_dict=1)
+		if not chk:
+			msgprint("Serial No: %s does not exists in the system" % serial_no, raise_exception=1)
+		elif chk and chk[0]['item_code'] != item_code:
+			msgprint("Serial No: %s not belong to item: %s" % (serial_no, item_code), raise_exception=1)
+		elif chk and chk[0]['docstatus'] == 2:
+			msgprint("Serial No: %s of Item : %s is trashed in the system" % (serial_no, item_code), raise_exception = 1)
+		elif chk and chk[0]['status'] == 'Delivered':
+			msgprint("Serial No: %s of Item : %s is already delivered." % (serial_no, item_code), raise_exception = 1)
+
+	# ---------------------
+	# set serial no values
+	# ---------------------
+	def set_delivery_serial_no_values(self, obj, serial_no):
+		s = Document('Serial No', serial_no)
+		s.delivery_document_type =	 obj.doc.doctype
+		s.delivery_document_no	 =	 obj.doc.name
+		s.delivery_date					=	 obj.doc.posting_date
+		s.delivery_time					=	 obj.doc.posting_time
+		s.customer						=	 obj.doc.customer
+		s.customer_name					=	 obj.doc.customer_name
+		s.delivery_address			 	=	 obj.doc.delivery_address
+		s.territory						=	 obj.doc.territory
+		s.warranty_expiry_date	 		=	 s.warranty_period and add_days(cstr(obj.doc.posting_date), s.warranty_period) or ''
+		s.docstatus						=	 1
+		s.status						=	 'Delivered'
+		s.modified						=	 nowdate()
+		s.modified_by					=	 session['user']
+		s.save()
+
+
+	# ----------------------------------
+	# update serial no delivery details
+	# ----------------------------------
+	def update_serial_delivery_details(self, obj, d, serial_no, is_submit):
+		if is_submit:
+			self.check_serial_no_exists(serial_no, d.item_code)
+			self.set_delivery_serial_no_values(obj, serial_no)
+		else:
+			sql("update `tabSerial No` set docstatus = 0, status = 'In Store', delivery_document_type = '', delivery_document_no = '', delivery_date = '', customer = null, customer_name = '', delivery_address = '', territory = null where name = '%s'" % (serial_no))
+
+
+	# ---------------------
+	# update serial record
+	# ---------------------
+	def update_serial_record(self, obj, fname, is_submit = 1, is_incoming = 0):
+		import datetime
+		for d in getlist(obj.doclist, fname):
+			if d.serial_no:
+				serial_nos = self.get_sr_no_list(d.serial_no, d.qty)
+				for a in serial_nos:
+					serial_no = a.strip()
+					if is_incoming:
+						self.update_serial_purchase_details(obj, d, serial_no, is_submit)
+					else:
+						self.update_serial_delivery_details(obj, d, serial_no, is_submit)
+
+
+	# -------------
+	# update stock
+	# -------------
+	def update_stock(self, values):
+		for v in values:
+			sle_id, serial_nos = '', ''
+
+			# get serial nos
+			if v["serial_no"]:
+				serial_nos = self.get_sr_no_list(v["serial_no"], v['actual_qty'])
+
+			# reverse quantities for cancel
+			if v['is_cancelled'] == 'Yes':
+				v['actual_qty'] = -flt(v['actual_qty'])
+				# cancel matching entry
+				sql("update `tabStock Ledger Entry` set is_cancelled='Yes' where voucher_no=%s and voucher_type=%s", (v['voucher_no'], v['voucher_type']))
+
+			if v["actual_qty"]:
+				sle_id = self.make_entry(v)
+
+			get_obj('Warehouse', v["warehouse"]).update_bin(flt(v["actual_qty"]), 0, 0, 0, 0, v["item_code"], v["posting_date"], sle_id, v["posting_time"], '')
+
+
+	# -----------
+	# make entry
+	# -----------
+	def make_entry(self, args):
+		sle = Document(doctype = 'Stock Ledger Entry')
+		for k in args.keys():
+			# adds warehouse_type
+			if k == 'warehouse': 
+				sle.fields['warehouse_type'] = get_value('Warehouse' , args[k], 'warehouse_type')
+			sle.fields[k] = args[k]
+		sle_obj = get_obj(doc=sle)
+		# validate
+		sle_obj.validate()
+		sle.save(new = 1)
+		return sle.name
diff --git a/material_management/doctype/stock_ledger/stock_ledger.txt b/material_management/doctype/stock_ledger/stock_ledger.txt
new file mode 100644
index 0000000..6302b49
--- /dev/null
+++ b/material_management/doctype/stock_ledger/stock_ledger.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:43', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 10, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Stock Ledger', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00198', 'parent': 'Stock Ledger', 'read': 1, 'create': None, 'creation': '2009-03-12 14:53:41', 'modified': '2010-08-07 01:10:02', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00206', 'parent': 'Stock Ledger', 'read': 1, 'create': None, 'creation': '2009-03-12 15:09:54', 'modified': '2010-08-07 01:10:02', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}]
\ No newline at end of file
diff --git a/material_management/doctype/stock_ledger_entry/__init__.py b/material_management/doctype/stock_ledger_entry/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/stock_ledger_entry/__init__.py
diff --git a/material_management/doctype/stock_ledger_entry/stock_ledger_entry.py b/material_management/doctype/stock_ledger_entry/stock_ledger_entry.py
new file mode 100644
index 0000000..3833e45
--- /dev/null
+++ b/material_management/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -0,0 +1,81 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cstr, cint, flt, cstr, getdate
+
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+msgprint = webnotes.msgprint
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+	
+	#check for item quantity available in stock
+	def actual_amt_check(self):
+		if self.doc.batch_no:
+			batch_bal = flt(sql("select sum(actual_qty) from `tabStock Ledger Entry` where warehouse = '%s' and item_code = '%s' and batch_no = '%s'"%(self.doc.warehouse,self.doc.item_code,self.doc.batch_no))[0][0])
+	
+			if (batch_bal + self.doc.actual_qty) < 0:
+				msgprint("""Not enough quantity (requested: %(actual_qty)s, current: %(batch_bal)s in Batch 
+		<b>%(batch_no)s</b> for Item <b>%(item_code)s</b> at Warehouse<b>%(warehouse)s</b> 
+		as on %(posting_date)s %(posting_time)s""" % self.doc.fields.update({'batch_bal': batch_bal}), raise_exception = 1)
+			 
+
+	# mandatory
+	# ---------
+	
+	def validate_mandatory(self):		
+		mandatory = ['warehouse','transaction_date','posting_date','voucher_type','voucher_no','actual_qty','company','fiscal_year']
+		for k in mandatory:
+			if self.doc.fields.get(k)==None:
+				msgprint("Stock Ledger Entry: '%s' is mandatory" % k, raise_exception = 1)
+			elif k == 'warehouse':
+				if not sql("select name from tabWarehouse where name = '%s'" % self.doc.fields.get(k)):
+					msgprint("Warehouse: '%s' does not exist in the system. Please check." % self.doc.fields.get(k), raise_exception = 1)
+
+	# validate for item
+	# -----------------
+	
+	def validate_item(self):
+		item_det = sql("select name, has_batch_no, docstatus from tabItem where name = '%s'" % self.doc.item_code)
+
+		# check item exists
+		if item_det:
+			item_det = item_det and item_det[0]
+		else:
+			msgprint("Item: '%s' does not exist in the system. Please check." % self.doc.item_code, raise_exception = 1)
+			
+		# check if item is trashed
+		if cint(item_det[2])==2:
+			msgprint("Item: '%s' is trashed, cannot make a stock transaction against a trashed item" % self.doc.item_code, raise_exception = 1)
+			
+		# check if batch number is required
+		if item_det[1]=='Yes' and self.doc.voucher_type != 'Stock Reconciliation':
+			if not self.doc.batch_no:
+				msgprint("Batch number is mandatory for Item '%s'" % self.doc.item_code, raise_exception = 1)
+				raise Exception
+		
+			# check if batch belongs to item
+			if not sql("select name from `tabBatch` where item='%s' and name ='%s' and docstatus != 2" % (self.doc.item_code, self.doc.batch_no)):
+				msgprint("'%s' is not a valid Batch Number for Item '%s'" % (self.doc.batch_no, self.doc.item_code), raise_exception = 1)
+	
+	# Nobody can do SL Entries where posting date is before freezing date except authorized person
+	#----------------------------------------------------------------------------------------------
+	def check_stock_frozen_date(self):
+		stock_frozen_upto = get_value('Manage Account', None, 'stock_frozen_upto') or ''
+		if stock_frozen_upto:
+			stock_auth_role = get_value('Manage Account', None,'stock_auth_role')
+			if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles():
+				msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
+
+
+	def validate(self):
+		self.validate_mandatory()
+		self.validate_item()
+		self.actual_amt_check()
+		self.check_stock_frozen_date()
diff --git a/material_management/doctype/stock_ledger_entry/stock_ledger_entry.txt b/material_management/doctype/stock_ledger_entry/stock_ledger_entry.txt
new file mode 100644
index 0000000..de6847e
--- /dev/null
+++ b/material_management/doctype/stock_ledger_entry/stock_ledger_entry.txt
@@ -0,0 +1,1013 @@
+[
+	{
+		'_last_update': '1304945576',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'SLE/.########',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': 1,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Stock Ledger Entry',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 54
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'PERM00553',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'PERM00554',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'PERM00555',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:25',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'PERM00556',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03417',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-27 13:05:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'serial_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Serial No',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': '000000675',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Serial No',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'batch_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Batch No',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03418',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'batch_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Warehouse',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03419',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Warehouse Type',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03420',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'warehouse_type',
+		'oldfieldtype': 'Select',
+		'options': 'link:Warehouse Type',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry will get or has actually executed.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03421',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 0,
+		'label': 'Posting Time',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03422',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'posting_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Transaction Date',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03423',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_type',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Voucher Type',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03424',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'voucher_type',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 1,
+		'label': 'Voucher No',
+		'modified': '2011-05-09 18:23:41',
+		'modified_by': 'Administrator',
+		'name': 'FL03425',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'voucher_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'voucher_detail_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Voucher Detail No',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03426',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'voucher_detail_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Actual Quantity',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03427',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'actual_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'incoming_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Incoming Rate',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03428',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'incoming_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_uom',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Stock UOM',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03435',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'stock_uom',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bin_aqat',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Bin Actual Qty After Transaction',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03429',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bin_aqat',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ma_rate',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Moving Average Rate',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03430',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'ma_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fcfs_rate',
+		'fieldtype': 'Currency',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'FIFO Rate',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03431',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fcfs_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'valuation_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Valuation Rate',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03432',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'valuation_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_value',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Stock Value',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03433',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'stock_value',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fcfs_stack',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 20,
+		'in_filter': 0,
+		'label': 'FIFO Stack',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03434',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fcfs_stack',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03436',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03437',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_cancelled',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Is Cancelled',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03438',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_cancelled',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_stock_entry',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Is Stock Entry',
+		'modified': '2011-05-09 18:23:42',
+		'modified_by': 'Administrator',
+		'name': 'FL03439',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_stock_entry',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Stock Ledger Entry',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/stock_reconciliation/__init__.py b/material_management/doctype/stock_reconciliation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/stock_reconciliation/__init__.py
diff --git a/material_management/doctype/stock_reconciliation/stock_reconciliation.js b/material_management/doctype/stock_reconciliation/stock_reconciliation.js
new file mode 100644
index 0000000..de89d80
--- /dev/null
+++ b/material_management/doctype/stock_reconciliation/stock_reconciliation.js
@@ -0,0 +1,37 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cfn_set_fields(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cfn_set_fields(doc, cdt, cdn);
+}
+
+var cfn_set_fields = function(doc, cdt, cdn) {
+  refresh_field('remark');
+  refresh_field('next_step');
+  if (doc.docstatus == 0 && doc.next_step == 'Upload File and Save Document') 
+    doc.next_step = 'Validate Data';
+  
+  if (! doc.file_list)
+    doc.next_step = 'Upload File and Save Document'
+  
+  if (doc.next_step == 'Upload File and Save Document') {
+    //alert("Upload File and Save Document");
+    cur_frm.clear_tip();
+    cur_frm.set_tip("Please Enter Reconciliation Date and Attach CSV File with Columns in Following Sequence:-");
+    cur_frm.append_tip("Item Code , Warehouse , Qty , MAR");
+    hide_field("Validate Data");
+  }
+  if (doc.next_step == 'Validate Data') {
+    //alert("Validate Data");
+    cur_frm.clear_tip();
+    cur_frm.set_tip("Please Check Remarks");
+    unhide_field("Validate Data");
+  }
+  if (doc.next_step == 'Submit Document') {
+    //alert('Submit Document');
+    cur_frm.clear_tip();
+    cur_frm.set_tip("Please Submit the document.");
+    hide_field("Validate Data");
+  }
+}
\ No newline at end of file
diff --git a/material_management/doctype/stock_reconciliation/stock_reconciliation.py b/material_management/doctype/stock_reconciliation/stock_reconciliation.py
new file mode 100644
index 0000000..d7eb78b
--- /dev/null
+++ b/material_management/doctype/stock_reconciliation/stock_reconciliation.py
@@ -0,0 +1,309 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+		self.label = { 'item_code': 0 , 'warehouse': 1 , 'qty': 2, 'mar': 3,'stock_uom':4, 'actual_qty':5, 'diff': 6} # with mar
+
+	# autoname
+	#-----------------
+	def autoname(self):
+		 self.doc.name = make_autoname('SR/' + self.doc.fiscal_year + '/.######')
+
+	# -----------------
+	# update next step
+	# -----------------
+	def update_next_step(self,next_step):
+		sql("update `tabStock Reconciliation` set next_step = '%s' where name = '%s'" % (next_step,self.doc.name))
+	
+
+	# -----------
+	# add remark
+	# -----------
+	def add_remark(self, text, next_step, first_time = 0):
+		if first_time:
+			sql("update `tabStock Reconciliation` set remark = '' where name = '%s'" % self.doc.name)
+		else:
+			sql("update `tabStock Reconciliation` set remark = concat(remark, '%s'), modified = '%s' where name = '%s'" % (text + "<br>", nowdate(), self.doc.name))
+		self.update_next_step(next_step)
+
+
+	# --------------
+	# validate item
+	# --------------
+	def validate_item(self, item, count, check_item = 1):
+		det = sql("select item_code, has_serial_no from `tabItem` where name = '%s'"% cstr(item), as_dict = 1)
+		if not det:
+			text = "Item: " + cstr(item) + " mentioned at Row No. " + cstr(count) + "does not exist in the system"
+			msgprint(text)
+			self.add_remark(text, 'Validate Data', 0)
+			check_item = 0
+		elif det and det[0]['has_serial_no'] == 'Yes':
+			text = "You cannot make Stock Reconciliation of items having serial no. You can directly upload serial no to update their inventory. Please remove Item Code : %s at Row No. %s" %(cstr(item), cstr(count))
+			msgprint(text)
+			self.add_remark(text, 'Validate Data', 0)
+			check_item = 0
+		return check_item
+
+
+	# -------------------
+	# validate warehouse
+	# -------------------
+	def validate_warehouse(self,wh,count, check_warehouse = 1):
+		if not sql("select name from `tabWarehouse` where name = '%s'" % cstr(wh)):
+			text = "Warehouse: " + cstr(wh) + " mentioned at Row No. " + cstr(count) + "does not exist in the system"
+			self.add_remark(text,'Validate Data',0)
+			check_warehouse = 0
+		return check_warehouse
+
+
+	# ---------------------------
+	# validate data of .csv file
+	# ---------------------------
+	def validate_data(self,stock):
+		self.add_remark('','Validate Data',1)
+
+		# check whether file uploaded
+		if not self.doc.file_list:
+			set(self.doc,'next_step','Upload File and Save Document')
+			msgprint("Please Attach File", raise_exception=1)
+
+		# validate item and warehouse
+		check_item,check_warehouse,count = 1, 1, 1
+		for s in stock:
+			count +=1
+			check_item = self.validate_item(s[self.label['item_code']],count) or 0
+			check_warehouse = self.validate_warehouse(s[self.label['warehouse']],count) or 0
+
+		if check_item and check_warehouse:
+			text = "Validation Completed Successfully..."
+			self.add_remark(text,'Submit Document',0)
+		return check_item and check_warehouse
+
+
+	# ------------------------------
+	# convert lines in .csv to list
+	# ------------------------------
+	def convert_into_list(self, stock, submit):
+		count, st_list = 1, []
+		for s in stock:
+			if submit and len(s) != 4:
+				msgprint("Data entered at Row No " + cstr(count) + " in Attachment File is not in correct format.", raise_exception=1)
+
+			l = [s[0].encode("ascii"), s[1].encode("ascii"), s[2].encode("ascii"), s[3].encode("ascii")]
+			st_list.append(l)
+			count += 1
+		return st_list
+
+	# ------------------
+	# get current stock
+	# ------------------
+	def get_current_stock(self, item_code, warehouse):
+		bin = sql("select name from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item_code, warehouse))
+		prev_sle = bin and get_obj('Bin', bin[0][0]).get_prev_sle('', self.doc.reconciliation_date,self.doc.reconciliation_time) or 0
+		stock_uom = sql("select stock_uom from `tabItem` where name = %s",item_code)
+		return {'actual_qty': prev_sle.get('bin_aqat', 0), 'stock_uom': stock_uom[0][0]}
+
+
+	# -----------
+	# update mar
+	# -----------
+	def update_mar(self, d, qty_diff):
+		if not d[self.label['qty']] and not d[self.label['actual_qty']]:
+			 # seems like a special condition when there is no actual quanitity but there is a rate, may be only for setting a rate!
+			 self.make_sl_entry(1,d,1)
+			 self.make_sl_entry(-1,d,1)
+		else:
+			self.update_item_valuation_pre_date(d)
+
+			if not qty_diff:
+				self.update_item_valuation_post_date()
+				
+	# update valuation rate as csv file in all sle before reconciliation date
+	# ------------------------------------------------------------------------
+	def update_item_valuation_pre_date(self, d):
+		mar = flt(d[self.label['mar']])		
+				
+		# previous sle
+		prev_sle = sql("""
+			select name, fcfs_stack
+			from `tabStock Ledger Entry`
+			where item_code = '%s'
+			and warehouse = '%s'
+			and timestamp(posting_date, posting_time) <= timestamp(%s, %s)
+			""", (d[self.label['item_code']], d[self.label['warehouse']], self.doc.reconciliation_date, self.doc.reconciliation_time))
+
+		for each in prev_sle:
+			# updated fifo stack
+			fstack = [[i[0], mar] for i in each]
+			
+			# update incoming rate, valuation rate, stock value and fifo stack
+			sql(""" update `tabStock Ledger Entry` 
+			set incoming_rate = %s, valuation_rate = %s, stock_value = bin_aqat*%s, fcfs_stack = %s 
+			where name = '%s'
+			""", (mar, mar, mar, fstack, each[0]))
+			
+				
+	# Update item valuation in all sle after the reconcliation date
+	# ---------------------------------------------------------
+	def update_item_valuation_post_date(self, d):
+		bin = sql("select name from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d[self.label['item_code']], d[self.label['warehouse']]))
+		bin_obj = get_obj('Bin', bin[0][0])
+
+		# prev sle
+		prev_sle = bin_obj.get_prev_sle('', self.doc.reconciliation_date,self.doc.reconciliation_time)
+
+		# update valuation in sle posted after reconciliation datetime
+		bin_obj.update_item_valuation(posting_date = self.doc.reconciliation_date, posting_time = self.doc.reconciliation_time, prev_sle = prev_sle)
+
+	# --------------
+	# make sl entry
+	# --------------
+	def make_sl_entry(self, update_stock, stock, diff):
+		values = []
+		values.append({
+				'item_code'					: stock[self.label['item_code']],
+				'warehouse'					: stock[self.label['warehouse']],
+				'transaction_date'	 		: now(),
+				'posting_date'				: self.doc.reconciliation_date,
+				'posting_time'			 	: self.doc.reconciliation_time,
+				'voucher_type'			 	: self.doc.doctype,
+				'voucher_no'				: self.doc.name,
+				'voucher_detail_no'			: self.doc.name,
+				'actual_qty'				: flt(update_stock) * flt(diff),
+				'stock_uom'					: stock[self.label['stock_uom']],
+				'incoming_rate'				: stock[self.label['mar']] or 0,
+				'company'					: self.doc.company,
+				'fiscal_year'				: self.doc.fiscal_year,
+				'is_cancelled'			 	: (update_stock==1) and 'No' or 'Yes',
+				'batch_no'					: '',
+				'serial_no'					: ''
+		 })
+				
+		get_obj('Stock Ledger', 'Stock Ledger').update_stock(values)
+
+
+	# -----------------------
+	# get stock reco details
+	# -----------------------
+	def get_reconciliation_stock_details(self,submit = 0):
+		import csv 
+		stock = csv.reader(self.get_csv_file_data().splitlines())
+		stock = self.convert_into_list(stock, submit)
+		if stock[0][0] and stock[0][0].strip()=='Item Code':
+			stock.pop(0)		# remove the labels
+		check = self.validate_data(stock)
+		if not check:
+			return 0
+		return stock
+
+	# validate date and time
+	# ------------------------
+	def validate_datetime(self):
+		if not self.doc.reconciliation_date:
+			msgprint("Please Enter Reconciliation Date.", raise_exception=1)
+		if not self.doc.reconciliation_time:
+			msgprint("Please Enter Reconciliation Time.", raise_exception=1)
+
+
+
+	# ----------------------
+	# stock reconciliations
+	# ----------------------
+	def stock_reconciliations(self, submit = 0):
+		self.validate_datetime()
+
+		# get reco data
+		rec_stock_detail = self.get_reconciliation_stock_details(submit) or []
+		if not rec_stock_detail:
+			msgprint("Please Check Remarks", raise_exception=1)
+
+		count = 1
+		for stock in rec_stock_detail:
+			count += 1
+
+			# Get qty as per system
+			cur_stock_detail = self.get_current_stock(stock[self.label['item_code']],stock[self.label['warehouse']])
+			stock.append(cur_stock_detail['stock_uom'])
+			stock.append(cur_stock_detail['actual_qty'])
+
+			# Qty Diff between file and system
+			diff = flt(stock[self.label['qty']]) - flt(cur_stock_detail['actual_qty'])
+
+			# Update MAR
+			if not stock[self.label['mar']] == '~':
+				self.update_mar(stock, diff)
+			
+			# Make sl entry if qty differ
+			if diff:
+				self.make_sl_entry(submit, stock, diff)
+
+		if rec_stock_detail:
+			text = "Stock Reconciliation Completed Successfully..."
+			self.add_data_in_CSV(rec_stock_detail)
+			self.add_remark(text,'Completed', 0)
+
+	# Get csv data
+	#--------------------------
+	def get_csv_file_data(self):
+		filename = self.doc.file_list.split(',')
+		if not filename:
+			msgprint("Please Attach File. ", raise_exception=1)
+			
+		from webnotes.utils import file_manager
+		fn, content = file_manager.get_file(filename[1])
+		
+		if not type(content) == str:
+			content = content.tostring()
+		return content
+
+
+	def getCSVelement(self,v):
+		v = cstr(v)
+		if not v: return ''
+		if (',' in v) or ('' in v) or ('"' in	v):
+			if '"' in v: v = v.replace('"', '""')
+			return '"'+v+'"'
+		else: return v or ''
+
+	# Add qty diff column in attached file
+	#----------------------------------------
+	def add_data_in_CSV(self,data):
+		filename = self.doc.file_list.split(',')
+		head = []
+		for h in ['Item Code','Warehouse','Qty','Actual','Difference','MAR']:
+			head.append(self.getCSVelement(h))
+		dset = (','.join(head) + "\n")
+		for d in data:
+			l = [d[self.label['item_code']],d[self.label['warehouse']],d[self.label['qty']],d[self.label['actual_qty']],flt(d[self.label['qty']])-flt(d[self.label['actual_qty']]),d[self.label['mar']]]
+			s =[]
+			for i in l:
+				s.append(self.getCSVelement(i))
+			dset +=(','.join(s)+"\n")
+		
+		from webnotes.utils import file_manager
+		file_manager.write_file(filename[1], dset)
+
+	# ----------
+	# on submit
+	# ----------
+	def on_submit(self):
+		self.stock_reconciliations(submit = 1)
diff --git a/material_management/doctype/stock_reconciliation/stock_reconciliation.txt b/material_management/doctype/stock_reconciliation/stock_reconciliation.txt
new file mode 100644
index 0000000..994a6b8
--- /dev/null
+++ b/material_management/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -0,0 +1,603 @@
+[
+	{
+		'_last_update': '1301391552',
+		'allow_attach': 1,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:26',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': 1,
+		'menu_index': None,
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'Stock Reconciliation',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'reconciliation_date',
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 85
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'PERM00557',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'PERM00558',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'PERM00559',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-04-25 11:46:21',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': '000002610',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Validate Data',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03440',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_reconciliation_stock_details',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Summary',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03441',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reconciliation_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 0,
+		'label': 'Reconciliation Date',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03442',
+		'no_copy': None,
+		'oldfieldname': 'reconciliation_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reconciliation_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 0,
+		'label': 'Reconciliation Time',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03443',
+		'no_copy': None,
+		'oldfieldname': 'reconciliation_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'next_step',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Next Steps',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03444',
+		'no_copy': None,
+		'oldfieldname': 'next_step',
+		'oldfieldtype': 'Select',
+		'options': 'Upload File and Save Document\nValidate Data\nSubmit Document\nCompleted',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remark',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Remark',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03445',
+		'no_copy': None,
+		'oldfieldname': 'remark',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03446',
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03447',
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-29 15:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': '000001851',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-29 15:08:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': '000001852',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Attachment',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03448',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Attachment HTML',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03449',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'The attachment must be a CSV(Comma Seperated Value) file',
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2011-04-25 11:46:21',
+		'modified_by': 'Administrator',
+		'name': 'FL03451',
+		'no_copy': None,
+		'oldfieldname': 'file_list',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Stock Reconciliation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/material_management/doctype/stock_uom_replace_utility/__init__.py b/material_management/doctype/stock_uom_replace_utility/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/stock_uom_replace_utility/__init__.py
diff --git a/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js b/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js
new file mode 100644
index 0000000..8352506
--- /dev/null
+++ b/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js
@@ -0,0 +1,10 @@
+cur_frm.fields_dict['item_code'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+//==================== Get Items Stock UOM =====================================================
+cur_frm.cscript.item_code = function(doc,cdt,cdn) {
+ if (doc.item_code) {
+    get_server_fields('get_stock_uom', doc.item_code, '', doc, cdt, cdn, 1);
+  }
+}
\ No newline at end of file
diff --git a/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
new file mode 100644
index 0000000..e603d1f
--- /dev/null
+++ b/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
@@ -0,0 +1,105 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl=[]):
+    self.doc, self.doclist = d,dl
+
+  def get_stock_uom(self, item_code):
+    return cstr({'current_stock_uom': cstr(get_value('Item', item_code, 'stock_uom'))})
+  
+  def validate_mandatory(self):
+    if not cstr(self.doc.item_code):
+      msgprint("Please Enter an Item.")
+      raise Exception
+
+    if not cstr(self.doc.current_stock_uom):
+      msgprint("There is no Current Stock UOM for Item Code" + cstr(self.doc.item_code))
+      raise Exception
+    
+    if not cstr(self.doc.new_stock_uom):
+      msgprint("Please Enter New Stock UOM.")
+      raise Exception
+
+    if cstr(self.doc.current_stock_uom) == cstr(self.doc.new_stock_uom):
+      msgprint("Current Stock UOM and Stock UOM are same.")
+      raise Exception 
+  
+    # check conversion factor
+    if not flt(self.doc.conversion_factor):
+      msgprint("Please Enter Conversion Factor.")
+      raise Exception
+    
+    stock_uom = sql("select stock_uom from `tabItem` where name = '%s'" % self.doc.item_code)
+    stock_uom = stock_uom and stock_uom[0][0]
+    if cstr(self.doc.new_stock_uom) == cstr(stock_uom):
+      msgprint("Item Master is already updated with New Stock UOM " + cstr(self.doc.new_stock_uom))
+      raise Exception
+      
+  def update_item_master(self):
+    # update stock uom in item master
+    sql("update `tabItem` set stock_uom = '%s' where name = '%s' " % (self.doc.new_stock_uom, self.doc.item_code))
+    
+    # acknowledge user
+    msgprint("New Stock UOM : " + cstr(self.doc.new_stock_uom) + " updated in Item : " + cstr(self.doc.item_code))
+    
+  def update_bin(self):
+    # update bin
+    if flt(self.doc.conversion_factor) != flt(1):
+      sql("update `tabBin` set stock_uom = '%s' , indented_qty = ifnull(indented_qty,0) * %s, ordered_qty = ifnull(ordered_qty,0) * %s, reserved_qty = ifnull(reserved_qty,0) * %s, planned_qty = ifnull(planned_qty,0) * %s, projected_qty = actual_qty + ordered_qty + indented_qty + planned_qty - reserved_qty  where item_code = '%s'" % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.item_code) )
+    else:
+      sql("update `tabBin` set stock_uom = '%s' where item_code = '%s'" % (self.doc.new_stock_uom, self.doc.item_code) )
+
+    # acknowledge user
+    msgprint(" All Bin's Updated Successfully.")
+      
+  def update_stock_ledger_entry(self):
+    # update stock ledger entry
+    if flt(self.doc.conversion_factor) != flt(1):
+      sql("update `tabStock Ledger Entry` set stock_uom = '%s', actual_qty = ifnull(actual_qty,0) * '%s' where item_code = '%s' " % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.item_code))
+    else:
+      sql("update `tabStock Ledger Entry` set stock_uom = '%s' where item_code = '%s' " % (self.doc.new_stock_uom, self.doc.item_code))
+    
+    # acknowledge user
+    msgprint("Stock Ledger Entries Updated Successfully.")
+    
+    # update item valuation
+    if flt(self.doc.conversion_factor) != flt(1):
+      wh = sql("select name from `tabWarehouse`")
+      for w in wh:
+        bin = sql("select name from `tabBin` where item_code = '%s' and warehouse = '%s'" % (self.doc.item_code, w[0])) 
+        if bin and bin[0][0]:
+          get_obj("Bin", bin[0][0]).update_item_valuation(sle_id = '', posting_date = '', posting_time = '')
+
+    # acknowledge user
+    msgprint("Item Valuation Updated Successfully.")
+
+  # Update Stock UOM              
+  def update_stock_uom(self):
+    # validate mandatory
+    self.validate_mandatory()
+    
+    # update item master
+    self.update_item_master()
+    
+    # update stock ledger entry
+    self.update_stock_ledger_entry()
+    
+    # update bin
+    self.update_bin()
\ No newline at end of file
diff --git a/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt b/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt
new file mode 100644
index 0000000..704964a
--- /dev/null
+++ b/material_management/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-26 16:01:43', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 25, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Stock UOM Replace Utility', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00851', 'parent': 'Stock UOM Replace Utility', 'read': 1, 'create': 1, 'creation': '2010-04-26 16:01:43', 'modified': '2010-08-08 14:59:22', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00986', 'parent': 'Stock UOM Replace Utility', 'read': 1, 'create': None, 'creation': '2010-04-29 14:41:57', 'modified': '2010-08-08 14:59:22', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01069', 'parent': 'Stock UOM Replace Utility', 'read': 1, 'create': 1, 'creation': '2010-07-13 15:10:49', 'modified': '2010-08-08 14:59:22', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01070', 'parent': 'Stock UOM Replace Utility', 'read': 1, 'create': 1, 'creation': '2010-07-13 15:10:49', 'modified': '2010-08-08 14:59:22', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01071', 'parent': 'Stock UOM Replace Utility', 'read': 1, 'create': None, 'creation': '2010-07-13 15:10:49', 'modified': '2010-08-08 14:59:22', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01072', 'parent': 'Stock UOM Replace Utility', 'read': 1, 'create': None, 'creation': '2010-07-13 15:10:49', 'modified': '2010-08-08 14:59:23', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-26 16:01:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Item', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Stock UOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04899', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-08 14:59:23', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-26 16:01:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Current Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Stock UOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04900', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 14:59:23', 'parenttype': 'DocType', 'fieldname': 'current_stock_uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-26 16:01:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'New Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Stock UOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04901', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 14:59:23', 'parenttype': 'DocType', 'fieldname': 'new_stock_uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-26 16:01:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Conversion Factor', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Stock UOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04902', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-08 14:59:23', 'parenttype': 'DocType', 'fieldname': 'conversion_factor', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-26 17:27:12', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Stock UOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04903', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-08 14:59:23', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'update_stock_uom', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/uom_conversion_detail/__init__.py b/material_management/doctype/uom_conversion_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/uom_conversion_detail/__init__.py
diff --git a/material_management/doctype/uom_conversion_detail/uom_conversion_detail.txt b/material_management/doctype/uom_conversion_detail/uom_conversion_detail.txt
new file mode 100644
index 0000000..7249533
--- /dev/null
+++ b/material_management/doctype/uom_conversion_detail/uom_conversion_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:44', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'UCDD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'UOM Conversion Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'UOM Conversion Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00660', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-11-04 16:21:29', 'parenttype': 'DocType', 'fieldname': 'uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Float', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'conversion_factor', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Conversion Factor', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'UOM Conversion Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00661', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-11-04 16:21:29', 'parenttype': 'DocType', 'fieldname': 'conversion_factor', 'fieldtype': 'Float', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/doctype/valuation_control/__init__.py b/material_management/doctype/valuation_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/valuation_control/__init__.py
diff --git a/material_management/doctype/valuation_control/valuation_control.py b/material_management/doctype/valuation_control/valuation_control.py
new file mode 100644
index 0000000..d28de4e
--- /dev/null
+++ b/material_management/doctype/valuation_control/valuation_control.py
@@ -0,0 +1,90 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+
+	# Get FIFO Rate from Stack
+	# -------------------------
+	def get_fifo_rate(self, fcfs_bal, qty):
+		if qty:
+			fcfs_val = 0
+			withdraw = flt(qty)
+			while withdraw:
+				if not fcfs_bal:
+					break # nothing in store
+					 
+				batch = fcfs_bal[0]
+					
+				if batch[0] < withdraw:
+					# not enough in current batch, clear batch
+					withdraw -= batch[0]
+					fcfs_val += (flt(batch[0]) * flt(batch[1]))
+					fcfs_bal.pop(0)
+				else:
+					# all from current batch
+					fcfs_val += (flt(withdraw) * flt(batch[1]))
+					batch[0] -= withdraw
+					withdraw = 0
+			fcfs_rate = flt(fcfs_val) / flt(qty)
+			return fcfs_rate
+		else:
+			return fcfs_bal and fcfs_bal[0][1] or 0
+
+
+	# --------------------------------
+	# get serializable inventory rate
+	# --------------------------------
+	def get_serializable_inventory_rate(self, serial_no):
+		sr_nos = get_obj("Stock Ledger").get_sr_no_list(serial_no)
+		tot = 0
+		for s in sr_nos:
+			serial_no = s.strip()
+			tot += flt(get_value('Serial No', serial_no, 'purchase_rate'))
+		return tot / len(sr_nos)
+
+
+	# ---------------------
+	# get valuation method
+	# ---------------------
+	def get_valuation_method(self, item_code):
+		val_method = webnotes.conn.get_value('Item', item_code, 'valuation_method')
+		if not val_method:
+			val_method = get_defaults().get('valuation_method', 'FIFO')
+		return val_method
+		
+
+	# Get Incoming Rate based on valuation method
+	# --------------------------------------------
+	def get_incoming_rate(self, posting_date, posting_time, item, warehouse, qty = 0, serial_no = ''):
+		in_rate = 0
+		val_method = self.get_valuation_method(item)
+		if serial_no:
+			in_rate = self.get_serializable_inventory_rate(serial_no)
+		elif val_method == 'FIFO':
+			bin_obj = get_obj('Warehouse',warehouse).get_bin(item)
+			prev_sle = bin_obj.get_prev_sle('',posting_date, posting_time)
+			fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]') or '[]')
+			in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0
+		elif val_method == 'Moving Average':
+			bin_obj = get_obj('Warehouse',warehouse).get_bin(item)
+			prev_sle = bin_obj.get_prev_sle('',posting_date, posting_time)
+			in_rate = prev_sle and prev_sle.get('valuation_rate', 0) or 0
+		return in_rate 
diff --git a/material_management/doctype/valuation_control/valuation_control.txt b/material_management/doctype/valuation_control/valuation_control.txt
new file mode 100644
index 0000000..8c576a6
--- /dev/null
+++ b/material_management/doctype/valuation_control/valuation_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-07-21 10:40:01', 'search_fields': None, 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Valuation Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/material_management/doctype/warehouse/__init__.py b/material_management/doctype/warehouse/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/doctype/warehouse/__init__.py
diff --git a/material_management/doctype/warehouse/warehouse.js b/material_management/doctype/warehouse/warehouse.js
new file mode 100644
index 0000000..a418027
--- /dev/null
+++ b/material_management/doctype/warehouse/warehouse.js
@@ -0,0 +1,13 @@
+cur_frm.cscript.country = function(doc, cdt, cdn) {
+  var mydoc=doc;
+  $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
+    function(r,rt){
+      if(r.message) {
+        var doc = locals[mydoc.doctype][mydoc.name];
+        doc.state = '';
+        get_field(doc.doctype, 'state' , doc.name).options = r.message;
+        refresh_field('state');
+      }
+    }  
+  );
+}
diff --git a/material_management/doctype/warehouse/warehouse.py b/material_management/doctype/warehouse/warehouse.py
new file mode 100644
index 0000000..8b523dd
--- /dev/null
+++ b/material_management/doctype/warehouse/warehouse.py
@@ -0,0 +1,90 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    
+  def get_bin(self, item_code):
+    bin = sql("select name from tabBin where item_code = '%s' and warehouse = '%s'" % (item_code, self.doc.name))
+    bin = bin and bin[0][0] or ''
+    if not bin:
+      if not self.doc.warehouse_type :
+        msgprint("[Warehouse Type is Mandatory] Please Enter warehouse type in Warehouse " + self.doc.name)
+        raise Exception
+      bin = Document('Bin')
+      bin.item_code = item_code
+      bin.stock_uom = get_value('Item', item_code, 'stock_uom')
+      bin.warehouse = self.doc.name
+      bin.warehouse_type = self.doc.warehouse_type
+      bin_obj = get_obj(doc=bin)
+      bin_obj.validate()
+      bin.save(1)
+      bin = bin.name
+    else:
+      bin_obj = get_obj('Bin',bin)
+
+    return bin_obj
+  
+
+  def validate_asset(self, item_code):
+    if sql("select is_asset_item from tabItem where name=%s", item_code)[0][0] == 'Yes' and self.doc.warehouse_type != 'Fixed Asset':
+      msgprint("Fixed Asset Item %s can only be transacted in a Fixed Asset type Warehouse" % item_code)
+      raise Exception
+
+
+  # update bin
+  # ----------
+  def update_bin(self, actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, item_code, dt, sle_id = '',posting_time = '', serial_no = ''):
+    self.validate_asset(item_code)
+    it_det = get_value('Item', item_code, 'is_stock_item')
+    if it_det and it_det == 'Yes':
+      bin = self.get_bin(item_code)
+      bin.update_stock(actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, dt, sle_id, posting_time, serial_no)
+      return bin
+    else:
+      msgprint("[Stock Update] Ignored %s since it is not a stock item" % item_code)
+
+  # repost stock
+  # ------------
+  def repost_stock(self):
+    bl = sql("select name from tabBin where warehouse=%s", self.doc.name)
+    for b in bl:
+      bobj = get_obj('Bin',b[0])
+      bobj.update_item_valuation()
+
+      sql("COMMIT")
+      sql("START TRANSACTION")
+
+  def check_state(self):
+    return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
+
+  def validate(self):
+    if self.doc.email_id:
+      if not validate_email_add(self.doc.email_id):
+        msgprint("Please enter valid Email Id.")
+        raise Exception
+    if not self.doc.warehouse_type:
+      msgprint("[Warehouse Type is Mandatory] Please Enter  Please Entry warehouse type in Warehouse " + self.doc.name)
+      raise Exception
+    wt = sql("select warehouse_type from `tabWarehouse` where name ='%s'" % self.doc.name)
+    if cstr(self.doc.warehouse_type) != cstr(wt and wt[0][0] or ''):
+      sql("update `tabStock Ledger Entry` set warehouse_type = '%s' where warehouse = '%s'" % (self.doc.warehouse_type, self.doc.name))
+      msgprint("All Stock Ledger Entries Updated.")
diff --git a/material_management/doctype/warehouse/warehouse.txt b/material_management/doctype/warehouse/warehouse.txt
new file mode 100644
index 0000000..5272ef8
--- /dev/null
+++ b/material_management/doctype/warehouse/warehouse.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:44', 'search_fields': 'warehouse_type', 'module': 'Material Management', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 60, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:warehouse_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': 'Master', 'name': 'Warehouse', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-18 12:09:48', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00896', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00895', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00894', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00871', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00870', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00869', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 6, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00191', 'parent': 'Warehouse', 'read': 1, 'create': None, 'creation': '2009-03-12 14:50:16', 'modified': '2010-11-18 12:09:48', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 7, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00207', 'parent': 'Warehouse', 'read': 1, 'create': 1, 'creation': '2009-03-12 15:10:19', 'modified': '2010-11-18 12:09:48', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 8, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00208', 'parent': 'Warehouse', 'read': 1, 'create': None, 'creation': '2009-03-12 15:10:28', 'modified': '2010-11-18 12:09:48', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 9, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01050', 'parent': 'Warehouse', 'read': 1, 'create': 1, 'creation': '2010-06-25 14:38:36', 'modified': '2010-11-18 12:09:48', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 10, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00299', 'parent': 'Warehouse', 'read': 1, 'create': 0, 'creation': '2009-05-21 14:14:37', 'modified': '2010-11-18 12:09:48', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 11, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04867', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Warehouse Detail', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00662', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'warehouse_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Warehouse Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00663', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'warehouse_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'warehouse_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Warehouse Type', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00664', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'warehouse_type', 'fieldtype': 'Link', 'options': 'Warehouse Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The valuation of items in this warehouse will be considered for the company that is specified', 'parent': 'Warehouse', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00665', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-30 13:28:22', 'doctype': 'DocField', 'oldfieldname': 'email_id', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 0, 'modified_by': 'harshada@webnotestech.com', 'label': 'Email Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05760', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'email_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2010-07-30 13:28:22', 'doctype': 'DocField', 'oldfieldname': 'auto_indent_mail', 'owner': 'harshada@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Send Reorder Alert Mail ', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05759', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'auto_indent_mail', 'fieldtype': 'Select', 'options': 'No\nYes', 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'phone_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Phone No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00666', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'phone_no', 'fieldtype': 'Int', 'options': 'Phone', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-22 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'mobile_no', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Mobile No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04889', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'mobile_no', 'fieldtype': 'Int', 'options': 'Phone', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-07-30 13:45:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05761', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'address_line_1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Address Line 1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00667', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'address_line_1', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'address_line_2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Address Line 2', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00668', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'address_line_2', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Link', 'creation': '2009-12-21 15:27:06', 'doctype': 'DocField', 'oldfieldname': 'country', 'owner': 'wasim@webnotestech.com', 'reqd': 0, 'in_filter': 0, 'print_hide': 0, 'modified_by': 'harshada@webnotestech.com', 'label': 'Country', 'width': '', 'trigger': 'Client', 'depends_on': '', 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': 0, 'allow_on_submit': 0, 'icon': None, 'name': 'FL03529', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'country', 'fieldtype': 'Link', 'options': 'Country', 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'state', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'State', 'width': None, 'trigger': '', 'depends_on': '', 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00670', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'state', 'fieldtype': 'Select', 'options': '\nSelect country first', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'city', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'City', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00669', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'city', 'fieldtype': 'Select', 'options': 'link:City', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'pin', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'PIN', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00671', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': 'pin', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-04-15 10:29:34', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Repost Stock', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01913', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-04-15 10:29:34', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Repost Stock Ledger', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 2, 'description': None, 'parent': 'Warehouse', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01914', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-11-18 12:09:48', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'repost_stock', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/material_management/page/__init__.py b/material_management/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/page/__init__.py
diff --git a/material_management/search_criteria/__init__.py b/material_management/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/__init__.py
diff --git a/material_management/search_criteria/itemwise_price_list/__init__.py b/material_management/search_criteria/itemwise_price_list/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/itemwise_price_list/__init__.py
diff --git a/material_management/search_criteria/itemwise_price_list/itemwise_price_list.js b/material_management/search_criteria/itemwise_price_list/itemwise_price_list.js
new file mode 100644
index 0000000..83be08c
--- /dev/null
+++ b/material_management/search_criteria/itemwise_price_list/itemwise_price_list.js
@@ -0,0 +1,3 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Item'+FILTER_SEP +'ID'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/material_management/search_criteria/itemwise_price_list/itemwise_price_list.txt b/material_management/search_criteria/itemwise_price_list/itemwise_price_list.txt
new file mode 100644
index 0000000..6c6a2e7
--- /dev/null
+++ b/material_management/search_criteria/itemwise_price_list/itemwise_price_list.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Item\x01Item Name,Item\x01Item Group,Ref Rate Detail\x01Price List Name,Ref Rate Detail\x01Ref Rate,Ref Rate Detail\x01Currency',
+		'creation': '2010-08-20 12:20:55',
+		'criteria_name': 'Itemwise Price List',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Ref Rate Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Item\x01Saved':1,'Ref Rate Detail\x01Price List Name':'','Ref Rate Detail\x01Currency':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-20 12:15:17',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'itemwise_price_list',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Item',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabItem`.`item_name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/material_management/search_criteria/shortage_to_indent/__init__.py b/material_management/search_criteria/shortage_to_indent/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/shortage_to_indent/__init__.py
diff --git a/material_management/search_criteria/shortage_to_indent/shortage_to_indent.js b/material_management/search_criteria/shortage_to_indent/shortage_to_indent.js
new file mode 100644
index 0000000..3c0f8bf
--- /dev/null
+++ b/material_management/search_criteria/shortage_to_indent/shortage_to_indent.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+
+  this.add_filter({fieldname:'posting_date', label:'Posting Date', fieldtype:'Date', ignore : 1, parent:'Item'});
+  //this.add_filter({fieldname:'weekly_working_days', label:'Weekly Working Days', fieldtype:'Select', options:NEWLINE+1+NEWLINE+2+NEWLINE+3+NEWLINE+4+NEWLINE+5+NEWLINE+6+NEWLINE+7, ignore : 1, parent:'Item'});
+
+  this.filter_fields_dict['Item'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Item'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  //this.filter_fields_dict['Item'+FILTER_SEP +'Weekly Working Days'].df.in_first_page = 1;
+
+
+}
\ No newline at end of file
diff --git a/material_management/search_criteria/shortage_to_indent/shortage_to_indent.py b/material_management/search_criteria/shortage_to_indent/shortage_to_indent.py
new file mode 100644
index 0000000..75b3f3f
--- /dev/null
+++ b/material_management/search_criteria/shortage_to_indent/shortage_to_indent.py
@@ -0,0 +1,132 @@
+mon_list = []
+data = {'start_date':0, 'end_date':1, 'working_days': 2}
+
+def make_month_list(start_date, end_date, mon_list, colnames, coltypes, colwidths, coloptions, col_idx):
+
+  # get period between from date and to date
+
+  period_diff = sql("select PERIOD_DIFF('%s','%s')"% (('').join( end_date.split('-')[i] for i in range(len(end_date.split('-')) - 1)),('').join(start_date.split('-')[i] for i in range(len(start_date.split('-')) - 1))))
+  period_diff = period_diff and int(period_diff[0][0])
+
+  for pd in range(int(period_diff) + 1):
+    # get last date
+    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
+      
+    # get no of days in the month            
+    if not int(sql("select DATEDIFF('%s','%s')" % (end_date, last_date))[0][0]) >0:
+      last_date = end_date
+    diff = int(sql("select DATEDIFF('%s','%s')" % (last_date, start_date))[0][0]) + 1
+      
+    # make mon_list
+    mon_list.append([start_date, last_date, (diff > 26) and 26 or diff])
+           
+    # add months as Column names
+    month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
+  
+    colnames.append(str(str(month_name)[:3])+ '-'+ str(start_date[:4]))
+    coltypes.append('Currency')
+    colwidths.append('150px')
+    coloptions.append('')
+    col_idx[str(str(month_name)[:3])+ '-'+ str(start_date[:4])] = len(colnames) - 1
+
+    # get start date
+    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
+
+# Validation for 'ID' and 'Lead Time Days' Column Name
+if 'ID' not in colnames or 'Lead Time Days' not in colnames:
+  msgprint("Please select Id and Lead Time Days in 'Select Columns' tab Else Report will not be generated")
+  raise Exception
+
+# Validation for Posting Date Filters
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please select From Posting Date and To Posting Date")
+  raise Exception
+else:
+  from_date = str(filter_values.get('posting_date'))
+  to_date = str(filter_values.get('posting_date1'))
+
+
+# Call Make Month List Function
+make_month_list(from_date, to_date, mon_list, colnames, coltypes, colwidths, coloptions, col_idx)
+
+
+# Add Column names 
+col = [['Total Daily Consumption','Currency','150px','']
+      ,['MIL(Min Inv. Level)','Currency','150px','']
+      ,['ROL(Re-Order Level)','Currency','150px','']
+      ,['Actual Quantity','Currency','150px','']
+      ,['Indented Quantity','Currency','150px','']
+      ,['Ordered Quantity','Currency','150px','']
+      ,['Shortage To Indent','Currency','150px','']
+      ,['MAR','Currency','100px','']
+      ,['LPR','Currency','100px','']]
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames) - 1
+
+for r in res:
+
+  # calculate Total Daily Consumption Monthly
+  count, tot_consumption, tot_days = 0, 0, 1
+  #for idx in range(col_idx['Stock Unit of Measurement'] + 1 , col_idx['Total Daily Consumption'] ):
+  for idx in range(col_idx['Lead Time Days'] + 1 , col_idx['Total Daily Consumption'] ):
+  
+    # As Consumption Means:= Adding Qty Transfered to WIP Warehouse ++ Qty Issued directly warehouse whose waraehouse_type != WIP Warehouse and Subtracting Qty Issued from WIP Warehouse
+    #Capture item qty coming to WIP Warehouse for production purpose which means consuming that items
+    add_con = sql("select ifnull(sum(t1.actual_qty),0)  from `tabStock Ledger Entry` t1 where t1.item_code = '%s' and t1.is_cancelled = 'No'  and t1.posting_date >= '%s' and t1.posting_date <= '%s' and t1.warehouse_type = 'WIP Warehouse' and t1.actual_qty > 0 " % (r[col_idx['ID']],mon_list[count][data['start_date']],mon_list[count][data['end_date']]))
+    
+    # This is Stock Entry which is of Type Material Issue also to mention that Source Warehouse should not be WIP WArehouse
+    #Transfering items to Internal Other Warehouse but not to WIP Warehouse
+    dir_con = sql("select ifnull(sum(t1.actual_qty),0) from `tabStock Ledger Entry` t1, `tabStock Entry Detail` t2 where t1.item_code = '%s' and t1.is_cancelled = 'No' and t1.posting_date >= '%s' and t1.posting_date <= '%s' and t1.warehouse_type != 'WIP Warehouse' and t1.actual_qty < 0 and t1.voucher_type = 'Stock Entry' and t1.voucher_detail_no = t2.name and ifnull(t2.t_warehouse, '') = ''"%(r[col_idx['ID']],mon_list[count][data['start_date']],mon_list[count][data['end_date']]))
+    
+    # This is Stock Entry which is of Type MAterial TRansfer also to mention that Source Warehouse should be WIP WArhouse
+    #like, transfering items from internal warehouse to customer
+    red_con = sql("select ifnull(sum(t1.actual_qty),0) from `tabStock Ledger Entry` t1, `tabStock Entry Detail` t2 where t1.item_code = '%s' and t1.is_cancelled = 'No'  and t1.posting_date >= '%s' and t1.posting_date <= '%s' and t1.warehouse_type = 'WIP Warehouse' and t1.actual_qty < 0 and t1.voucher_type = 'Stock Entry' and t1.voucher_detail_no = t2.name and ifnull(t2.t_warehouse, '') != ''"%(r[col_idx['ID']],mon_list[count][data['start_date']],mon_list[count][data['end_date']]))
+    #msgprint(str(add_con[0][0]) + "~~~" + str(dir_con[0][0]) + "~~~" + str(red_con[0][0]))
+
+    add_con = add_con and add_con[0][0] or 0.00
+    dir_con = dir_con and ((-1) * dir_con[0][0]) or 0.00
+    red_con = red_con and red_con[0][0] or 0.00
+    tot_con = flt(add_con) + flt(dir_con) + flt(red_con)
+    #tot_con = add_con and add_con[0][0] or 0 + dir_con and (-1) * dir_con[0][0] or 0 +  red_con and red_con[0][0] or 0
+    tot_con = flt(r[col_idx['Lead Time Days']] and tot_con  or 0)
+
+
+    # monthly avg consumption
+    r.append(flt(tot_con / mon_list[count][data['working_days']]))
+
+    # calculate tot_consumption and tot_days   
+    tot_consumption = flt(tot_consumption) + flt(tot_con)
+    tot_days = (tot_days == 1) and flt(mon_list[count][data['working_days']]) or (flt(tot_days) + flt(mon_list[count][data['working_days']]))
+    count = count + 1  
+
+  # Calculate Daily Consumption
+  r.append(tot_consumption and flt(tot_consumption /tot_days) or 0)
+
+  # Calculate Minimum Inventory Level
+  r.append(flt(r[col_idx['Total Daily Consumption']]) * flt(r[col_idx['Lead Time Days']]))
+ 
+  # Calculate Re-Order Level
+  r.append(flt(r[col_idx['MIL(Min Inv. Level)']] * 2))
+
+  # get stock level
+  stock_level = sql("select sum(t1.actual_qty), sum(t1.indented_qty), sum(t1.ordered_qty) from `tabBin` t1, `tabWarehouse` t2 where t1.warehouse = t2.name and t2.warehouse_type != 'WIP Warehouse' and t1.item_code = '%s'"%(r[col_idx['ID']]))
+ 
+  r.append(stock_level and flt(stock_level[0][0]) or 0) # Actual Qty
+  r.append(stock_level and flt(stock_level[0][1]) or 0) # Indented Qty
+  r.append(stock_level and flt(stock_level[0][2]) or 0) # Ordered Qty
+  
+  # calculate shortage
+  r.append((r[col_idx['ROL(Re-Order Level)']] > 0) and flt(flt(r[col_idx['ROL(Re-Order Level)']]) - flt(r[col_idx['Actual Quantity']]) - flt(r[col_idx['Indented Quantity']]) - flt(r[col_idx['Ordered Quantity']])) or 0)
+
+  # get moving average rate
+  m_a_r = sql("select ifnull(sum(t1.ma_rate), 0)/ ifnull(count(t1.name),1) from `tabBin` t1, `tabWarehouse` t2 where t1.item_code = '%s' and ifnull(t1.ma_rate, 0) > 0 and t1.warehouse = t2.name and t2.warehouse_type != 'WIP Warehouse'" % r[col_idx['ID']])
+  r.append(m_a_r and flt(m_a_r[0][0]) or 0)
+    
+  # get recent last purchase rate 
+  lpr_rate = flt(sql("select last_purchase_rate from `tabItem` where name = '%s'" %r[col_idx['ID']])[0][0]) or 0.00
+  r.append(lpr_rate)
diff --git a/material_management/search_criteria/shortage_to_indent/shortage_to_indent.txt b/material_management/search_criteria/shortage_to_indent/shortage_to_indent.txt
new file mode 100644
index 0000000..2ac52a1
--- /dev/null
+++ b/material_management/search_criteria/shortage_to_indent/shortage_to_indent.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Item\x01ID,Item\x01Item Name,Item\x01Description,Item\x01Lead Time Days',
+		'creation': '2011-05-25 12:44:22',
+		'criteria_name': 'Shortage To Indent',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Item',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Item\x01Saved':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-18 11:52:59',
+		'modified_by': 'Guest',
+		'module': 'Material Management',
+		'name': 'shortage_to_indent',
+		'owner': 'wasim@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabItem`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_aging_report/__init__.py b/material_management/search_criteria/stock_aging_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/stock_aging_report/__init__.py
diff --git a/material_management/search_criteria/stock_aging_report/stock_aging_report.js b/material_management/search_criteria/stock_aging_report/stock_aging_report.js
new file mode 100644
index 0000000..194990a
--- /dev/null
+++ b/material_management/search_criteria/stock_aging_report/stock_aging_report.js
@@ -0,0 +1,12 @@
+report.customize_filters = function() {
+  //this.hide_all_filters();
+
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Status'].df.filter_hide = 1;
+
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'ID'].df.in_first_page = 1;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'From Purchase Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'To Purchase Date'].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/material_management/search_criteria/stock_aging_report/stock_aging_report.py b/material_management/search_criteria/stock_aging_report/stock_aging_report.py
new file mode 100644
index 0000000..42b0cc3
--- /dev/null
+++ b/material_management/search_criteria/stock_aging_report/stock_aging_report.py
@@ -0,0 +1,15 @@
+col = [['In Store Period (in days)', 'Data', '']]
+for c in col:
+  colnames.append(str(c[0]))
+  coltypes.append(str(c[1]))
+  colwidths.append('150px')
+  coloptions.append(str(c[2]))
+  col_idx[str(c)] = len(colnames) - 1
+
+import datetime
+for r in res:
+  if r[col_idx['Purchase Date']]:
+    dt = (datetime.date.today() - getdate(r[col_idx['Purchase Date']])).days
+  else:
+    dt = ''
+  r.append(dt)
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_aging_report/stock_aging_report.txt b/material_management/search_criteria/stock_aging_report/stock_aging_report.txt
new file mode 100644
index 0000000..ab5ab76
--- /dev/null
+++ b/material_management/search_criteria/stock_aging_report/stock_aging_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '',
+		'add_cond': "`tabSerial No`.status = 'In Store'",
+		'add_tab': None,
+		'columns': 'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Item Group,Serial No\x01Purchase Date',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Stock Aging Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'In Store','Serial No\x01Maintenance Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-16 13:42:24',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'stock_aging_report',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 1000,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSerial No`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_ledger/__init__.py b/material_management/search_criteria/stock_ledger/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/stock_ledger/__init__.py
diff --git a/material_management/search_criteria/stock_ledger/stock_ledger.js b/material_management/search_criteria/stock_ledger/stock_ledger.js
new file mode 100644
index 0000000..89e1dbc
--- /dev/null
+++ b/material_management/search_criteria/stock_ledger/stock_ledger.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.add_filter({fieldname:'item_name', label:'Item Name', fieldtype:'Data', options:'', parent:'Item'});
+  this.add_filter({fieldname:'description', label:'Description', fieldtype:'Small Text', options: '', parent:'Item'});
+}
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_ledger/stock_ledger.txt b/material_management/search_criteria/stock_ledger/stock_ledger.txt
new file mode 100644
index 0000000..8185138
--- /dev/null
+++ b/material_management/search_criteria/stock_ledger/stock_ledger.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '`tabItem`.`item_name`\n`tabItem`.`description`',
+		'add_cond': '`tabItem`.`name` = `tabStock Ledger Entry`.`item_code`',
+		'add_tab': '`tabItem`',
+		'columns': 'Stock Ledger Entry\x01Item Code,Stock Ledger Entry\x01Warehouse,Stock Ledger Entry\x01Posting Date,Stock Ledger Entry\x01Voucher Detail No,Stock Ledger Entry\x01Actual Quantity,Stock Ledger Entry\x01Bin Actual Qty After Transaction',
+		'creation': '2010-10-14 08:43:04',
+		'criteria_name': 'Stock Ledger',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Stock Ledger Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-14 08:31:40',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'stock_ledger',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': None,
+		'sort_order': None,
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_level/__init__.py b/material_management/search_criteria/stock_level/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/stock_level/__init__.py
diff --git a/material_management/search_criteria/stock_level/stock_level.js b/material_management/search_criteria/stock_level/stock_level.js
new file mode 100644
index 0000000..e84fe57
--- /dev/null
+++ b/material_management/search_criteria/stock_level/stock_level.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.add_filter({fieldname:'item_name', label:'Item Name', fieldtype:'Data', options:'', parent:'Item', in_first_page : 1});
+  this.add_filter({fieldname:'description', label:'Description', fieldtype:'Small Text', options: '', parent:'Item', in_first_page : 1});
+}
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_level/stock_level.py b/material_management/search_criteria/stock_level/stock_level.py
new file mode 100644
index 0000000..4aa397c
--- /dev/null
+++ b/material_management/search_criteria/stock_level/stock_level.py
@@ -0,0 +1,2 @@
+colwidths[col_idx['Reserved Quantity']]= "120px" 
+colwidths[col_idx['Ordered Quantity']] = "120px"
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_level/stock_level.txt b/material_management/search_criteria/stock_level/stock_level.txt
new file mode 100644
index 0000000..7c87ec0
--- /dev/null
+++ b/material_management/search_criteria/stock_level/stock_level.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '`tabItem`.`item_name`\n`tabItem`.`description`',
+		'add_cond': '`tabItem`.name = `tabBin`.item_code',
+		'add_tab': '`tabItem`',
+		'columns': 'Bin\x01Warehouse,Bin\x01Item Code,Bin\x01UOM,Bin\x01Reserved Quantity,Bin\x01Actual Quantity,Bin\x01Ordered Quantity,Bin\x01Planned Qty,Bin\x01Projected Qty,Bin\x01Indented Quantity,Bin\x01Valuation Rate,Bin\x01Stock Value',
+		'creation': '2010-12-14 10:33:08',
+		'criteria_name': 'Stock Level',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Bin',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': '{}',
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-20 16:51:11',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'stock_level',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabBin`.`warehouse`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_report/__init__.py b/material_management/search_criteria/stock_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/material_management/search_criteria/stock_report/__init__.py
diff --git a/material_management/search_criteria/stock_report/stock_report.js b/material_management/search_criteria/stock_report/stock_report.js
new file mode 100644
index 0000000..9304bd4
--- /dev/null
+++ b/material_management/search_criteria/stock_report/stock_report.js
@@ -0,0 +1,74 @@
+//233
+report.customize_filters = function() {
+  this.mytabs.items['Select Columns'].hide()
+  this.mytabs.items['More Filters'].hide()
+  this.hide_all_filters();
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Warehouse'+NEWLINE+'Item Code',report_default:'Warehouse',ignore : 1,parent:'Stock Ledger Entry'});
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse'].df.filter_hide = 0;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse Type'].df.filter_hide = 0;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 1;
+
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse'].df.in_first_page = 1;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Based On'].df.in_first_page = 1;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse Type'].df.in_first_page = 1;
+  this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+}
+
+
+report.get_query = function(){
+  based_on = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Based On'].get_value();
+  as_on = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'To Posting Date'].get_value();
+  warehouse = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Warehouse'].get_value();
+  warehouse_type = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Warehouse Type'].get_value();
+  item_code = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Item Code'].get_value();
+
+  cond = '';
+  date_cond = '';
+  tables = '';
+  cols = '';
+  group_by = '';
+  ware_type_cond = '';
+  war = '';
+  if(!as_on) as_on = get_today();
+
+  date_cond = repl(' AND `tabStock Ledger Entry`.posting_date <= "%(as_on)s" ', {as_on:as_on});
+
+  if(warehouse_type.length > 0 && warehouse_type != ''){
+    for(var i = 0; i<warehouse_type.length; i++) war += "'"+warehouse_type[i]+"',";
+    ware_type_cond = repl(' AND `tabWarehouse`.warehouse_type IN (%(war)s)', {war: war.substr(0,war.length-1)})
+  }
+  
+  if(based_on.length == 1){
+    if(based_on == 'Item Code'){
+      cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM"';
+      cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes"';
+      if(item_code) cond += repl(' AND `tabItem`.name = %(item)s', {item:'"'+item_code+'"'});
+      cond += ' AND `tabStock Ledger Entry`.item_code = `tabItem`.name'
+      tables = '`tabItem`';
+      group_by = '`tabStock Ledger Entry`.item_code';
+    }
+    else if(based_on == 'Warehouse'){
+      cols = '`tabWarehouse`.name AS "Warehouse", `tabWarehouse`.warehouse_type AS "Warehouse Type"';
+      cond = '`tabWarehouse`.docstatus < 2'
+      if(warehouse) cond += repl(' AND `tabWarehouse`.name = %(warehouse)s', {warehouse:'"'+warehouse+'"'});
+      cond += repl(' AND `tabStock Ledger Entry`.warehouse = `tabWarehouse`.name %(ware_type_cond)s', {ware_type_cond:ware_type_cond})
+      tables = '`tabWarehouse`';
+      group_by = '`tabStock Ledger Entry`.warehouse';
+    }
+  }
+  else if(based_on.length == 2){
+    cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM", `tabWarehouse`.name AS "Warehouse",  `tabWarehouse`.warehouse_type AS "Warehouse Type"';
+    cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes" AND `tabWarehouse`.docstatus < 2';
+    if(item_code) cond += repl(" AND `tabItem`.name = %(item)s", {item:"'"+item_code+"'"});
+    if(warehouse) cond += repl(" AND `tabWarehouse`.name = %(warehouse)s", {warehouse:"'"+warehouse+"'"});
+    cond += repl(' AND `tabStock Ledger Entry`.item_code = `tabItem`.name AND `tabStock Ledger Entry`.warehouse = `tabWarehouse`.name %(ware_type_cond)s', {ware_type_cond:ware_type_cond})
+    tables = '`tabItem`, `tabWarehouse`';
+    group_by = '`tabStock Ledger Entry`.item_code, `tabStock Ledger Entry`.warehouse';
+  }
+
+  q = repl("SELECT %(cols)s FROM %(tables)s, `tabStock Ledger Entry` WHERE %(cond)s %(date_cond)s GROUP BY %(group_by)s", {cols:cols, tables:tables, cond:cond, date_cond:date_cond, group_by:group_by});
+  return q;
+}
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_report/stock_report.py b/material_management/search_criteria/stock_report/stock_report.py
new file mode 100644
index 0000000..cb413ea
--- /dev/null
+++ b/material_management/search_criteria/stock_report/stock_report.py
@@ -0,0 +1,73 @@
+if not filter_values.get('based_on'):
+  msgprint("Please Select Based On")
+  raise Exception
+cols, columns = [], []
+# Add columns
+# ------------
+based_on = filter_values.get('based_on').split(NEWLINE)
+if len(based_on) == 1:
+  if based_on[0] == 'Item Code':
+    cols = ["Item Code", "Item Name", "Description", "Stock UOM"]
+  elif based_on[0] == 'Warehouse':
+    cols = ["Warehouse", "Warehouse Type"]
+elif len(based_on) == 2:
+  cols = ["Item Code", "Item Name", "Description", "Stock UOM", "Warehouse",  "Warehouse Type"]
+
+for d in cols:
+  columns.append([d,'Data','150px',''])
+
+columns.append(['Closing Balance','Currency','200px',''])
+columns.append(['Stock Value','Currency','150px',''])
+
+posting_date = filter_values.get('posting_date1')
+if not posting_date: posting_date = nowdate()
+
+for c in columns:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
+  
+def get_values(msgprint, flt, posting_date, item_code = '', warehouse = ''):
+  cl_bal, stock_val = 0,0
+  if item_code and not warehouse:
+    war_list = sql("select distinct warehouse from `tabStock Ledger Entry` where item_code = %s", item_code)
+    for d in war_list:
+      act = sql("select bin_aqat, stock_value from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and posting_date <= %s Order by posting_date DESC, posting_time DESC, name DESC LIMIT 1", (item_code, d[0], posting_date))
+      cl_bal += act and flt(act[0][0]) or 0.00
+      stock_val += act and flt(act[0][1]) or 0.00
+  elif warehouse and not item_code:
+    item_list = sql("select distinct item_code from `tabStock Ledger Entry` where warehouse = %s", warehouse)
+    for d in item_list:
+      act = sql("select bin_aqat, stock_value from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and posting_date <= %s Order by posting_date DESC, posting_time DESC, name DESC LIMIT 1", (d[0], warehouse, posting_date))
+      cl_bal += act and flt(act[0][0]) or 0.00
+      stock_val += act and flt(act[0][1]) or 0.00
+  return cl_bal, stock_val
+
+out=[]
+cl_bal,tot_stock = 0,0
+  
+for r in res:
+  if len(based_on) == 1:
+    if based_on[0] == 'Item Code': closing_balance, stock_value = get_values(msgprint, flt, posting_date, item_code = r[col_idx['Item Code']])
+    elif based_on[0] == 'Warehouse': closing_balance, stock_value = get_values(msgprint, flt, posting_date, warehouse = r[col_idx['Warehouse']])
+    r.append(closing_balance)
+    r.append(stock_value)
+  else:
+    det = sql("select bin_aqat, stock_value from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and posting_date <= %s Order by posting_date DESC, posting_time DESC, name DESC LIMIT 1", (r[col_idx['Item Code']], r[col_idx['Warehouse']], posting_date))
+    r.append(det and flt(det[0][0]) or 0.00)
+    r.append(det and flt(det[0][1]) or 0.00)
+  cl_bal += flt(r[col_idx['Closing Balance']])
+  tot_stock += flt(r[col_idx['Stock Value']])
+  out.append(r)
+
+# Add the totals row
+l_row = ['' for i in range(len(colnames))]
+if len(based_on) == 1 and based_on[0] == 'Warehouse':
+  l_row[col_idx['Warehouse Type']] = '<b>TOTALS</b>'
+else:
+  l_row[col_idx['Stock UOM']] = '<b>TOTALS</b>'
+l_row[col_idx['Closing Balance']] = cl_bal
+l_row[col_idx['Stock Value']] = tot_stock
+out.append(l_row)
\ No newline at end of file
diff --git a/material_management/search_criteria/stock_report/stock_report.txt b/material_management/search_criteria/stock_report/stock_report.txt
new file mode 100644
index 0000000..323214d
--- /dev/null
+++ b/material_management/search_criteria/stock_report/stock_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Stock Ledger Entry\x01ID',
+		'creation': '2010-11-02 15:37:36',
+		'criteria_name': 'Stock Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Stock Ledger Entry',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-02 15:35:12',
+		'modified_by': 'Administrator',
+		'module': 'Material Management',
+		'name': 'stock_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabStock Ledger Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/module-icons.png b/module-icons.png
new file mode 100644
index 0000000..869cb88
--- /dev/null
+++ b/module-icons.png
Binary files differ
diff --git a/my_company/Module Def/My Company/My Company.txt b/my_company/Module Def/My Company/My Company.txt
new file mode 100644
index 0000000..52b80fb
--- /dev/null
+++ b/my_company/Module Def/My Company/My Company.txt
@@ -0,0 +1,127 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:41:39',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-12-01 17:37:00',
+		'modified': '2010-12-13 11:50:27',
+		'modified_by': 'Administrator',
+		'module_desc': None,
+		'module_icon': 'chart_organisation.png',
+		'module_label': 'Members',
+		'module_name': 'My Company',
+		'module_page': 'My Company',
+		'module_seq': 2,
+		'name': 'My Company',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:46',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Forms',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': '000003090',
+		'owner': 'Administrator',
+		'parent': 'My Company',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-12-01 17:37:40',
+		'description': None,
+		'display_name': 'Social Badge',
+		'doc_name': 'Social Badge',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00279',
+		'owner': 'Administrator',
+		'parent': 'My Company',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:46',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Pages',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': '000003091',
+		'owner': 'Administrator',
+		'parent': 'My Company',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-12-01 17:37:40',
+		'description': None,
+		'display_name': 'My Company',
+		'doc_name': 'My Company',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00281',
+		'owner': 'Administrator',
+		'parent': 'My Company',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-12-13 11:49:53',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-12-13 11:50:27',
+		'modified_by': 'Administrator',
+		'name': 'MDR00075',
+		'owner': 'Administrator',
+		'parent': 'My Company',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'All'
+	}
+]
\ No newline at end of file
diff --git a/my_company/__init__.py b/my_company/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/my_company/__init__.py
diff --git a/my_company/doctype/__init__.py b/my_company/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/my_company/doctype/__init__.py
diff --git a/my_company/doctype/company_control/__init__.py b/my_company/doctype/company_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/my_company/doctype/company_control/__init__.py
diff --git a/my_company/doctype/company_control/company_control.py b/my_company/doctype/company_control/company_control.py
new file mode 100644
index 0000000..cab8e7c
--- /dev/null
+++ b/my_company/doctype/company_control/company_control.py
@@ -0,0 +1,90 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d,dl
+		
+	# All roles of Role Master
+	def get_all_roles(self):
+		r_list=sql("select name from `tabRole` where name not in ('All','Guest','Administrator','Customer','Supplier') and docstatus != 2")
+		if r_list[0][0]:
+			r_list = [x[0] for x in r_list]
+		return r_list
+		
+	# Get all permissions for given role	
+	def get_permission(self,role):
+		perm = sql("select distinct t1.`parent`, t1.`read`, t1.`write`, t1.`create`, t1.`submit`,t1.`cancel`,t1.`amend` from `tabDocPerm` t1, `tabDocType` t2 where t1.`role` ='%s' and t1.docstatus !=2 and ifnull(t1.permlevel, 0) = 0 and t1.`read` = 1 and t2.module != 'Recycle Bin' and t1.parent=t2.name " % role)
+		return perm or ''
+
+	# Get roles for given user
+	def get_user_roles(self,usr):
+		r_list=sql("select role from `tabUserRole` where parent=%s and role not in ('All','Guest')",usr)
+		if r_list:
+			return [r[0] for r in r_list]
+		else:
+			return ''
+
+	# Update roles of given user
+	def update_roles(self,arg):
+		arg = eval(arg)
+		sql("delete from `tabUserRole` where parenttype='Profile' and parent ='%s'" % (cstr(arg['usr'])))
+		role_list = arg['role_list'].split(',')
+		for r in role_list:
+			pr=Document('UserRole')
+			pr.parent = arg['usr']
+			pr.parenttype = 'Profile'
+			pr.role = r
+			pr.parentfield = 'userroles'
+			pr.save(1)
+		sql("delete from __SessionCache where user=%s", cstr(arg['usr']))
+
+	# Save profile
+	def save_profile(self,arg):
+		arg = eval(arg)
+		p = Document('Profile', session['user'])
+		for k in arg:
+			p.fields[k] = arg[k]
+		p.save()
+
+	def update_profile_image(self, fid, fname):
+		sql("update tabProfile set file_list = '%s,%s' where name='%s'" % (fname, fid, session['user']))
+		
+
+	def get_login_url(self):
+		return session['data']['login_from']
+		
+	def get_user_info(self):
+		
+		usr = sql("select count(name) from tabProfile where docstatus != 2 and name not in ('Guest','Administrator')")
+		usr = usr and usr[0][0] or 0
+	
+		ol = sql("select count(distinct t1.name) from tabProfile t1, tabSessions t2 where t1.name = t2.user and t1.name not in('Guest','Administrator') and TIMESTAMPDIFF(HOUR,t2.lastupdate,NOW()) <= 1 and t1.docstatus != 2 and t1.enabled=1")
+		ol = ol and ol[0][0] or 0
+		
+		ac = sql("select count(name) from tabProfile where enabled=1 and docstatus != 2 and name not in ('Guest', 'Administrator')")
+		ac = ac and ac[0][0] or 0
+		
+		inac = sql("select count(name) from tabProfile where (enabled=0 or enabled is null or enabled = '') and docstatus != 2 and name not in ('Guest','Administrator')")
+		inac = inac and inac[0][0] or 0
+		
+		return usr, ol, ac, inac
+		
+	def get_sm_count(self)	:
+		return sql("select count(t1.parent) from tabUserRole t1, tabProfile t2 where t1.role='System Manager' and t1.parent = t2.name and t2.enabled=1")[0][0] or 0
diff --git a/my_company/doctype/company_control/company_control.txt b/my_company/doctype/company_control/company_control.txt
new file mode 100644
index 0000000..43a62cc
--- /dev/null
+++ b/my_company/doctype/company_control/company_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-11-30 22:41:39', 'search_fields': None, 'module': 'My Company', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 43, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Company Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-17 16:25:34', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/my_company/page/__init__.py b/my_company/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/my_company/page/__init__.py
diff --git a/my_company/page/my_company/__init__.py b/my_company/page/my_company/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/my_company/page/my_company/__init__.py
diff --git a/my_company/page/my_company/my_company.comp.js b/my_company/page/my_company/my_company.comp.js
new file mode 100644
index 0000000..ca87c07
--- /dev/null
+++ b/my_company/page/my_company/my_company.comp.js
@@ -0,0 +1,118 @@
+
+pscript['onload_My Company']=function(){var wrapper=page_body.pages['My Company'];wrapper.head=new PageHeader(wrapper,'People');wrapper.body=$a(wrapper,'div','',{marginRight:'11px',marginTop:'11px'});wrapper.message=$a(wrapper.body,'div');wrapper.tab=make_table(wrapper.body,1,2,'100%',['25%','75%']);$y(wrapper.tab,{tableLayout:'fixed'})
+pscript.myc_make_toolbar(wrapper);pscript.myc_make_list(wrapper);if(pscript.is_erpnext_saas){pscript.myc_show_erpnext_message();}}
+pscript.myc_make_toolbar=function(wrapper){if(has_common(user_roles,['System Manager','Administrator'])){wrapper.head.add_button('Add User',pscript.myc_add_user)}}
+pscript.myc_show_erpnext_message=function(){var callback=function(r,rt){if(r.exc){msgprint(r.exc);return;}
+$a(wrapper.message,'div','help_box','','You have '+r.message.enabled
++' users enabled out of '+r.message.max_user
++'. Go to <a href="javascript:pscript.go_to_account_settings()">Account Settings</a> to increase the number of users');}
+$c_page('my_company','my_company','get_max_users','',callback)}
+pscript.myc_add_user=function(){var d=new wn.widgets.Dialog({title:'Add User',width:400,fields:[{fieldtype:'Data',fieldname:'user',reqd:1,label:'Email Id of the user to add'},{fieldtype:'Button',label:'Add',fieldname:'add'}]});d.make();d.fields_dict.add.input.onclick=function(){v=d.get_values();if(v){d.fields_dict.add.input.set_working();$c_page('my_company','my_company','add_user',v,function(r,rt){if(r.exc){msgprint(r.exc);return;}
+else{d.hide();pscript.myc_refresh();}})}}
+d.show();}
+pscript.myc_refresh=function(){page_body.pages['My Company'].member_list.lst.run();}
+pscript.myc_make_list=function(wrapper){wrapper.member_list=new MemberList(wrapper)}
+pscript.get_fullname=function(uid){if(uid=='Administrator')return uid;return page_body.pages['My Company'].member_list.member_items[uid].fullname;}
+MemberList=function(parent){var me=this;this.profiles={};this.member_items={};this.role_objects={};this.cur_profile=null;this.list_wrapper=$a($td(parent.tab,0,0),'div','',{marginLeft:'11px'});this.profile_wrapper=$a($td(parent.tab,0,1),'div','layout_wrapper',{marginLeft:'0px',height:'100%'});this.no_user_selected=$a(this.profile_wrapper,'div','help_box',null,'Please select a user to view profile');this.make_search();if(pscript.online_users){this.make_list();}else{$c_page('event_updates','event_updates','get_online_users','',function(r,rt){pscript.online_users=r.message;me.make_list();})}}
+MemberList.prototype.make_search=function(){var me=this;this.search_area=$a(this.list_wrapper,'div','',{textAlign:'center',padding:'8px'});this.search_inp=$a(this.search_area,'input','',{fontSize:'14px',width:'80%'});this.search_inp.set_empty=function(){this.value='Search';$fg(this,'#888');}
+this.search_inp.onfocus=function(){$fg(this,'#000');if(this.value=='Search')this.value='';}
+this.search_inp.onchange=function(){if(!this.value)this.set_empty();}
+this.search_inp.set_empty();}
+MemberList.prototype.make_list=function(){var me=this;this.lst_area=$a(this.list_wrapper,'div');this.lst=new Listing('Profiles',1);this.lst.colwidths=['100%'];this.lst.opts.cell_style={padding:'0px'}
+this.lst.get_query=function(){var c1='';if(me.search_inp.value&&me.search_inp.value!='Search'){var c1=repl(' AND (first_name LIKE "%(txt)s" OR last_name LIKE "%(txt)s" OR name LIKE "%(txt)s")',{txt:'%'+me.search_inp.value+'%'});}
+this.query=repl("SELECT distinct ifnull(name,''), ifnull(concat_ws(' ', first_name, last_name),''), ifnull(messanger_status,''), ifnull(gender,''), ifnull(file_list,''), 0, enabled from tabProfile where docstatus != 2 AND name not in ('Guest','Administrator') %(cond)s ORDER BY name asc",{cond:c1});}
+this.lst.make(this.lst_area);this.lst.show_cell=function(cell,ri,ci,d){me.member_items[d[ri][0]]=new MemberItem(cell,d[ri],me);}
+this.lst.run();}
+MemberList.prototype.show_profile=function(uid,member_item){$dh(this.no_user_selected);if(!this.profiles[uid]){if(!member_item)member_item=this.member_items[uid];this.profiles[uid]=new MemberProfile(this.profile_wrapper,uid,member_item);}
+if(this.cur_profile)
+this.cur_profile.hide();this.profiles[uid].show();this.cur_profile=this.profiles[uid];}
+MemberItem=function(parent,det,mlist){var me=this;this.det=det;this.wrapper=$a(parent,'div');this.enabled=det[6];this.tab=make_table(this.wrapper,1,2,'100%',['20%','70%'],{padding:'4px',overflow:'hidden'});$y(this.tab,{tableLayout:'fixed',borderCollapse:'collapse'})
+this.is_online=function(){for(var i=0;i<pscript.online_users.length;i++){if(det[0]==pscript.online_users[i][0])return true;}}
+this.refresh_name_link=function(){$fg(this.name_link,'#00B');if(!this.is_online())
+$fg(this.name_link,'#444');if(!this.enabled)
+$fg(this.name_link,'#777');}
+this.set_image=function(){this.img=$a($td(this.tab,0,0),'img','',{width:'41px'});set_user_img(this.img,det[0],null,(det[4]?det[4].split(NEWLINE)[0].split(',')[1]:('no_img_'+(det[3]=='Female'?'f':'m'))));}
+this.set_details=function(){this.fullname=det[1]?det[1]:det[0];var div=$a($td(this.tab,0,1),'div','',{fontWeight:'bold',padding:'2px 0px'});this.name_link=$a(div,'span','link_type');this.name_link.innerHTML=this.fullname;this.name_link.onclick=function(){mlist.show_profile(me.det[0],me);}
+if(user==det[0]){var span=$a(div,'span','',{padding:'2px',marginLeft:'3px'});span.innerHTML='(You)'}
+var div=$a($td(this.tab,0,1),'div','',{color:'#777',fontSize:'11px'});div.innerHTML=det[0];var div=$a($td(this.tab,0,1),'div');this.working_img=$a(div,'img','',{display:'none'});this.working_img.src='images/ui/button-load.gif';this.refresh_name_link();}
+this.select=function(){$(this.wrapper).addClass('my-company-member-item-selected');}
+this.deselect=function(){$(this.wrapper).removeClass('my-company-member-item-selected');}
+this.set_image();this.set_details();if(user==det[0])me.name_link.onclick();}
+MemberProfile=function(parent,uid,member_item){this.parent=parent;this.uid=uid;this.member_item=member_item;var me=this;this.make=function(){this.wrapper=$a(this.parent,'div','',{display:'none'});this.tab=make_table(this.wrapper,3,2,'100%',['120px',null],{padding:'3px'});$y(this.tab,{tableLayout:'fixed'});this.make_image_and_bio();this.make_toolbar();this.make_message_list();}
+this.make_image_and_bio=function(){var rh=$td(this.tab,0,1);this.img=$a($td(this.tab,0,0),'img','',{width:'80px',marginLeft:'10px'});set_user_img(this.img,this.uid);this.name_area=$a(rh,'div','my-company-name-head');var div=$a(rh,'div','my-company-email');this.email_area=$a(div,'span');this.online_status_area=$a(div,'span','my-company-online-status');this.bio_area=$a(rh,'div','my-company-bio');this.toolbar_area=$a(rh,'div','my-company-toolbar');this.status_span=$a(this.toolbar_area,'span','',{marginRight:'7px'});}
+this.make_toolbar=function(){if(has_common(['Administrator','System Manager'],user_roles)){var roles_btn=$btn(this.toolbar_area,'Set Roles',function(){me.show_roles()},{marginRight:'3px'});var delete_btn=$btn(this.toolbar_area,'Delete User',function(){me.delete_user();},{marginRight:'3px'});}}
+this.show_roles=function(){if(!this.role_object)
+this.role_object=new RoleObj(this.uid);this.role_object.dialog.show();}
+this.delete_user=function(){var cp=locals['Control Panel']['Control Panel'];var d=new Dialog(400,200,'Delete User');d.make_body([['HTML','','Do you really want to remove '+this.uid+' from system?'],['Button','Delete']]);d.onshow=function(){this.clear_inputs();}
+d.widgets['Delete'].onclick=function(){this.set_working();var callback=function(r,rt){d.hide();if(r.exc){msgprint(r.exc);return;}
+pscript.myc_refresh()
+msgprint("User Deleted Successfully");}
+$c_page('my_company','my_company','delete_user',{'user':me.uid},callback);}
+d.show();}
+this.set_enable_button=function(){var me=this;var act=this.profile.enabled?'Disable':'Enable';if(this.status_button){this.status_button.innerHTML=act;}else{this.status_button=$btn(this.toolbar_area,act,function(){var callback=function(r,rt){locals['Profile'][me.profile.name].enabled=cint(r.message);me.status_button.done_working();me.refresh_enable_disable();}
+this.set_working();$c_page('my_company','my_company',this.innerHTML.toLowerCase()+'_profile',me.profile.name,callback);},null,null,1);}
+if(this.uid==user)$dh(this.status_button);else $di(this.status_button);}
+this.render=function(){this.profile=locals['Profile'][uid];scroll(0,0);if(cstr(this.profile.first_name)||cstr(this.profile.last_name)){this.fullname=cstr(this.profile.first_name)+' '+cstr(this.profile.last_name);}else{this.fullname=this.profile.name;}
+this.name_area.innerHTML=this.fullname;this.email_area.innerHTML=this.profile.name;this.online_status_area.innerHTML=(this.member_item.is_online()?'(Online)':'(Offline)')
+if(this.member_item.is_online()){$y(this.online_status_area,{color:'green'});}
+this.refresh_enable_disable();this.bio_area.innerHTML=this.profile.designation?('Designation: '+cstr(this.profile.designation)+'<br>'):'';this.bio_area.innerHTML+=this.profile.bio?this.profile.bio:'No bio';new MemberConversation(this.wrapper,this.profile.name,this.fullname);}
+this.refresh_enable_disable=function(){this.profile=locals['Profile'][this.uid]
+if(!this.profile.enabled){$fg(this.name_area,'#999');}else{$fg(this.name_area,'#000');}
+this.member_item.enabled=this.profile.enabled;this.member_item.refresh_name_link();this.status_span.innerHTML=this.profile.enabled?'Enabled':'Disabled';if(has_common(['Administrator','System Manager'],user_roles)){this.set_enable_button();}}
+this.load=function(){if(locals['Profile']&&locals['Profile'][uid]){this.render();return;}
+var callback=function(r,rt){$dh(me.member_item.working_img);$ds(me.wrapper);me.loading=0;me.render();}
+$ds(this.member_item.working_img);$dh(this.wrapper);this.loading=1;$c('webnotes.widgets.form.getdoc',{'name':this.uid,'doctype':'Profile','user':user},callback);}
+this.show=function(){if(!this.loading)$ds(this.wrapper);this.member_item.select();}
+this.hide=function(){$dh(this.wrapper);this.member_item.deselect();}
+this.make_message_list=function(){}
+this.make();this.load();}
+MemberConversation=function(parent,uid,fullname){var me=this;this.wrapper=$a(parent,'div','my-company-conversation');this.fullname=fullname;this.make=function(){if(user!=uid){this.make_input();}
+this.make_list();if(user==uid){$c_page('my_company','my_company','set_read_all_messages','',function(r,rt){});}}
+this.make_input=function(){this.input_wrapper=$a(this.wrapper,'div','my-company-input-wrapper');var tab=make_table(this.input_wrapper,1,2,'100%',['64%','36%'],{padding:'3px'})
+this.input=$a($td(tab,0,0),'textarea');$(this.input).add_default_text('Send a message to '+fullname);var div=$a(this.input_wrapper,'div');this.post=$btn(div,'Post'.bold(),function(){me.post_message();},{margin:'0px 13px 0px 3px'})
+this.post.set_disabled();this.input.onkeyup=this.input.onchange=function(){if(this.value){me.post.set_enabled();}else{me.post.set_disabled();}}
+this.notify_check=$a_input(div,'checkbox',null);$a(div,'span','',{marginLeft:'3px'},'Notify '+fullname+' by email')}
+this.post_message=function(){if(me.input.value==$(me.input).attr('default_text')){msgprint('Please write a message first!');return;}
+this.post.set_working();$c_page('my_company','my_company','post_comment',{uid:uid,comment:$(me.input).val(),notify:me.notify_check.checked?1:0},function(r,rt){$(me.input).val("").blur();me.post.done_working();if(r.exc){msgprint(r.exc);return;}
+me.notify_check.checked=false;me.refresh();})}
+this.make_list=function(){this.lst_area=$a(this.wrapper,'div','my-company-conversation',{padding:'7px 13px'});if(user==uid){this.my_messages_box=$a(this.lst_area,'div','my-company-conversation-head',{marginBottom:'7px'},'Messages by everyone to me<br>To send a message, click on the user on the left')}
+this.lst=new wn.widgets.Listing({parent:this.lst_area,no_result_message:(user==uid?'No messages by anyone yet':'No messages yet. To start a conversation post a new message'),get_query:function(){if(uid==user){return repl("SELECT comment, owner, comment_docname, creation, docstatus "+"FROM `tabComment Widget Record` "+"WHERE comment_doctype='My Company' "+"AND comment_docname='%(user)s' "+"ORDER BY creation DESC ",{user:user});}else{return repl("SELECT comment, owner, comment_docname, creation, docstatus "+"FROM `tabComment Widget Record` "+"WHERE comment_doctype='My Company' "+"AND ((owner='%(user)s' AND comment_docname='%(uid)s') "+"OR (owner='%(uid)s' AND comment_docname='%(user)s')) "+"ORDER BY creation DESC ",{uid:uid,user:user});}},render_row:function(parent,data){new MemberCoversationComment(parent,data,me);},})
+this.refresh();}
+this.refresh=function(){me.lst.run()}
+this.make();}
+MemberCoversationComment=function(cell,det,conv){var me=this;this.det=det;this.wrapper=$a(cell,'div','my-company-comment-wrapper');this.comment=$a(this.wrapper,'div','my-company-comment');this.user=$a(this.comment,'span','link_type',{fontWeight:'bold'},pscript.get_fullname(det[1]));this.user.onclick=function(){page_body.pages['My Company'].member_list.show_profile(me.det[1]);}
+var st=(!det[4]?{fontWeight:'bold'}:null);this.msg=$a(this.comment,'span','social',st,': '+det[0]);if(det[1]==user){$y(this.wrapper,{backgroundColor:'#D9D9F3'});}
+this.timestamp=$a(this.wrapper,'div','my-company-timestamp','',comment_when(det[3]));}
+pscript.all_roles=null;RoleObj=function(profile_id){this.roles_dict={};this.profile_id=profile_id;this.setup_done=0;var d=new Dialog(500,500,'Assign Roles');d.make_body([['HTML','roles']]);this.dialog=d;this.make_role_body(profile_id);this.make_help_body();this.body.innerHTML='<span style="color:#888">Loading...</span> <img src="images/ui/button-load.gif">'
+var me=this;d.onshow=function(){if(!me.setup_done)
+me.get_all_roles(me.profile_id);}}
+RoleObj.prototype.make_role_body=function(id){var me=this;var d=this.dialog;this.role_div=$a(d.widgets['roles'],'div');this.head=$a(this.role_div,'div','',{marginLeft:'4px',marginBottom:'4px',fontWeight:'bold'});this.body=$a(this.role_div,'div');this.footer=$a(this.role_div,'div');this.update_btn=$btn(this.footer,'Update',function(){me.update_roles(me.profile_id);},{marginRight:'4px'},'',1);}
+RoleObj.prototype.make_help_body=function(){var me=this;var d=this.dialog;this.help_div=$a(d.widgets['roles'],'div');var head=$a(this.help_div,'div');this.help_div.head=head;var body=$a(this.help_div,'div');this.help_div.body=body;var tail=$a(this.help_div,'div');this.help_div.tail=tail;var back_btn=$btn(tail,'Back',function(){$(me.role_div).slideToggle('medium');$(me.help_div).slideToggle('medium');});this.help_div.back_btn=back_btn;$dh(this.help_div);}
+RoleObj.prototype.get_all_roles=function(id){if(pscript.all_roles){this.make_roles(id);return;}
+var me=this;var callback=function(r,rt){pscript.all_roles=r.message;me.make_roles(id);}
+$c_obj('Company Control','get_all_roles','',callback);}
+RoleObj.prototype.make_roles=function(id){var me=this;var list=pscript.all_roles;me.setup_done=1;me.body.innerHTML='';var tbl=make_table(me.body,cint(list.length/2)+1,4,'100%',['5%','45%','5%','45%'],{padding:'4px'});var in_right=0;var ridx=0;for(i=0;i<list.length;i++){var cidx=in_right*2;me.make_checkbox(tbl,ridx,cidx,list[i]);me.make_label(tbl,ridx,cidx+1,list[i]);if(in_right){in_right=0;ridx++}else in_right=1;}
+me.get_user_roles(id);}
+RoleObj.prototype.make_checkbox=function(tbl,ridx,cidx,role){var me=this;var a=$a_input($a($td(tbl,ridx,cidx),'div'),'checkbox');a.role=role;me.roles_dict[role]=a;$y(a,{width:'20px'});$y($td(tbl,ridx,cidx),{textAlign:'right'});}
+RoleObj.prototype.make_label=function(tbl,ridx,cidx,role){var me=this;var t=make_table($td(tbl,ridx,cidx),1,2,null,['16px',null],{marginRight:'5px'});var ic=$a($td(t,0,0),'img','',{cursor:'pointer',marginRight:'5px'});ic.src='images/icons/help.gif';ic.role=role;ic.onclick=function(){me.get_permissions(this.role);}
+$td(t,0,1).innerHTML=role;}
+RoleObj.prototype.get_user_roles=function(id){var me=this;me.head.innerHTML='Roles for '+id;$ds(me.role_div);$dh(me.help_div);var callback=function(r,rt){me.set_user_roles(r.message);}
+$c_obj('Company Control','get_user_roles',id,callback);}
+RoleObj.prototype.set_user_roles=function(list){var me=this;for(d in me.roles_dict){me.roles_dict[d].checked=0;}
+for(l=0;l<list.length;l++){me.roles_dict[list[l]].checked=1;}}
+RoleObj.prototype.update_roles=function(id){var me=this;if(id==user&&has_common(['System Manager'],user_roles)&&!me.roles_dict['System Manager'].checked){var callback=function(r,rt){if(r.message){if(r.message>1){var c=confirm("You have unchecked the System Manager role.\nYou will lose administrative rights and will not be able to set roles.\n\nDo you want to continue anyway?");if(!c)return;}
+else{var c="There should be atleast one user with System Manager role.";me.roles_dict['System Manager'].checked=1;}}
+me.set_roles(id);}
+$c_obj('Company Control','get_sm_count','',callback);}
+else{me.set_roles(id);}}
+RoleObj.prototype.set_roles=function(id){var me=this;var role_list=[];for(d in me.roles_dict){if(me.roles_dict[d].checked){role_list.push(d);}}
+var callback=function(r,rt){me.update_btn.done_working();me.dialog.hide();}
+var arg={'usr':id,'role_list':role_list};me.update_btn.set_working();$c_obj('Company Control','update_roles',docstring(arg),callback);}
+RoleObj.prototype.get_permissions=function(role){var me=this;var callback=function(r,rt){$(me.help_div).slideToggle('medium');$(me.role_div).slideToggle('medium');me.set_permissions(r.message,role);}
+$c_obj('Company Control','get_permission',role,callback);}
+RoleObj.prototype.set_permissions=function(perm,role){var me=this;me.help_div.body.innerHTML='';if(perm){me.help_div.head.innerHTML='Permissions for '+role+':<br><br>';perm_tbl=make_table(me.help_div.body,cint(perm.length)+2,7,'100%',['30%','10%','10%','10%','10%','10%','10%'],{padding:'4px'});var head_lst=['Document','Read','Write','Create','Submit','Cancel','Amend'];for(var i=0;i<(head_lst.length-1);i++){$td(perm_tbl,0,i).innerHTML="<b>"+head_lst[i]+"</b>";}
+var accept_img1='images/icons/accept.gif';var cancel_img1='images/icons/cancel.gif';for(i=1;i<perm.length+1;i++){$td(perm_tbl,i,0).innerHTML=get_doctype_label(perm[i-1][0]);for(var j=1;j<(head_lst.length-1);j++){if(perm[i-1][j]){var accept_img=$a($td(perm_tbl,i,j),'img');accept_img.src=accept_img1;}
+else{var cancel_img=$a($td(perm_tbl,i,j),'img');cancel_img.src=cancel_img1;}
+$y($td(perm_tbl,i,j),{textAlign:'center'});}}}
+else
+me.help_div.head.innerHTML='No Permission set for '+role+'.<br><br>';}
\ No newline at end of file
diff --git a/my_company/page/my_company/my_company.css b/my_company/page/my_company/my_company.css
new file mode 100644
index 0000000..d2d9a66
--- /dev/null
+++ b/my_company/page/my_company/my_company.css
@@ -0,0 +1,82 @@
+/* item */
+
+div.my-company-member-item-selected {
+	background-color: #BBC;
+}
+
+
+
+/* profile */
+.my-company-name-head {
+	font-size: 14px;
+	font-weight: bold;
+	margin-bottom: 7px;
+}
+
+.my-company-email {
+	margin-bottom: 7px;
+	color: #888;
+}
+
+.my-company-online-status {
+	font-weight: bold;
+	margin-left: 7px;
+}
+
+.my-company-status {
+	margin-bottom: 7px;	
+	color: #888;
+	font-style: italics;
+}
+
+.my-company-bio {
+	margin-bottom: 7px;	
+}
+
+.my-company-toolbar {
+	margin: 7px 0px;	
+}
+
+/* conversation */
+
+.my-company-input-wrapper {
+	color: #555;
+	padding: 13px;
+}
+
+.my-company-input-wrapper td {
+	vertical-align: bottom;
+}
+
+.my-company-input-wrapper textarea {
+	height: 3em;
+	font-size: 14px;
+	width: 100%;
+	margin: 7px 0px 3px 0px;
+}
+
+.my-company-input-wrapper button {
+	margin: 0px;
+}
+
+.my-company-conversation {
+	border-top: 1px solid #DDD;
+}
+.my-company-comment-wrapper {
+	padding: 7px;
+	border-bottom: 1px solid #DDD;
+}
+
+.my-company-timestamp {
+	color: #888;
+	font-size: 11px;
+	margin: 3px;
+}
+
+.my-company-conversation-head {
+	padding: 3px;
+	background-color: #DEDEDE;
+	color: #555;
+	font-size: 14px;
+	text-align: center;
+}
\ No newline at end of file
diff --git a/my_company/page/my_company/my_company.html b/my_company/page/my_company/my_company.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/my_company/page/my_company/my_company.html
diff --git a/my_company/page/my_company/my_company.js b/my_company/page/my_company/my_company.js
new file mode 100644
index 0000000..ea43604
--- /dev/null
+++ b/my_company/page/my_company/my_company.js
@@ -0,0 +1,842 @@
+pscript['onload_My Company'] = function() {
+	var wrapper = page_body.pages['My Company'];
+	
+	// body
+	wrapper.head = new PageHeader(wrapper, 'People');
+	wrapper.body = $a(wrapper, 'div', '', {marginRight:'11px', marginTop:'11px'});
+	
+	wrapper.message = $a(wrapper.body, 'div');
+	wrapper.tab = make_table(wrapper.body, 1, 2, '100%', ['25%','75%']);
+	
+	$y(wrapper.tab, {tableLayout:'fixed'})
+	
+	pscript.myc_make_toolbar(wrapper);
+	pscript.myc_make_list(wrapper);
+	
+	if(pscript.is_erpnext_saas) {
+		pscript.myc_show_erpnext_message();
+	}
+}
+
+pscript.myc_make_toolbar = function(wrapper) {
+	if(has_common(user_roles, ['System Manager', 'Administrator'])) {
+		wrapper.head.add_button('Add User', pscript.myc_add_user)	
+	}
+}
+
+//
+// Only for erpnext product - show max users allowed
+//
+pscript.myc_show_erpnext_message = function() {
+	var callback = function(r, rt) {
+		if(r.exc) {msgprint(r.exc); return;}
+		$a(wrapper.message, 'div', 'help_box', '', 'You have ' + r.message.enabled 
+		+ ' users enabled out of ' + r.message.max_user 
+		+ '. Go to <a href="javascript:pscript.go_to_account_settings()">Account Settings</a> to increase the number of users');
+	}
+	$c_page('my_company', 'my_company', 'get_max_users', '', callback)
+}
+
+//
+// Add user dialog and server call
+//
+pscript.myc_add_user = function() {
+	var d = new wn.widgets.Dialog({
+		title: 'Add User',
+		width: 400,
+		fields: [
+			{fieldtype:'Data', fieldname:'user',reqd:1,label:'Email Id of the user to add'},
+			{fieldtype:'Button', label:'Add', fieldname:'add'}
+		]
+	});
+	d.make();
+	d.fields_dict.add.input.onclick = function() {
+		v = d.get_values();
+		if(v) {
+			d.fields_dict.add.input.set_working();
+			$c_page('my_company', 'my_company', 'add_user', v, function(r,rt) {
+				if(r.exc) { msgprint(r.exc); return; }
+				else {
+					d.hide();
+					pscript.myc_refresh();
+				}
+			})
+		}
+	}
+	d.show();
+}
+
+pscript.myc_refresh = function() {
+	page_body.pages['My Company'].member_list.lst.run();	
+}
+
+pscript.myc_make_list= function(wrapper) {
+	wrapper.member_list = new MemberList(wrapper)
+}
+
+pscript.get_fullname=function(uid) {
+	if(uid=='Administrator') return uid;
+	return page_body.pages['My Company'].member_list.member_items[uid].fullname;		
+}
+
+
+
+//=============================================
+
+MemberList = function(parent) {
+	var me = this;
+	this.profiles = {};
+	this.member_items = {};
+	this.role_objects = {};
+	this.cur_profile = null;
+	
+	this.list_wrapper = $a($td(parent.tab,0,0), 'div', '', {marginLeft:'11px'});
+	this.profile_wrapper = $a($td(parent.tab,0,1), 'div', 'layout_wrapper', {marginLeft:'0px', height:'100%'});
+	
+	this.no_user_selected = $a(this.profile_wrapper, 'div', 'help_box', null, 'Please select a user to view profile');
+	
+	this.make_search();
+	if(pscript.online_users) {
+		this.make_list();		
+	} else {
+		$c_page('event_updates', 'event_updates', 'get_online_users', '', function(r,rt) {
+			pscript.online_users = r.message;
+			me.make_list();
+		})
+	}
+}
+
+// ----------------------
+
+MemberList.prototype.make_search = function() {
+	var me = this;
+	this.search_area = $a(this.list_wrapper, 'div', '', {textAlign:'center', padding:'8px'});
+	this.search_inp = $a(this.search_area, 'input', '', {fontSize:'14px', width:'80%'});
+	this.search_inp.set_empty = function() {
+		this.value = 'Search'; $fg(this,'#888');
+	}
+	this.search_inp.onfocus = function() {
+		$fg(this,'#000');
+		if(this.value=='Search')this.value = '';
+	}
+	this.search_inp.onchange = function() {
+		if(!this.value) this.set_empty();
+	}
+	this.search_inp.set_empty();
+}
+
+// ----------------------
+
+MemberList.prototype.make_list = function() {
+	var me = this;
+	this.lst_area = $a(this.list_wrapper, 'div');
+	this.lst = new Listing('Profiles',1);
+	this.lst.colwidths = ['100%'];
+	this.lst.opts.cell_style = {padding:'0px'}
+	this.lst.get_query = function() {
+		var c1 = '';
+		if(me.search_inp.value && me.search_inp.value != 'Search') {
+			var c1 = repl(' AND (first_name LIKE "%(txt)s" OR last_name LIKE "%(txt)s" OR name LIKE "%(txt)s")', {txt:'%' + me.search_inp.value + '%'});
+		}
+		
+		this.query = repl("SELECT distinct ifnull(name,''), ifnull(concat_ws(' ', first_name, last_name),''), ifnull(messanger_status,''), ifnull(gender,''), ifnull(file_list,''), 0, enabled from tabProfile where docstatus != 2 AND name not in ('Guest','Administrator') %(cond)s ORDER BY name asc",{cond:c1});
+	}
+	this.lst.make(this.lst_area);
+	this.lst.show_cell= function(cell, ri, ci, d) {
+		me.member_items[d[ri][0]] = new MemberItem(cell, d[ri], me);
+	}
+	this.lst.run();
+}
+
+
+/*
+Create / show profile
+*/
+MemberList.prototype.show_profile = function(uid, member_item) {
+	$dh(this.no_user_selected);
+
+	// if not exists, create
+	if(!this.profiles[uid]) {
+		if(!member_item) member_item = this.member_items[uid];
+		this.profiles[uid] = new MemberProfile(this.profile_wrapper, uid, member_item);		
+	}
+
+	// hide current
+	if(this.cur_profile)
+		this.cur_profile.hide();
+	
+	// show this
+	this.profiles[uid].show();
+	this.cur_profile = this.profiles[uid];
+}
+
+
+// Member Item
+// List item of all profiles
+// on the left hand sidebar of the page
+
+MemberItem = function(parent, det, mlist) {
+	var me = this;
+	this.det = det;
+	this.wrapper = $a(parent, 'div');
+	this.enabled = det[6];
+	
+	this.tab = make_table(this.wrapper, 1,2,'100%', ['20%', '70%'], {padding:'4px', overflow:'hidden'});
+	$y(this.tab, {tableLayout:'fixed', borderCollapse:'collapse'})
+	
+	this.is_online = function() {
+		for(var i=0;i<pscript.online_users.length;i++) {
+			if(det[0]==pscript.online_users[i][0]) return true;
+		}
+	}
+	
+	this.refresh_name_link = function() {
+		// online / offline
+		$fg(this.name_link,'#00B'); 
+		if(!this.is_online())
+			$fg(this.name_link,'#444');
+		if(!this.enabled)
+			$fg(this.name_link,'#777'); 
+
+	}
+	
+	this.set_image = function() {
+		// image
+		this.img = $a($td(this.tab,0,0),'img','',{width:'41px'});
+		set_user_img(this.img, det[0], null, 
+			(det[4] ? det[4].split(NEWLINE)[0].split(',')[1] : ('no_img_' + (det[3]=='Female' ? 'f' : 'm'))));		
+	}
+	
+	// set other details like email id, name etc
+	this.set_details = function() {
+		// name
+		this.fullname = det[1] ? det[1] : det[0];
+		var div = $a($td(this.tab, 0, 1), 'div', '', {fontWeight: 'bold',padding:'2px 0px'});
+		this.name_link = $a(div,'span','link_type');
+		this.name_link.innerHTML = this.fullname;
+		this.name_link.onclick = function() {
+			mlist.show_profile(me.det[0], me);
+		}
+
+		// "you" tag
+		if(user==det[0]) {
+			var span = $a(div,'span','',{padding:'2px' ,marginLeft:'3px'});
+			span.innerHTML = '(You)'
+		}
+
+		// email id
+		var div = $a($td(this.tab, 0, 1), 'div', '', {color: '#777', fontSize:'11px'});
+		div.innerHTML = det[0];
+
+		// working img
+		var div = $a($td(this.tab, 0, 1), 'div');
+		this.working_img = $a(div,'img','',{display:'none'}); 
+		this.working_img.src = 'images/ui/button-load.gif';
+		
+		this.refresh_name_link();
+		
+	}
+	
+	this.select = function() {
+		$(this.wrapper).addClass('my-company-member-item-selected');
+	}
+
+	this.deselect = function() {
+		$(this.wrapper).removeClass('my-company-member-item-selected');		
+	}
+	
+	this.set_image();
+	this.set_details();
+	
+	// show initial
+	if(user==det[0]) me.name_link.onclick();
+}
+
+
+//
+// Member Profile
+// shows profile with Photo and conversation
+//
+MemberProfile = function(parent, uid, member_item) {
+	this.parent = parent;
+	this.uid = uid;
+	this.member_item = member_item;
+	var me = this;
+
+	// make the UI 
+	this.make = function() {
+		this.wrapper = $a(this.parent, 'div', '', {display:'none'});
+		this.tab = make_table(this.wrapper, 3, 2,'100%',['120px',null],{padding:'3px'});
+		$y(this.tab, {tableLayout: 'fixed'});
+		
+		this.make_image_and_bio();
+		this.make_toolbar();
+		this.make_message_list();
+	}
+	
+	// create elements
+	this.make_image_and_bio = function() {
+		var rh = $td(this.tab, 0, 1);
+		
+		// image
+		this.img = $a($td(this.tab, 0, 0), 'img','',{width:'80px', marginLeft:'10px'});
+		set_user_img(this.img, this.uid);
+
+		// details
+		this.name_area = $a(rh, 'div' , 'my-company-name-head');
+		var div = $a(rh, 'div', 'my-company-email');
+		this.email_area = $a(div, 'span');
+		this.online_status_area = $a(div, 'span', 'my-company-online-status');
+		this.bio_area = $a(rh, 'div', 'my-company-bio');	
+		this.toolbar_area = $a(rh, 'div', 'my-company-toolbar');	
+		this.status_span = $a(this.toolbar_area, 'span', '', {marginRight:'7px'});
+		
+	}
+	
+	// the toolbar
+	this.make_toolbar = function() {
+		if(has_common(['Administrator','System Manager'],user_roles)) {
+			var roles_btn = $btn(this.toolbar_area, 'Set Roles', function() { me.show_roles() },{marginRight:'3px'});
+			var delete_btn = $btn(this.toolbar_area, 'Delete User', function() { me.delete_user(); },{marginRight:'3px'});
+		}
+	}
+	
+	// create the role object
+	this.show_roles = function() {
+		if(!this.role_object)
+			this.role_object = new RoleObj(this.uid);
+		this.role_object.dialog.show();
+	}
+	
+	// delete user
+	// create a confirm dialog and call server method
+	this.delete_user = function() {
+		var cp = locals['Control Panel']['Control Panel'];
+
+		var d = new Dialog(400,200,'Delete User');
+		d.make_body([
+			['HTML','','Do you really want to remove '+this.uid+' from system?'],['Button','Delete']
+		]);
+		d.onshow = function() {
+			this.clear_inputs();
+		}
+
+		d.widgets['Delete'].onclick = function() {
+			this.set_working();
+
+			var callback = function(r,rt) {
+				d.hide();
+				if(r.exc) {
+					msgprint(r.exc);
+					return;
+				}
+				pscript.myc_refresh()
+				msgprint("User Deleted Successfully");
+			}
+			$c_page('my_company', 'my_company', 'delete_user', {'user': me.uid}, callback);
+		}
+		d.show();
+	}
+
+	// set enabled
+	this.set_enable_button = function() {
+		var me = this;
+		var act = this.profile.enabled ? 'Disable' : 'Enable';
+
+		if(this.status_button) {
+			this.status_button.innerHTML = act;	
+		} else {	
+			// make the button
+			this.status_button = $btn(this.toolbar_area, act, function() {
+				var callback = function(r,rt) {
+					locals['Profile'][me.profile.name].enabled = cint(r.message);
+					me.status_button.done_working();
+					me.refresh_enable_disable();
+				}
+				this.set_working();
+				$c_page('my_company','my_company', this.innerHTML.toLowerCase()+'_profile',me.profile.name, callback);
+			}, null, null, 1);
+		}
+		if(this.uid==user) $dh(this.status_button); else $di(this.status_button);
+	}
+	
+	// render the details of the user from Profile
+	this.render = function() {
+		this.profile = locals['Profile'][uid];
+		scroll(0, 0);
+
+		// name
+		if(cstr(this.profile.first_name) || cstr(this.profile.last_name)) {
+			this.fullname = cstr(this.profile.first_name) + ' ' + cstr(this.profile.last_name);
+		} else {
+			this.fullname = this.profile.name;
+		}
+		this.name_area.innerHTML = this.fullname;
+		
+		// email
+		this.email_area.innerHTML = this.profile.name;
+
+		// online / offline
+		this.online_status_area.innerHTML = (this.member_item.is_online() ? '(Online)' : '(Offline)')
+		if(this.member_item.is_online()) {
+			$y(this.online_status_area, {color:'green'});
+		}
+
+		// refresh enable / disabled
+		this.refresh_enable_disable();
+
+		// designation
+		this.bio_area.innerHTML = this.profile.designation ? ('Designation: ' + cstr(this.profile.designation) + '<br>') : '';
+		this.bio_area.innerHTML += this.profile.bio ? this.profile.bio : 'No bio';
+		
+		new MemberConversation(this.wrapper, this.profile.name, this.fullname);
+	}
+	
+	// refresh enable / disable
+	this.refresh_enable_disable = function() {
+		this.profile = locals['Profile'][this.uid]
+
+		if(!this.profile.enabled) {
+			$fg(this.name_area,'#999');
+		} else {
+			$fg(this.name_area,'#000');
+		}
+
+		this.member_item.enabled = this.profile.enabled;
+		this.member_item.refresh_name_link();
+		
+		this.status_span.innerHTML = this.profile.enabled ? 'Enabled' : 'Disabled';
+
+		// set styles and buttons
+		if(has_common(['Administrator','System Manager'],user_roles)) {
+			this.set_enable_button();
+		}		
+	}
+	
+	// Load user profile (if not loaded)
+	this.load = function() {
+		if(locals['Profile'] && locals['Profile'][uid]) {
+			this.render();
+			return;
+		}
+		var callback = function(r,rt) {
+			$dh(me.member_item.working_img);
+			$ds(me.wrapper);
+			me.loading = 0;
+			me.render();
+		}
+		$ds(this.member_item.working_img);
+		$dh(this.wrapper);
+		this.loading = 1;
+		$c('webnotes.widgets.form.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback);	// onload		
+	}
+	
+	// show / hide
+	this.show = function() {
+		if(!this.loading)$ds(this.wrapper);
+
+		// select profile
+		this.member_item.select();
+	}
+	this.hide = function() {
+		$dh(this.wrapper);
+
+		// select profile
+		this.member_item.deselect();
+	}
+	
+	this.make_message_list = function() {
+		
+	}
+	
+	this.make();
+	this.load();
+}
+
+
+
+
+// Member conversation
+// Between the current user and the displayed profile
+// or if same, then the conversation with all other
+// profiles
+MemberConversation = function(parent, uid, fullname) {
+	var me = this;
+	this.wrapper = $a(parent, 'div', 'my-company-conversation');
+	this.fullname = fullname;
+	this.make = function() {
+		if(user!=uid) {
+			this.make_input();			
+		}
+		this.make_list();
+		
+		// set all messages
+		// as "read" (docstatus = 0)
+		if(user==uid) {
+			$c_page('my_company', 'my_company', 'set_read_all_messages', '', function(r,rt) { });	
+		}
+	}
+	
+	this.make_input = function() {
+		this.input_wrapper = $a(this.wrapper, 'div', 'my-company-input-wrapper');
+		var tab = make_table(this.input_wrapper, 1, 2, '100%', ['64%','36%'], {padding: '3px'})
+		this.input = $a($td(tab,0,0), 'textarea');
+		$(this.input).add_default_text( 'Send a message to ' + fullname);
+
+		// button
+		var div = $a(this.input_wrapper, 'div');
+		this.post = $btn(div, 'Post'.bold(), function() { me.post_message(); }, {margin:'0px 13px 0px 3px'})
+		this.post.set_disabled();
+		this.input.onkeyup = this.input.onchange = function() {
+			if(this.value) {
+				me.post.set_enabled();
+			} else {
+				me.post.set_disabled();
+			}
+		}
+
+		// notification check
+		this.notify_check = $a_input(div, 'checkbox', null);
+		$a(div, 'span', '', {marginLeft:'3px'}, 'Notify ' + fullname + ' by email')
+	}
+	
+	this.post_message = function() {
+		if(me.input.value==$(me.input).attr('default_text')) {
+			msgprint('Please write a message first!'); return;
+		}
+		this.post.set_working();
+		$c_page('my_company', 'my_company', 'post_comment', {
+			uid: uid,
+			comment: $(me.input).val(),
+			notify: me.notify_check.checked ? 1 : 0
+		}, function(r,rt) {
+			$(me.input).val("").blur();
+			me.post.done_working();
+			if(r.exc) { msgprint(r.exc); return; }
+			me.notify_check.checked = false;
+			me.refresh();
+		})
+	}
+	
+	this.make_list = function() {
+		this.lst_area = $a(this.wrapper, 'div', 'my-company-conversation', {padding:'7px 13px'});
+
+		if(user==uid) {
+			this.my_messages_box = $a(this.lst_area, 'div', 'my-company-conversation-head', {marginBottom:'7px'}, 'Messages by everyone to me<br>To send a message, click on the user on the left')
+		}
+		
+		this.lst = new wn.widgets.Listing({
+			parent: this.lst_area,
+			no_result_message: (user==uid 
+				? 'No messages by anyone yet' 
+				: 'No messages yet. To start a conversation post a new message'),
+
+			get_query: function() {
+				if(uid==user) {
+					return repl("SELECT comment, owner, comment_docname, creation, docstatus " +
+					"FROM `tabComment Widget Record` "+
+					"WHERE comment_doctype='My Company' " +
+					"AND comment_docname='%(user)s' " +
+					"ORDER BY creation DESC ", {user:user});
+
+				} else {
+					return repl("SELECT comment, owner, comment_docname, creation, docstatus " +
+					"FROM `tabComment Widget Record` "+
+					"WHERE comment_doctype='My Company' " +
+					"AND ((owner='%(user)s' AND comment_docname='%(uid)s') " +
+					"OR (owner='%(uid)s' AND comment_docname='%(user)s')) " +
+					"ORDER BY creation DESC ", {uid:uid, user:user});
+
+				}
+			},
+			render_row: function(parent, data) {
+				new MemberCoversationComment(parent, data, me);
+			},
+			
+		})
+		this.refresh();
+	}
+	
+	this.refresh = function() {
+		me.lst.run()
+	}
+	
+	this.make();
+}
+
+MemberCoversationComment = function(cell, det, conv) {
+	var me = this;
+	this.det = det;
+	this.wrapper = $a(cell, 'div', 'my-company-comment-wrapper');
+	this.comment = $a(this.wrapper, 'div', 'my-company-comment');
+
+	this.user = $a(this.comment, 'span', 'link_type', {fontWeight:'bold'}, pscript.get_fullname(det[1]));
+	this.user.onclick = function() {
+		page_body.pages['My Company'].member_list.show_profile(me.det[1]);
+	}
+
+	var st = (!det[4] ? {fontWeight: 'bold'} : null);
+	this.msg = $a(this.comment, 'span', 'social', st, ': ' + det[0]);
+
+	if(det[1]==user) {
+		$y(this.wrapper, {backgroundColor: '#D9D9F3'});
+	}
+	this.timestamp = $a(this.wrapper, 'div', 'my-company-timestamp', '', comment_when(det[3]));
+}
+
+
+
+
+
+
+
+// ========================== Role object =====================================
+
+pscript.all_roles = null;
+
+RoleObj = function(profile_id){
+	this.roles_dict = {};
+	this.profile_id = profile_id;
+	this.setup_done = 0;
+
+	var d = new Dialog(500,500,'Assign Roles');
+	d.make_body([
+		['HTML','roles']
+	]);
+	
+	this.dialog = d;
+	this.make_role_body(profile_id);
+	this.make_help_body();
+	
+	this.body.innerHTML = '<span style="color:#888">Loading...</span> <img src="images/ui/button-load.gif">'
+	var me=this;
+
+	d.onshow = function() {
+		if(!me.setup_done)
+			me.get_all_roles(me.profile_id);
+	}
+}
+
+// make role body
+RoleObj.prototype.make_role_body = function(id){
+	var me = this;
+	var d = this.dialog;
+	this.role_div = $a(d.widgets['roles'],'div');
+	
+	this.head = $a(this.role_div,'div','',{marginLeft:'4px', marginBottom:'4px',fontWeight:'bold'});
+	this.body = $a(this.role_div,'div');
+	this.footer = $a(this.role_div,'div');
+	
+	this.update_btn = $btn(this.footer,'Update',function() { me.update_roles(me.profile_id); },{marginRight:'4px'},'',1);	
+}
+
+// make help body
+RoleObj.prototype.make_help_body = function(){
+	var me = this;
+	
+	var d = this.dialog;
+	this.help_div = $a(d.widgets['roles'],'div');
+	
+	var head = $a(this.help_div,'div');	this.help_div.head = head;
+	var body = $a(this.help_div,'div');	this.help_div.body = body;
+	var tail = $a(this.help_div,'div');	this.help_div.tail = tail;
+	
+	var back_btn = $btn(tail,'Back', function() {
+		// back to assign roles
+		$(me.role_div).slideToggle('medium');
+		$(me.help_div).slideToggle('medium');
+	});
+	this.help_div.back_btn = back_btn;
+	$dh(this.help_div);
+}
+
+// get all roles
+RoleObj.prototype.get_all_roles = function(id){
+	if(pscript.all_roles) {
+		this.make_roles(id);
+		return;
+	}
+
+	var me = this;
+	var callback = function(r,rt){
+		pscript.all_roles = r.message;
+		me.make_roles(id);
+	}
+	$c_obj('Company Control','get_all_roles','',callback);
+}
+
+// make roles
+RoleObj.prototype.make_roles = function(id){
+	var me = this;
+	var list = pscript.all_roles;
+	me.setup_done = 1;
+	me.body.innerHTML = '';
+		
+	var tbl = make_table( me.body, cint(list.length / 2) + 1,4,'100%',['5%','45%','5%','45%'],{padding:'4px'});
+	var in_right = 0; var ridx = 0;
+
+	for(i=0;i<list.length;i++){
+		var cidx = in_right * 2;
+		
+		me.make_checkbox(tbl, ridx, cidx, list[i]);
+		me.make_label(tbl, ridx, cidx + 1, list[i]);
+
+		// change column
+		if(in_right) {in_right = 0; ridx++ } else in_right = 1;
+	}
+	me.get_user_roles(id);
+}
+
+// make checkbox
+RoleObj.prototype.make_checkbox = function(tbl,ridx,cidx, role){
+	var me = this;
+	
+	var a = $a_input($a($td(tbl, ridx, cidx),'div'),'checkbox');
+	a.role = role;
+	me.roles_dict[role] = a;
+	
+	$y(a,{width:'20px'});
+	$y($td(tbl, ridx, cidx),{textAlign:'right'});
+}
+
+
+// make label
+RoleObj.prototype.make_label = function(tbl, ridx, cidx, role){
+	var me = this;
+	
+	var t = make_table($td(tbl, ridx, cidx),1,2,null,['16px', null],{marginRight:'5px'});
+	var ic = $a($td(t,0,0), 'img','',{cursor:'pointer', marginRight:'5px'});
+	ic.src= 'images/icons/help.gif';
+	ic.role = role;
+		
+	ic.onclick = function(){
+		me.get_permissions(this.role);
+	}
+	$td(t,0,1).innerHTML= role;
+	
+}
+
+// get user roles
+RoleObj.prototype.get_user_roles = function(id){
+	var me = this;
+	me.head.innerHTML = 'Roles for ' + id;
+	
+	$ds(me.role_div);
+	$dh(me.help_div);
+	
+	var callback = function(r,rt){
+			me.set_user_roles(r.message);
+	}
+	$c_obj('Company Control','get_user_roles', id,callback);
+}
+
+
+// set user roles
+RoleObj.prototype.set_user_roles = function(list){
+	var me = this;
+	for(d in me.roles_dict){
+		me.roles_dict[d].checked = 0;
+	}
+	for(l=0; l<list.length; l++){
+		me.roles_dict[list[l]].checked = 1;
+	}
+}
+
+
+// update roles
+RoleObj.prototype.update_roles = function(id){
+	var me = this;
+	
+	
+	if(id == user && has_common(['System Manager'], user_roles) && !me.roles_dict['System Manager'].checked){
+		var callback = function(r,rt){
+			if(r.message){
+				if(r.message > 1){
+					var c = confirm("You have unchecked the System Manager role.\nYou will lose administrative rights and will not be able to set roles.\n\nDo you want to continue anyway?");
+					if(!c) return;
+				}
+				else{
+					var c = "There should be atleast one user with System Manager role.";
+					me.roles_dict['System Manager'].checked = 1;
+				}
+			}
+			me.set_roles(id);
+		}
+		$c_obj('Company Control','get_sm_count','',callback);
+	}
+	else{
+		me.set_roles(id);
+	}
+}
+
+// set roles
+RoleObj.prototype.set_roles = function(id){
+
+	var me = this;
+	var role_list = [];
+	
+	for(d in me.roles_dict){
+		if(me.roles_dict[d].checked){
+			role_list.push(d);
+		}
+	}
+
+	var callback = function(r,rt){
+		me.update_btn.done_working();
+		me.dialog.hide();
+	}
+	var arg = {'usr':id, 'role_list':role_list};
+	me.update_btn.set_working();
+	$c_obj('Company Control','update_roles',docstring(arg), callback);
+
+}
+
+// get permission
+RoleObj.prototype.get_permissions = function(role){
+	var me = this;
+	
+	var callback = function(r,rt){
+		$(me.help_div).slideToggle('medium');
+		$(me.role_div).slideToggle('medium');
+		me.set_permissions(r.message, role);
+	}
+	$c_obj('Company Control','get_permission',role,callback);
+}
+
+
+// set permission
+RoleObj.prototype.set_permissions = function(perm, role){
+	var me = this;
+	me.help_div.body.innerHTML ='';
+	
+	if(perm){
+		me.help_div.head.innerHTML = 'Permissions for ' + role + ':<br><br>';
+		
+		perm_tbl = make_table(me.help_div.body,cint(perm.length)+2,7,'100%',['30%','10%','10%','10%','10%','10%','10%'],{padding:'4px'});
+		
+		var head_lst = ['Document','Read','Write','Create','Submit','Cancel','Amend'];
+
+		for(var i=0; i<(head_lst.length-1);i++){
+			$td(perm_tbl,0,i).innerHTML= "<b>"+head_lst[i]+"</b>";
+		}
+		var accept_img1 = 'images/icons/accept.gif';
+		var cancel_img1 =	'images/icons/cancel.gif';
+
+		for(i=1; i<perm.length+1; i++){
+			$td(perm_tbl,i,0).innerHTML= get_doctype_label(perm[i-1][0]);
+			
+			for(var j=1;j<(head_lst.length-1);j++){
+				
+				if(perm[i-1][j]){
+					var accept_img = $a($td(perm_tbl,i,j), 'img');	accept_img.src= accept_img1;
+				}
+				else { 
+					var cancel_img = $a($td(perm_tbl,i,j), 'img'); cancel_img.src= cancel_img1;
+				}
+				$y($td(perm_tbl,i,j),{textAlign:'center'});
+			}
+		}
+	}
+	else
+		me.help_div.head.innerHTML = 'No Permission set for ' + role + '.<br><br>';
+}
diff --git a/my_company/page/my_company/my_company.py b/my_company/page/my_company/my_company.py
new file mode 100644
index 0000000..cbdb8fc
--- /dev/null
+++ b/my_company/page/my_company/my_company.py
@@ -0,0 +1,130 @@
+import webnotes
+
+from webnotes.utils import cint, load_json, cstr
+
+try: import json
+except: import simplejson as json
+
+def get_account_settings_url(arg=''):
+	import server_tools.server_tools.gateway_utils
+	return server_tools.server_tools.gateway_utils.get_account_settings_url()
+
+#
+# set max users
+#
+def get_max_users(arg=''):
+	from server_tools.server_tools.gateway_utils import get_max_users_gateway
+	return {
+		'max_users': get_max_users_gateway(),
+		'enabled': cint(webnotes.conn.sql("select count(*) from tabProfile where ifnull(enabled,0)=1 and name not in ('Administrator', 'Guest')")[0][0])
+	}
+
+#
+# enable profile in local
+#
+def enable_profile(arg=''):
+	webnotes.conn.sql("update tabProfile set enabled=1 where name=%s", arg)
+	return 1
+		
+#
+# disable profile in local
+#
+def disable_profile(arg=''):
+	if arg=='Administrator':
+		return 'Cannot disable Administrator'
+
+	webnotes.conn.sql("update tabProfile set enabled=0 where name=%s", arg)
+	return 0
+
+#
+# delete user
+#
+def delete_user(args):
+	args = json.loads(args)
+	webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s", args['user'])
+	# erpnext-saas
+	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
+		from server_tools.server_tools.gateway_utils import remove_user_gateway
+		remove_user_gateway(args['user'])
+
+#
+# add user
+#
+def add_user(args):
+	args = json.loads(args)
+	add_profile(args['user'])
+	# erpnext-saas
+	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
+		from server_tools.server_tools.gateway_utils import add_user_gateway
+		add_user_gateway(args['user'])
+	
+#
+# add profile record
+#
+def add_profile(email):
+	from webnotes.utils import validate_email_add
+	from webnotes.model.doc import Document
+			
+	sql = webnotes.conn.sql
+	
+	if not email:
+		email = webnotes.form_dict.get('user')
+	if not validate_email_add(email):
+		raise Exception
+		return 'Invalid Email Id'
+	
+	if sql("select name from tabProfile where name = %s", email):
+		# exists, enable it
+		sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
+		webnotes.msgprint('Profile exists, enabled it')
+	else:
+		# does not exist, create it!
+		pr = Document('Profile')
+		pr.name = email
+		pr.email = email
+		pr.enabled=1
+		pr.user_type='System User'
+		pr.save(1)	
+
+#
+# post comment
+#
+def post_comment(arg):
+	arg = load_json(arg)
+	
+	from webnotes.model.doc import Document
+	d = Document('Comment Widget Record')
+	d.comment_doctype = 'My Company'
+	d.comment_docname = arg['uid'] # to
+	d.owner = webnotes.user.name
+	d.comment = arg['comment']
+	d.save(1)
+	
+	if cint(arg['notify']):
+		fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
+		if fn[0] or f[1]:
+			fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
+		else:
+			fn = webnotes.user.name
+
+		from webnotes.utils.email_lib import sendmail
+		from settings.doctype.notification_control.notification_control import get_formatted_message
+		
+		message = '''A new comment has been posted on your page by %s:
+		
+		<b>Comment:</b> %s
+		
+		To answer, please login to your erpnext account!
+		''' % (fn, arg['comment'])
+		
+		sendmail([arg['uid']], webnotes.user.name, get_formatted_message('New Comment', message), fn + ' has posted a new comment')
+	
+#
+# update read messages
+#
+def set_read_all_messages(arg=''):
+	webnotes.conn.sql("""UPDATE `tabComment Widget Record`
+	SET docstatus = 1
+	WHERE comment_doctype = 'My Company'
+	AND comment_docname = %s
+	""", webnotes.user.name)
diff --git a/my_company/page/my_company/my_company.txt b/my_company/page/my_company/my_company.txt
new file mode 100644
index 0000000..4977ac9
--- /dev/null
+++ b/my_company/page/my_company/my_company.txt
@@ -0,0 +1 @@
+[{'creation': '2010-06-29 12:40:20', 'module': 'My Company', 'doctype': 'Page', 'owner': 'Administrator', 'style': '', 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 1, 'content': None, 'page_name': 'My Company', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'My Company', 'idx': None, 'static_content': None, 'modified': '2010-12-01 17:09:46', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000143', 'parent': 'My Company', 'creation': '2010-06-29 16:40:26', 'modified': '2010-12-01 17:09:46', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000153', 'parent': 'My Company', 'creation': '2010-08-06 20:18:55', 'modified': '2010-12-01 17:09:46', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'All', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/observers.py b/observers.py
new file mode 100644
index 0000000..2cab98c
--- /dev/null
+++ b/observers.py
@@ -0,0 +1,35 @@
+# observers.py
+
+observers = {
+	# Project
+	'Ticket': 				{'on_update':'event_updates.doctype.feed_control.feed_control'},
+
+	# Sales
+	'Customer': 			{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Lead': 				{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Quotation':			{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Sales Order':			{'on_update':'event_updates.doctype.feed_control.feed_control'},
+
+	# Purchase
+	'Supplier': 			{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Purchase Order':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+
+	# Stock
+	'Delivery Note':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	
+	# Accounts
+	'Journal Voucher':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Payable Voucher':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Receivable Voucher':	{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	
+	# HR
+	'Expense Voucher':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Salary Slip':			{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Leave Transaction':	{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	
+	# Support
+	'Customer Issue':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Support Ticket':		{'on_update':'event_updates.doctype.feed_control.feed_control'},
+	'Maintenance Visit':	{'on_update':'event_updates.doctype.feed_control.feed_control'}
+
+}
\ No newline at end of file
diff --git a/patches/__init__.py b/patches/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/patches/__init__.py
diff --git a/patches/customer_address.py b/patches/customer_address.py
new file mode 100644
index 0000000..6a031c4
--- /dev/null
+++ b/patches/customer_address.py
@@ -0,0 +1,688 @@
+import webnotes
+
+from webnotes.model.doc import Document
+from webnotes.utils import load_json, cint, cstr
+from webnotes import msgprint, errprint
+
+def make_address():
+	from webnotes.modules.module_manager import reload_doc
+	reload_doc('tools','doctype','address')
+	
+	from webnotes.model.db_schema import updatedb
+	updatedb('Address')
+
+def make_address_from_customer():
+	for c in webnotes.conn.sql("select * from tabCustomer", as_dict=1):		
+		d = Document('Address') 
+		d.address_line1 = c['address_line1'] 
+		d.address_line2 = c['address_line2']  
+		d.city = c['city']  
+		d.country = c['country']  
+		d.pincode = c['pincode']
+		d.state = c['state']  
+		d.fax = c['fax_1']  
+		d.email_id = c['email_id']  		
+		d.phone = c['phone_1']  
+		d.customer = c['name']  
+		d.customer_name = c['customer_name']  
+		d.is_primary_address = 1
+		d.address_type = 'Office'
+		try:
+			d.save(1)
+		except NameError, e:
+			pass
+
+def make_address_from_supplier():
+	for c in webnotes.conn.sql("select * from tabSupplier", as_dict=1):		
+		d = Document('Address')
+		d.address_line1 = c['address_line1'] 
+		d.address_line2 = c['address_line2']  
+		d.city = c['city']  
+		d.country = c['country']  
+		d.pincode = c['pincode']
+		d.state = c['state']  		  		
+		d.supplier = c['name']  
+		d.supplier_name = c['supplier_name']  
+		d.is_primary_address = 1
+		d.address_type = 'Office'
+		try:
+			d.save(1)
+		except NameError, e:
+			pass
+
+def make_contact_from_contacttab():
+	webnotes.conn.sql("""
+	update ignore tabContact set
+		is_primary_contact = if(is_primary_contact='Yes',1,0)
+	""")
+
+	webnotes.conn.sql("""
+	update ignore tabContact t1, tabCustomer t2 set
+		t1.name = concat(ifnull(t1.contact_name,t1.name), '-', ifnull(t1.customer_name, t2.name))
+		where ifnull(t1.is_customer,0)=1
+		and t1.customer = t2.name
+	""")
+
+	webnotes.conn.sql("""
+	update ignore tabContact t1, tabSupplier t2 set
+		t1.name = concat(ifnull(t1.contact_name,t1.name), '-', ifnull(t1.supplier_name, t2.name))
+		where ifnull(t1.is_supplier,0)=1
+		and t1.supplier = t2.name
+	""")
+
+	webnotes.conn.sql("""
+	update ignore tabContact set
+		name = concat(ifnull(contact_name,name), '-', sales_partner)
+		where ifnull(is_sales_partner,0)=1
+	""")
+
+	webnotes.conn.commit()
+	try:
+		webnotes.conn.sql("""alter table tabContact change contact_no phone varchar(180)""")
+		webnotes.conn.sql("""alter table tabContact change is_primary_contact is_primary_contact int(1)""")
+	except:
+		pass
+	webnotes.conn.begin()
+	
+def delete_unwanted_fields():
+	delete_fields = [
+		('Contact', 'is_sales_partner'), ('Contact', 'sales_partner_address'), ('Contact', 'partner_type'), ('Contact', 'disable_login'), ('Contact', 'contact_address'), ('Contact', 'fax'), ('Contact', 'company_name'), ('Contact', 'contact_no'), ('Contact', 'customer_group'), ('Contact', 'has_login'), ('Contact', 'Create Login'), ('Contact', 'contact_name'), ('Contact', 'company_address'), ('Contact', 'customer_address'), ('Contact', 'supplier_address'), ('Contact', 'supplier_type'), ('Contact', 'is_customer'), ('Contact', 'is_supplier'), ('Contact', 'employee_id'), ('Contact', 'is_employee'), 
+		('Customer', 'region'), ('Customer', 'pincode'), ('Customer', 'city'), ('Customer', 'country'), ('Customer', 'state'), ('Customer', 'address'), ('Customer', 'telephone'), ('Customer', 'address_line2'), ('Customer', 'address_line1'), ('Customer', 'last_sales_order'), ('Customer', 'Shipping HTML'), ('Customer', 'phone_1'), ('Customer', 'Territory Help'), ('Customer', 'CG Help'), ('Customer', 'fax_1'), ('Customer', 'email_id'), 
+		('Customer Issue', 'email_id'), ('Customer Issue', 'contact_no'),
+		('Delivery Note', 'customer_mobile_no'), ('Delivery Note', 'Send SMS'), ('Delivery Note', 'Get Other Charges'), ('Delivery Note', 'message'), ('Delivery Note', 'shipping_address'), ('Delivery Note', 'ship_to'), ('Delivery Note', 'ship_det_no'), ('Delivery Note', 'contact_no'), ('Delivery Note', 'Customer Details'), ('Delivery Note', 'email_id'), ('Delivery Note', 'delivery_address'), ('Delivery Note', 'Contact Help'), ('Delivery Note', 'Territory Help'), 
+		('Enquiry', 'address'), ('Enquiry', 'Send Email'), ('Enquiry', 'enquiry_attachment_detail'), ('Enquiry', 'contact_date_ref'), ('Enquiry', 'Update Follow up'), ('Enquiry', 'email_id1'), ('Enquiry', 'cc_to'), ('Enquiry', 'subject'), ('Enquiry', 'message'), ('Enquiry', 'Attachment Html'), ('Enquiry', 'Create New File'), ('Enquiry', 'contact_no'), ('Enquiry', 'email_id'), ('Enquiry', 'project'), ('Enquiry', 'update_follow_up'), ('Enquiry', 'Contact Help'), 
+		('Installation Note', 'address'), 
+		('Lead', 'message'), ('Lead', 'Send Email'), ('Lead', 'address'), ('Lead', 'subject'), ('Lead', 'contact_no'), ('Lead', 'TerritoryHelp'), 
+		('Maintenance Schedule', 'address'), 
+		('Maintenance Visit', 'address'), 
+		('Purchase Order', 'Contact Help'), ('Purchase Order', 'supplier_qtn'), ('Purchase Order', 'contact_no'), ('Purchase Order', 'email'), 
+		('Purchase Receipt', 'Contact Help'), 
+		('Quotation', 'email_id'), ('Quotation', 'contact_no'), ('Quotation', 'Update Follow up'), ('Quotation', 'contact_date_ref'), ('Quotation', 'Territory Help'), ('Quotation', 'Contact Help'), 
+		('Receivable Voucher', 'Territory Help'), 
+		('Sales Order', 'contact_no'), ('Sales Order', 'email_id'), ('Sales Order', 'Contact Help'), ('Sales Order', 'file_list'), ('Sales Order', 'ship_det_no'), ('Sales Order', 'mobile_no'), ('Sales Order', 'Territory Help'), ('Sales Order', 'ship_to'), ('Sales Order', 'Customer Details'), 
+		('Sales Partner', 'area_code'), ('Sales Partner', 'telephone'), ('Sales Partner', 'email'), ('Sales Partner', 'address'), ('Sales Partner', 'TerritoryHelp'), ('Sales Partner', 'pincode'), ('Sales Partner', 'country'), ('Sales Partner', 'city'), ('Sales Partner', 'address_line2'), ('Sales Partner', 'address_line1'), ('Sales Partner', 'mobile'), ('Sales Partner', 'state'), 
+		('Serial No', 'supplier_address'), 
+		('Supplier', 'city'), ('Supplier', 'country'), ('Supplier', 'state'), ('Supplier', 'address_line1'), ('Supplier', 'last_purchase_order'), ('Supplier', 'address'), ('Supplier', 'address_line2'), ('Supplier', 'pincode'), ('Supplier rating', 'address'), ('Supplier rating', 'select'), ('Supplier rating', 'supplier')]
+	for d in delete_fields:
+		webnotes.conn.sql("delete from tabDocField where parent=%s and if(ifnull(fieldname,'')='',ifnull(label,''),fieldname)=%s", (d[0], d[1]))
+
+#def gen_txt_files():
+#	from webnotes.modules.export_module import export_to_files
+#	for dt in ['Contact','Customer','Customer Issue','Delivery Note','Enquiry','Installation Note','Lead','Maintenance Schedule','Maintenance Visit','Purchase Order','Purchase Receipt','Quotation','Receivable Voucher','Sales Order','Sales Partner','Serial No','Supplier']:
+#		export_to_files(record_list=[['DocType',dt]])
+
+def reload_doc_files():
+	from webnotes.modules.module_manager import reload_doc	
+	reload_doc('tools', 'doctype', 'contact')
+	reload_doc('crm', 'doctype', 'customer')
+	reload_doc('maintenance', 'doctype', 'customer_issue')
+	reload_doc('material_management', 'doctype', 'delivery_note')
+	reload_doc('crm', 'doctype', 'enquiry')
+	reload_doc('crm', 'doctype', 'installation_note')
+	reload_doc('crm', 'doctype', 'lead')
+	reload_doc('maintenance', 'doctype', 'maintenance_schedule')
+	reload_doc('maintenance', 'doctype', 'maintenance_visit')
+	reload_doc('srm', 'doctype', 'purchase_order')
+	reload_doc('material_management', 'doctype', 'purchase_receipt')
+	reload_doc('crm', 'doctype', 'quotation')
+	reload_doc('accounts', 'doctype', 'receivable_voucher')
+	reload_doc('accounts', 'doctype', 'payable_voucher')	
+	reload_doc('crm', 'doctype', 'sales_order')
+	reload_doc('setup', 'doctype', 'sales_partner')
+	reload_doc('material_management', 'doctype', 'serial_no')
+	reload_doc('srm', 'doctype', 'supplier')
+	
+def reload_mapper_files():
+	from webnotes.modules.module_manager import reload_doc	
+	reload_doc('Mapper', 'DocType Mapper', 'Customer Issue-Maintenance Visit')
+	reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Installation Note')
+	reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
+	reload_doc('Mapper', 'DocType Mapper', 'Enquiry-Quotation')
+	reload_doc('Mapper', 'DocType Mapper', 'Lead-Customer')
+	reload_doc('Mapper', 'DocType Mapper', 'Lead-Enquiry')
+	reload_doc('Mapper', 'DocType Mapper', 'Purchase Order-Payable Voucher')
+	reload_doc('Mapper', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
+	reload_doc('Mapper', 'DocType Mapper', 'Purchase Receipt-Payable Voucher')
+	reload_doc('Mapper', 'DocType Mapper', 'Quotation-Sales Order')
+	reload_doc('Mapper', 'DocType Mapper', 'Receivable Voucher-Delivery Note')
+	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Delivery Note')
+	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Maintenance Schedule')
+	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Maintenance Visit')
+	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Receivable Voucher')		
+  	
+def delete_unwanted_mapper_fields():
+	delete_fields = [
+	('Customer Issue-Maintenance Visit', 'customer_address', 'address'),
+	('Delivery Note-Installation Note', 'customer_address', 'address'),
+	('Enquiry-Quotation', 'contact_no', 'contact_no'), ('Enquiry-Quotation', 'subject', 'enq_det'), ('Enquiry-Quotation', 'customer_name', 'customer_name'), ('Enquiry-Quotation', 'customer_name', 'customer_name'), ('Enquiry-Quotation', 'address', 'customer_address'), ('Enquiry-Quotation', 'email_id', 'email_id'),
+	('Quotation-Sales Order', 'contact_no', 'contact_no'), ('Quotation-Sales Order', 'email_id', 'email_id'), ('Quotation-Sales Order', 'customer_mobile_no', 'customer_mobile_no'),
+	('Sales Order-Delivery Note', 'customer_address', 'delivery_address'), ('Sales Order-Delivery Note', 'customer_address', 'customer_address'), ('Sales Order-Delivery Note', 'contact_no', 'contact_no'), ('Sales Order-Delivery Note', 'email_id', 'email_id'), ('Sales Order-Delivery Note', 'ship_det_no', 'ship_det_no'), ('Sales Order-Delivery Note', 'ship_to', 'ship_to'), ('Sales Order-Delivery Note', 'shipping_address', 'shipping_address'), ('Sales Order-Delivery Note', 'customer_mobile_no', 'customer_mobile_no'),
+	('Sales Order-Maintenance Schedule', 'customer_address', 'address'),
+	('Sales Order-Maintenance Visit', 'customer_address', 'address'),
+	('Sales Order-Receivable Voucher', 'contact_no', 'contact_no')]
+	
+  	for rec in delete_fields:  		
+		webnotes.conn.sql("delete from `tabField Mapper Detail` where parent=%s and from_field=%s and to_field=%s",(rec[0], rec[1], rec[2]))
+  	
+def sync_docfield_properties():
+	update_fields = [	
+	('Contact', 'customer', 'Customer', 0L, None, 0L, None), ('Contact', 'supplier', 'Supplier', 0L, None, None, None), ('Contact', 'is_primary_contact', None, 0L, None, None, None), ('Contact', 'email_id', None, 0L, 1L, None, None), ('Contact', 'department', 'Suggest', 0L, None, None, None), ('Contact', 'designation', 'Suggest', 0L, None, None, None),
+	('Customer Issue', 'customer', 'Customer', 0L, 1L, 1L, None), ('Customer Issue', 'customer_address', 'Address', 0L, None, 1L, None), ('Customer Issue', 'contact_person', 'Contact', 0L, None, 1L, None), ('Customer Issue', 'customer_name', None, 1L, None, None, None), ('Customer Issue', 'company', 'Company', 0L, 1L, 1L, None), ('Customer Issue', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None),
+	('Delivery Note', 'customer_address', 'Address', 0L, None, 1L, None), ('Delivery Note', 'contact_person', 'Contact', 0L, None, 1L, None), ('Delivery Note', 'customer_name', None, 1L, None, None, None), ('Delivery Note', 'status', '\nDraft\nSubmitted\nCancelled', 1L, 1L, 1L, None), ('Delivery Note', 'territory', 'Territory', 0L, 1L, 1L, 0L), ('Delivery Note', 'customer_group', 'Customer Group', 0L, None, 1L, None), ('Delivery Note', 'transporter_name', None, 0L, 0L, 1L, None), ('Delivery Note', 'lr_no', None, 0L, 0L, 1L, None), ('Delivery Note', 'lr_date', None, 0L, None, 1L, None), ('Delivery Note', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Delivery Note', 'letter_head', 'link:Letter Head', 0L, None, 1L, None),
+	('Enquiry', 'contact_person', 'Contact', 0L, None, 1L, None), ('Enquiry', 'customer_name', None, 1L, None, 0L, None), ('Enquiry', 'lead', 'Lead', 0L, None, 1L, 0L), ('Enquiry', 'enquiry_type', '\nSales\nMaintenance', 0L, 1L, None, None), ('Enquiry', 'territory', 'Territory', 0L, 1L, 1L, None), ('Enquiry', 'customer_group', 'Customer Group', 0L, 0L, 1L, 0L), ('Enquiry', 'contact_by', 'Profile', 0L, None, None, None),
+	('Installation Note', 'contact_person', 'Contact', 0L, None, 1L, None), ('Installation Note', 'customer_name', None, 1L, 0L, None, None), ('Installation Note', 'territory', 'Territory', 0L, 1L, 1L, None), ('Installation Note', 'status', 'Draft\nSubmitted\nCancelled', 1L, 1L, 1L, None),
+	('Lead', 'city', None, 0L, 1L, 1L, None), ('Lead', 'country', 'link:Country', 0L, 1L, 1L, None), ('Lead', 'state', 'Suggest', 0L, None, 1L, None), ('Lead', 'company', 'Company', 0L, 1L, None, None), ('Lead', 'contact_by', 'Profile', 0L, 0L, 0L, 0L),
+	('Maintenance Schedule', 'customer', 'Customer', 0L, 1L, 1L, None), ('Maintenance Schedule', 'contact_person', 'Contact', 0L, None, 1L, None), ('Maintenance Schedule', 'status', '\nDraft\nSubmitted\nCancelled', 1L, 1L, None, None), ('Maintenance Schedule', 'territory', 'Territory', 0L, 1L, None, None),
+	('Maintenance Visit', 'customer', 'Customer', 0L, 1L, 1L, None), ('Maintenance Visit', 'contact_person', 'Contact', 0L, None, 1L, None), ('Maintenance Visit', 'customer_name', None, 1L, None, None, None), ('Maintenance Visit', 'company', 'link:Company', 0L, 1L, 1L, None), ('Maintenance Visit', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None), ('Maintenance Visit', 'status', '\nDraft\nCancelled\nSubmitted', 1L, 1L, None, None), ('Maintenance Visit', 'territory', 'Territory', 0L, None, 1L, None),
+	('Purchase Order', 'supplier_address', 'Address', 0L, None, 1L, None), ('Purchase Order', 'contact_person', 'Contact', 0L, None, 1L, None), ('Purchase Order', 'supplier_name', None, 1L, None, None, None), ('Purchase Order', 'status', '\nDraft\nSubmitted\nStopped\nCancelled', 1L, 1L, 1L, None), ('Purchase Order', 'indent_no', 'Indent', 0L, None, 1L, 0L), ('Purchase Order', 'is_subcontracted', '\nYes\nNo', 0L, None, 1L, None), ('Purchase Order', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Purchase Order', 'net_total', None, 1L, 0L, 1L, None),
+	('Purchase Receipt', 'supplier_address', 'Address', 0L, None, 1L, None), ('Purchase Receipt', 'contact_person', 'Contact', 0L, None, 1L, None), ('Purchase Receipt', 'supplier_name', None, 1L, None, None, None), ('Purchase Receipt', 'status', '\nDraft\nSubmitted\nCancelled', 1L, 1L, 1L, None), ('Purchase Receipt', 'currency', 'link:Currency', 0L, 1L, 1L, None),
+	('Quotation', 'customer', 'Customer', 0L, None, 1L, 0L), ('Quotation', 'customer_address', 'Address', 0L, None, 1L, 0L), ('Quotation', 'contact_person', 'Contact', 0L, 0L, 1L, 0L), ('Quotation', 'customer_name', None, 1L, None, None, None), ('Quotation', 'lead', 'Lead', 0L, None, 1L, 0L), ('Quotation', 'lead_name', None, 1L, None, None, None), ('Quotation', 'order_type', '\nSales\nMaintenance', 0L, 1L, 0L, None), ('Quotation', 'status', '\nDraft\nSubmitted\nOrder Confirmed\nOrder Lost\nCancelled', 1L, 1L, 1L, None), ('Quotation', 'territory', 'Territory', 0L, 1L, 1L, 0L), ('Quotation', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Quotation', 'letter_head', 'link:Letter Head', 0L, None, 1L, None), ('Quotation', 'order_lost_reason', None, 1L, None, 1L, None), ('Quotation', 'contact_by', 'Profile', 0L, None, 1L, None), ('Quotation', 'contact_date', None, 0L, None, 1L, None), ('Quotation', 'to_discuss', None, 0L, None, 1L, None),
+	('Receivable Voucher', 'debit_to', 'Account', 0L, 1L, 1L, None), ('Receivable Voucher', 'customer_address', 'Address', 0L, None, 1L, None), ('Receivable Voucher', 'territory', 'Territory', 0L, 1L, 1L, None), ('Receivable Voucher', 'paid_amount', None, 0L, None, 1L, None), ('Receivable Voucher', 'company', 'Company', 0L, 1L, 1L, None), ('Receivable Voucher', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None), ('Receivable Voucher', 'outstanding_amount', None, 1L, None, 1L, None),
+	('Payable Voucher', 'supplier_address', 'Address', 0L, None, 1L, None), ('Payable Voucher', 'contact_display', None, 1L, None, None, None), ('Payable Voucher', 'contact_mobile', None, 1L, None, None, None), ('Payable Voucher', 'contact_email', None, 1L, None, 1L, None), ('Payable Voucher', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Payable Voucher', 'conversion_rate', None, 0L, 1L, 1L, None), ('Payable Voucher', 'company', 'Company', 0L, 1L, 1L, None), ('Payable Voucher', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None),
+	('Sales Order', 'customer_address', 'Address', 0L, None, 1L, 0L), ('Sales Order', 'contact_person', 'Contact', 0L, None, 1L, None), ('Sales Order', 'customer_name', None, 1L, None, None, None), ('Sales Order', 'status', '\nDraft\nSubmitted\nStopped\nCancelled', 1L, 1L, 1L, None), ('Sales Order', 'quotation_date', None, 1L, 0L, 1L, 1L), ('Sales Order', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Sales Order', 'letter_head', 'link:Letter Head', 0L, None, 1L, None),
+	('Sales Partner', 'territory', 'Territory', 0L, 1L, None, None),
+	('Supplier', 'company', 'Company', 0L, 1L, None, None)]
+	
+	for rec in update_fields:
+		webnotes.conn.sql("UPDATE `tabDocField` SET options=%s, permlevel=%s, reqd=%s, print_hide=%s, hidden=%s where parent=%s and fieldname=%s",(rec[2], rec[3], rec[4], rec[5], rec[6], rec[0], rec[1]))
+	
+def run_patch():
+	make_address()
+  	make_address_from_customer()
+  	make_address_from_supplier()
+  	make_contact_from_contacttab()
+  	delete_unwanted_fields()
+	reload_doc_files()
+	reload_mapper_files()
+	delete_unwanted_mapper_fields()
+	sync_docfield_properties()	
+
+#Old Customer Data Sync Patch for "Quotation, SO, PO, RV, PV, DN, PR, Installation Note, Maintenance Schedule, Customer Issue, Maintenance Visit"
+#--------------------------------------------------------------
+
+def run_old_data_sync_patch():
+	sync_quotation_customer_data()
+	sync_sales_order_customer_data()
+	sync_purchase_order_supplier_data()
+	sync_receivable_voucher_customer_data()
+	sync_payable_voucher_supplier_data()
+	sync_delivery_note_customer_data()
+	sync_purchase_receipt_supplier_data()
+	sync_installation_note_customer_data()
+	sync_maintenance_schedule_customer_data()
+	sync_customer_issue_customer_data()
+	sync_maintenance_visit_customer_data()
+	sync_lead_phone()
+	
+#Quotation
+def sync_quotation_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT tq.name as id,tq.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM tabQuotation tq, tabAddress ta
+	WHERE tq.customer = ta.customer
+	AND tq.quotation_to = 'Customer'	
+	AND tq.docstatus !=2
+	ORDER BY tq.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))											
+		
+		webnotes.conn.sql("""
+		UPDATE tabQuotation SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))
+		
+	data_rec = webnotes.conn.sql("""
+	SELECT tq.name as id,tq.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM tabQuotation tq, tabContact tc
+	WHERE tq.customer = tc.customer 
+	AND tq.quotation_to = 'Customer'	
+	AND tq.docstatus !=2
+	ORDER BY tq.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE tabQuotation SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))
+				
+		
+#Sales Order		
+def sync_sales_order_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabSales Order` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Phone: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabSales Order` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))		
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabSales Order` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:					
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabSales Order` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))		
+				
+#Purchase Order
+def sync_purchase_order_supplier_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.supplier, 
+	ta.name as supplier_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabPurchase Order` t, tabAddress ta
+	WHERE t.supplier = ta.supplier
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabPurchase Order` SET
+			supplier_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['supplier_address'],address_display,rec['id']))				
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.supplier, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabPurchase Order` t, tabContact tc
+	WHERE t.supplier = tc.supplier 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:					
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabPurchase Order` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
+		
+#Sales Invoice		
+def sync_receivable_voucher_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabReceivable Voucher` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabReceivable Voucher` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))		
+		
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabReceivable Voucher` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:					
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabReceivable Voucher` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
+		
+#Purchase Invoice
+def sync_payable_voucher_supplier_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.supplier, 
+	ta.name as supplier_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabPayable Voucher` t, tabAddress ta
+	WHERE t.supplier = ta.supplier
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabPayable Voucher` SET
+			supplier_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['supplier_address'],address_display,rec['id']))				
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.supplier, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabPayable Voucher` t, tabContact tc
+	WHERE t.supplier = tc.supplier 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:					
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabPayable Voucher` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
+		
+#Delivery Note
+def sync_delivery_note_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabDelivery Note` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabDelivery Note` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))				
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabDelivery Note` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabDelivery Note` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
+
+#Purchase Receipt
+def sync_purchase_receipt_supplier_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.supplier, 
+	ta.name as supplier_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabPurchase Receipt` t, tabAddress ta
+	WHERE t.supplier = ta.supplier
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabPurchase Receipt` SET
+			supplier_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['supplier_address'],address_display,rec['id']))				
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.supplier, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabPurchase Receipt` t, tabContact tc
+	WHERE t.supplier = tc.supplier 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:					
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabPurchase Receipt` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
+
+#Installation Note
+def sync_installation_note_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabInstallation Note` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabInstallation Note` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))				
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabInstallation Note` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabInstallation Note` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
+		
+#Maintenance Schedule
+def sync_maintenance_schedule_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabMaintenance Schedule` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabMaintenance Schedule` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))	
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabMaintenance Schedule` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabMaintenance Schedule` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))	
+				
+#Customer Issue
+def sync_customer_issue_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabCustomer Issue` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabCustomer Issue` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabCustomer Issue` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabCustomer Issue` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))
+		
+#Maintenance Visit
+def sync_maintenance_visit_customer_data():
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
+	FROM `tabMaintenance Visit` t, tabAddress ta
+	WHERE t.customer = ta.customer
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
+											
+		webnotes.conn.sql("""
+		UPDATE `tabMaintenance Visit` SET
+			customer_address = %s,
+			address_display = %s
+			WHERE name = %s
+		""",(rec['customer_address'],address_display,rec['id']))	
+
+	data_rec = webnotes.conn.sql("""
+	SELECT t.name as id,t.customer, 
+	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
+	FROM `tabMaintenance Visit` t, tabContact tc
+	WHERE t.customer = tc.customer 
+	AND t.docstatus !=2
+	ORDER BY t.name
+	""", as_dict=1)
+	
+	for rec in data_rec:			
+		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
+											
+		webnotes.conn.sql("""
+		UPDATE `tabMaintenance Visit` SET
+			contact_person = %s,
+			contact_mobile = %s,
+			contact_email = %s,
+			contact_display = %s			
+			WHERE name = %s
+		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))			
+
+#lead phone data sync
+def sync_lead_phone():
+	webnotes.conn.sql("""
+		update ignore tabLead set
+			phone = contact_no
+			where contact_no is not null			
+		""")
diff --git a/patches/doctype_permission_patch.py b/patches/doctype_permission_patch.py
new file mode 100644
index 0000000..2bb7cf1
--- /dev/null
+++ b/patches/doctype_permission_patch.py
@@ -0,0 +1,74 @@
+import webnotes
+
+def set_doctype_permissions():
+	
+	# remove descriptions
+	webnotes.conn.sql("update tabDocType set description=null")
+		
+	from webnotes.modules.module_manager import reload_doc
+	reload_doc('core','doctype','custom_script')
+	reload_doc('core','doctype','custom_field')
+	reload_doc('core','doctype','property_setter')
+	
+	# remove admin rights
+	webnotes.conn.sql("delete from tabUserRole where role in ('Administrator','Customer','Supplier') and parent!='Administrator'")	
+	
+	# create custom scripts
+	create_custom_scripts()
+
+	# remove script fields
+	reload_doc('core','doctype','doctype')
+
+	# allow sys manager to read doctype, custom script
+	allow_sys_manager()
+	
+def create_custom_scripts():
+	
+	cs_list = webnotes.conn.sql("select name, server_code, client_script from tabDocType where ifnull(server_code,'')!='' or ifnull(client_script,'')!=''")
+	
+	from webnotes.model.doc import Document
+	
+	for c in cs_list:
+		if c[1]:
+			cs = Document('Custom Script')
+			cs.dt = c[0]
+			cs.script_type = 'Server'
+			cs.script = c[1]
+			try:
+				cs.save(1)
+			except NameError:
+				pass
+
+		if c[2]:
+			cs = Document('Custom Script')
+			cs.dt = c[0]
+			cs.script_type = 'Client'
+			cs.script = c[2]
+			try:
+				cs.save(1)
+			except NameError:
+				pass
+
+def allow_sys_manager():
+	from webnotes.model.doc import Document
+
+	if not webnotes.conn.sql("select name from tabDocPerm where parent='DocType' and role='System Manager' and `read`=1"):
+		d = Document('DocPerm')
+		d.parent = 'DocType'
+		d.parenttype = 'DocType'
+		d.parentfield = 'permissions'
+		d.role = 'System Manager'
+		d.read = 1
+		d.save(1)
+
+	
+	if not webnotes.conn.sql("select name from tabDocPerm where parent='Custom Script' and role='System Manager' and `write`=1"):
+		d = Document('DocPerm')
+		d.parent = 'Custom Script'
+		d.parenttype = 'DocType'
+		d.parentfield = 'permissions'
+		d.role = 'System Manager'
+		d.read = 1
+		d.write = 1
+		d.create = 1
+		d.save(1)
\ No newline at end of file
diff --git a/patches/feed_patch.py b/patches/feed_patch.py
new file mode 100644
index 0000000..d368aa0
--- /dev/null
+++ b/patches/feed_patch.py
@@ -0,0 +1,103 @@
+# long patches
+import webnotes
+
+def set_subjects_and_tagfields():
+	subject_dict = {
+		'Item':'%(item_name)s',
+		'Customer':' ',
+		'Contact':'%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(contact_no)s',
+		'Supplier':' ',
+		'Lead':'%(lead_name)s from %(company_name)s | To Discuss: %(to_discuss)s',
+		'Quotation':'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
+		'Enquiry':'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
+		'Sales Order':'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
+		'Delivery Note':'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
+		'Indent':'%(per_ordered)s% ordered',
+		'Purchase Order':'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
+		'Purchase Receipt':'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
+		'Receivable Voucher':'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
+		'Payable Voucher':'From %(supplier_name)s due on %(due_date)s | %(outstanding_amount)s outstanding',
+		'Journal Voucher':' ',
+		'Serial No':'%(item_code)s',
+		'Project':' ',
+		'Ticket':'%(subject)s',
+		'Timesheet':'%(owner)s',
+		'Support Ticket':'%(problem_description)s',
+		'Installation Note':'At %(customer_name)s on %(inst_date)s',
+		'Maintenance Visit':'To %(customer_name)s on %(mntc_date)s',
+		'Customer Issue':'%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
+		'Employee':'%(employee_name)s',
+		'Expense Voucher':'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
+		'Appraisal':'',
+		'Leave Application':'From %(employee_name)s, %(designation)s',
+		'Salary Structure':'For %(employee_name)s',
+		'Salary Slip':'For %(employee_name)s, %(designation)s',
+		'Bill of Materials':'%(item_code)s'
+	}
+	
+	tags_dict = {
+		'Item':'item_group',
+		'Customer':'customer_group,customer_type',
+		#'Contact':'',
+		'Supplier':'supplier_type',
+		'Lead':'status,source',
+		'Quotation':'status',
+		'Enquiry':'',
+		'Sales Order':'status',
+		'Delivery Note':'',
+		'Indent':'',
+		'Purchase Order':'',
+		'Purchase Receipt':'',
+		'Receivable Voucher':'',
+		'Payable Voucher':'',
+		'Journal Voucher':'voucher_type',
+		'Serial No':'status',
+		'Project':'status',
+		'Ticket':'status',
+		'Timesheet':'',
+		'Support Ticket':'',
+		'Installation Note':'',
+		'Maintenance Visit':'completion_status,maintenance_type',
+		'Customer Issue':'status',
+		'Employee':'status',
+		'Expense Voucher':'approval_status',
+		'Appraisal':'',
+		'Leave Application':'leave_type',
+		'Salary Structure':'',
+		'Bill of Materials':''
+	}
+	
+	description_dict = {
+		'Property Setter':'Property Setter overrides a standard DocType or Field property',
+		'Custom Field':'Adds a custom field to a DocType',
+		'Custom Script':'Adds a custom script (client or server) to a DocType'
+	}
+	
+	alldt = []
+	
+	for dt in subject_dict:
+		webnotes.conn.sql('update tabDocType set subject=%s where name=%s', (subject_dict[dt], dt))
+		if not dt in alldt: alldt.append(dt)
+	
+	for dt in tags_dict:
+		webnotes.conn.sql('update tabDocType set tag_fields=%s where name=%s', (tags_dict[dt], dt))
+		if not dt in alldt: alldt.append(dt)
+
+	for dt in description_dict:
+		webnotes.conn.sql('update tabDocType set description=%s where name=%s', (description_dict[dt], dt))
+		if not dt in alldt: alldt.append(dt)
+	
+	#from webnotes.modules.export_module import export_to_files
+	#for dt in alldt:
+	#	export_to_files(record_list=[['DocType',dt]])
+
+def support_patch():
+	# relaod support and other doctypes
+	
+	from webnotes.modules.module_manager import reload_doc
+	
+	webnotes.model.delete_doc('DocType','Support Ticket')
+	reload_doc('setup','doctype','support_email_settings')
+	reload_doc('maintenance','doctype','support_ticket')
+	reload_doc('maintenance','doctype','support_ticket_response')
+	
diff --git a/patches/patch.py b/patches/patch.py
new file mode 100644
index 0000000..0ab6912
--- /dev/null
+++ b/patches/patch.py
@@ -0,0 +1,1099 @@
+# REMEMBER to update this
+# ========================
+last_patch = 276
+
+#-------------------------------------------
+
+def execute(patch_no):
+	import webnotes
+	from webnotes.modules.import_module import import_from_files
+	from webnotes.modules.module_manager import reload_doc
+
+	from webnotes.model.code import get_obj
+	sql = webnotes.conn.sql
+	from webnotes.utils import cint, cstr, flt
+	from webnotes.model.doc import Document
+
+	if patch_no==33:
+		pass
+	elif patch_no==34:
+		webnotes.conn.sql("update `tabDocField` set options = 'Letter Head', print_hide = 1 where fieldname = 'letter_head' and fieldtype = 'Link'")
+	elif patch_no==35:
+		webnotes.conn.sql("update tabDocType set module = 'Event Updates' where name = 'Feed Control'")
+	elif patch_no==36:
+		# remove delivery note foreign key in Serial Number
+		from webnotes.model.db_schema import DbTable
+		t = DbTable('Serial No')
+		fk_list  = t.get_foreign_keys()
+		for f in fk_list:
+			if f[0]=='delivery_note_no':
+				webnotes.conn.commit()
+				webnotes.conn.sql("alter table `tabSerial No` drop foreign key `%s`" % f[1])
+				webnotes.conn.begin()
+				webnotes.conn.sql("update tabDocField set fieldtype='Data' where fieldname='delivery_note_no' and parent='Serial No' limit 1")
+	elif patch_no==37:
+		import os
+		mod_path = webnotes.defs.modules_path
+		path_list = []
+		for m in os.listdir(mod_path):
+			for t in ['doctype', 'page', 'search_criteria']:
+				dt_path = os.path.join(mod_path, m, t)
+				if os.path.exists(dt_path):
+					for dt in os.listdir(dt_path):
+						if '.' not in dt and os.path.exists(os.path.join(dt_path, dt, dt+ '.txt')):
+							path_list.append(os.path.join(dt_path, dt, dt+ '.txt'))
+
+		for d in path_list:
+			doclist = eval(open(d,'r').read())
+			webnotes.conn.sql("update `tab%s` set module = '%s' where name = '%s'" % (doclist[0]['doctype'], doclist[0]['module'], doclist[0]['name']))
+	
+	elif patch_no==38:
+		import webnotes
+		webnotes.conn.set_global("system_message", "System Updates: Hello! You would have noticed some changes on the Home Page. As a part of our commitment to make the system more friendly and social, we have re-designed the feed so that now you will only see feed that is relevant to you (either you have created something or you have been mentioned in the document).<br><br>On the individual listings, you can add tags and also color them!<br><br>You will also get time-to-time updates from our side here. Do keep sending your feedback at support@erpnext.com.")
+		webnotes.conn.set_global("system_message_id", "1")
+
+	elif patch_no == 39:
+		pass
+
+	elif patch_no == 40:
+		
+		import_from_files(record_list=[['material_management','doctype','item']])
+	elif patch_no == 42:
+		acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')")
+		for d in acc:
+			sql("update tabAccount set is_pl_account = 'Yes' where lft >= '%s' and rgt <= '%s'" % (d[1], d[2]))
+	elif patch_no == 43:
+		import webnotes.model
+		webnotes.model.delete_doc('Page', 'Module Manager')
+	
+	# cleanup of Service, Customer Support, Utilities Modules
+	# -------------------------------------------------------
+	elif patch_no == 44:
+		from webnotes.model import delete_doc
+
+		for dt in sql("select name from tabDocType where module in ('Customer Support')"):
+			delete_doc('DocType', dt[0])
+
+		for dt in sql("select name from `tabSearch Criteria` where module in ('Customer Support')"):
+			delete_doc('Search Criteria', dt[0])
+
+		for dt in sql("select name from tabPage where module in ('Customer Support')"):
+			delete_doc('Page', dt[0])
+
+		# move a couple
+		webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % ('DocType', '%s', '%s'), ('Application Internal', 'Patch Util'))
+		webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % ('DocType', '%s', '%s'), ('Application Internal', 'DocType Property Setter'))
+
+		# remove utilities
+		webnotes.conn.sql('delete from `tabModule Def` where name in ("Customer Support", "Utilities")')
+		
+	elif patch_no == 45:
+		webnotes.conn.sql('delete from tabDocField where options="Ticket Response Detail"')
+
+	elif patch_no == 46:
+		import webnotes
+		webnotes.conn.set_global("system_message", "<b>SYSTEM DOWNTIME:</b> Hello! As part of our commitment to keep improving the service, we are planning a scheduled maintenance on our servers for 4 hrs on 16-Jan-2011(Sunday), from 10AM to 2PM. Do keep sending your feedback at support@erpnext.com.")
+		webnotes.conn.set_global("system_message_id", "2")
+
+	elif patch_no == 47:
+		import webnotes
+		webnotes.conn.set_global("system_message", "")
+		webnotes.conn.set_global("system_message_id", "3")
+
+	elif patch_no == 48:
+		webnotes.conn.sql("update tabDocField set options = 'Print Heading' where fieldname = 'select_print_heading'")
+
+	elif patch_no == 49:
+		webnotes.conn.sql("update tabDocType set autoname = '' where name = 'Search Criteria'")
+	elif patch_no == 50:
+		sql("update tabDocField set in_filter = 1 where fieldname in ('cost_center', 'income_account', 'Item Group') and parent = 'RV Detail'")
+	elif patch_no == 51:
+		sql("update tabDocField set options = 'link:Print Heading' where fieldtype = 'Select' and fieldname = 'select_print_heading' and parent = 'POS Setting'")
+	elif patch_no == 52:
+		sql("update tabDocField set print_hide = 1 where fieldname = 'letter_head'")
+	elif patch_no == 53:
+		sql("update tabDocType set search_fields = 'lead_name,lead_owner,status,contact_by,contact_date' where name = 'Lead'")
+	elif patch_no == 54:
+		sql("delete from tabDocField where parent = 'Supplier' and label = 'Supplier Contacts' and fieldtype = 'Section Break'")
+	elif patch_no == 55:
+		sql("commit")
+		try:
+			sql("alter table tabFeed add column `_user_tags` varchar(180)")
+		except Exception, e:
+			if e.args[0]!=1060:
+				raise e
+	elif patch_no == 56:
+		sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'")
+	elif patch_no == 57:
+		
+		import_from_files(record_list=[['crm','doctype','sales_order_detail']])
+	elif patch_no == 58:
+		# module def patches
+		sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')")
+		sql("delete from `tabModule Def Item` where doc_type in ('Separator', 'Setup Forms', 'More Reports')")
+		sql("delete from `tabModule Def Item` where doc_name = 'Project Activity'")
+		sql("update `tabModule Def` set module_label = 'People', disabled='No', is_hidden='No' where name = 'My Company'")
+		
+		# insert new module items
+		from webnotes.model.doc import make_autoname
+		if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Ticket'"):
+			sql("""insert into `tabModule Def Item` 
+				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values 
+				(%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Ticket', 'Task', 1)""", make_autoname('MDI.#####'))
+
+		if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Timesheet'"):
+			sql("""insert into `tabModule Def Item` 
+				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values 
+				(%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Timesheet', 'Timesheet', 2)""", make_autoname('MDI.#####'))
+			
+		if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Projects'"):
+			sql("""insert into `tabModule Def Item` 
+				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values 
+				(%s, 'Projects', 'Module Def', 'items', 0, 'Pages', 'Projects', 'Gantt Chart', 1)""", make_autoname('MDI.#####'))
+				
+	elif patch_no == 59:
+		webnotes.conn.set_value('Control Panel',None,'mail_footer','')
+		webnotes.conn.set_global('global_mail_footer','<div style="margin-top:8px; padding: 8px; font-size: 11px; text-align:right; border-top: 1px solid #AAA">Sent via <a href="https://www.erpnext.com">ERPNext</a></div>')
+	elif patch_no == 60:
+		sql("delete from `tabModule Def Item` where display_name = 'Point of Sales'")
+	elif patch_no == 61:
+		sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)")
+	elif patch_no == 62:
+		# Import Supplier Quotation
+		
+		import_from_files(record_list=[['srm','doctype','supplier_quotation']])
+		# Adding Status Filter
+		sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')")
+		# Import Other Charges
+		
+		import_from_files(record_list=[['setup','doctype','other_charges']])
+	elif patch_no == 63:
+		sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'")
+		
+		import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']])
+	elif patch_no == 64:
+		sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')")
+		sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')")
+		sql("update tabDocField set `report_hide` = 0 where fieldname in ('email_id','phone_1','fax_1') and parent = 'Customer'")
+	elif patch_no == 65:
+		# Monthly Trend Analyzer <-> Trend Analyzer
+		sql("update `tabSearch Criteria` set criteria_name = 'Trend Analyzer' where criteria_name = 'Monthly Trend Analyzer' and name = 'SRCH/00159'")
+		sql("update `tabModule Def Item` set display_name = 'Trend Analyzer' where parent = 'Analysis' and display_name = 'Monthly Trend Analyzer'")
+	elif patch_no == 66:
+		import webnotes
+		webnotes.conn.set_global("system_message", """<h3>UI Updates</h3>Based on user feedback, we have made a couple of changes in the UI:<ul><li>Sidebar menus are now collapsable</li><li>Forms are now scrollable (we removed the confusing tabs)</li><li>Feed is a lot more descriptive</li></ul>Do send us your feedback!""")
+		webnotes.conn.set_global("system_message_id", "4")
+		
+		sql("update `tabModule Def Item` set doc_type = 'Setup Forms' where doc_name in ('TDS Payment', 'TDS Return Acknowledgement', 'Form 16A', 'Period Closing Voucher', 'IT Checklist')")
+		from webnotes.session_cache import clear_cache
+		clear_cache(webnotes.session['user'])
+	elif patch_no == 67:
+		sql("update `tabDocField` set in_filter = 1 where fieldname = 'brand' and parent = 'RV Detail'")
+		sql("delete from `tabModule Def Item` where (display_name = 'Sales Invoice' and parent = 'CRM') or (display_name = 'Purchase Invoice' and parent = 'SRM')")
+	elif patch_no == 68:
+		from webnotes.modules.import_module import import_from_files
+		import_from_files(record_list=[['payroll','doctype','employee'],['roles','Role','Employee']])
+	elif patch_no == 69:
+		# delete flds from employee master
+		p = get_obj('Patch Util')
+		emp_del_flds = ['month_of_birth']
+		for f in emp_del_flds:
+			p.delete_field('Employee', f)
+
+		sql("Update tabDocField set `default` = 'Active' where fieldname = 'status' and parent = 'Employee'")
+
+		# map parent flds
+		fld_map = ['cell_number', 'personal_email', 'person_to_be_contacted', 'relation', 'emergency_phone_number', 'pan_number', 'passport_number', 'date_of_issue', 'valid_upto', 'place_of_issue', 'marital_status', 'blood_group', 'permanent_accommodation_type']
+
+		emp_prof = sql("select t1.name, t1.employee, t1.permanent_address_line_1, t1.permanent_address_line_2, t1.city1, t1.state1, t1.country1, t1.pin_code1, t1.phn_no1, t1.present_address_line_1, t1.present_address_line_2, t1.city2, t1.state2, t1.country2, t1.pin_code2, t1.phn_no2, t1.fathers_name, t1.fathers_occupation, t1.mothers_name, t1.mothers_occupation, t1.spouses_name, t1.spouses_occupation, t1.height_cms, t1.weight_kgs, t1.allergies, t1.other_medical_concerns, t1.physical_handicap from `tabEmployee Profile` t1, `tabEmployee` t2 where t1.employee = t2.name")
+		for e in emp_prof:
+			prof_obj = get_obj('Employee Profile', e[0])
+			emp_obj = get_obj('Employee', e[1])
+			for d in fld_map:
+				emp_obj.doc.fields[d] = prof_obj.doc.fields[d]
+			emp_obj.doc.current_accommodation_type = prof_obj.doc.present_accommodation_type
+		 
+			# address
+			per_addr = cstr(e[2]) + '\n' + cstr(e[3]) + '\n' + cstr(e[4]) + '\n' + cstr(e[5]) + ', ' + cstr(e[6]) + '\n' + 'PIN - ' + cstr(e[7]) + '\n' + 'Ph. No' + cstr(e[8])
+			cur_addr = cstr(e[9]) + '\n' + cstr(e[10]) + '\n' + cstr(e[11]) + '\n' + cstr(e[12]) + ', ' + cstr(e[13]) + '\n' + 'PIN - ' + cstr(e[14]) + '\n' + 'Ph. No' + cstr(e[15])
+			emp_obj.doc.permanent_address = per_addr
+			emp_obj.doc.current_address = cur_addr
+			#family
+			fam = "Father's Name: " + cstr(e[16]) + '\n' + "Father's Occupation: " + cstr(e[17]) + '\n' + "Mother's Name: " + cstr(e[18]) + '\n' + "Mother's Occupation: " + cstr(e[19]) + '\n' + "Spouse's Name: " + cstr(e[20]) + '\n' + "Spouse's Occupation: " + cstr(e[21])
+			emp_obj.doc.family_background = fam
+			# health
+			health = 'Height(cms): ' + cstr(e[22]) + '\n' + 'Weight(kgs): ' + cstr(e[23]) + '\n' + 'Allergies: ' +cstr( e[24]) + '\n' + 'Other Medical Concern: ' + cstr(e[25]) + '\n' + 'Physically Handicapped(if any): ' + cstr(e[26])
+			emp_obj.doc.health_details = health
+			emp_obj.doc.save()
+
+
+		# map tables
+		tbl_list = ['Experience In Company Detail', 'Previous Experience Detail', 'Educational Qualifications Detail']
+		for t in tbl_list:
+			sql("update `tab%s` t1, `tabEmployee Profile` t2 set t1.parent = t2.employee, t1.parenttype = 'Employee' where t1.parent = t2.name" % t)
+
+
+		# overwrite idx?????????
+
+
+		# delete emp profile
+		webnotes.model.delete_doc('DocType', 'Employee Profile')
+		for e in emp_prof:
+			webnotes.model.delete_doc('Employee Profile', e[0])
+
+	elif patch_no == 70:
+		# update search criteria module -> System
+		sql("update tabDocType set module='System' where name='Search Criteria'")
+		
+		# Cleanups to Contact
+		sql("update tabDocField set fieldtype='Data' where options='Designation' and parent='Contact'")
+		sql("update tabDocField set fieldtype='Data' where options='Department' and parent='Contact'")
+		sql("update tabDocField set depends_on='eval:(cint(doc.is_customer) || cint(doc.is_supplier) || cint(doc.is_sales_partner))' where fieldname='is_primary_contact' and parent='Contact'")
+
+		# import Contact, Employee
+		from webnotes.modules.import_module import import_from_files
+		import_from_files(record_list=[['tools','doctype','contact']])
+
+		
+		# remove last_contact_date from Lead
+		sql("delete from tabDocField where fieldname='last_contact_date' and parent='Lead'")
+		
+	elif patch_no == 71:
+		# Make Stock Qty and Conversion Factor field editable. Also no need to mention Conversion factor in table can do it directly
+		sql("update `tabDocField` set `permlevel` = 0, `width` = '100px', `trigger` = 'Client' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname in ('stock_qty','conversion_factor')")
+		sql("update `tabDocField` set `width` = '100px' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname = 'stock_uom'")
+
+	elif patch_no == 72:
+		# Core Patch
+		# ----------
+		
+		from webnotes.modules.import_module import import_from_files
+		
+		# import module def
+		import_from_files(record_list = [['core', 'Module Def', 'Core']])
+	elif patch_no == 73:
+		# set module in DocTypes
+		sql("update tabDocType set module='Core' where name in ('DocType', 'DocField', 'DocPerm', 'Role', 'UserRole', 'Profile', 'Print Format', 'DocFormat', 'Control Panel', 'Event', 'Event Role', 'Event User', 'DefaultValue', 'Default Home Page', 'File', 'File Group', 'File Data', 'Letter Head', 'Module Def', 'Module Def Item', 'Module Def Role', 'Page', 'Page Role', 'Search Criteria', 'DocType Label', 'DocType Mapper', 'Field Mapper Detail', 'Table Mapper Detail')")
+		
+		# set module in Page
+		sql("update tabPage set module='Core' where name='Login Page'")
+		
+		# move file browser to Tools
+		sql("update tabPage set module='Tools' where name='File Browser'")
+		sql("update tabDocType set module='Tools' where name='File Browser Control'")
+		sql("update tabDocType set module='Application Internal' where name='Profile Control'")
+	elif patch_no == 74:
+		p = get_obj('Patch Util')
+		# permission
+		p.delete_permission('Employee', 'Administrator', 0)
+		p.delete_permission('Employee', 'Administrator', 1)
+		p.add_permission('Employee', 'Employee', 0, read = 1, match = 'owner')
+		p.add_permission('Employee', 'Employee', 1, read = 1, match = 'owner')
+		sql("delete from `tabDocField` where parent = 'Employee' and label = 'Payroll Rule'")
+	elif patch_no == 75:
+		#sal structure patch
+		# import
+		from webnotes.modules.import_module import import_from_files
+		import_from_files(record_list=[['payroll','doctype','salary_structure'], ['payroll','doctype','earning_detail'],['payroll','doctype','deduction_detail']])
+	elif patch_no == 76:
+		# property
+		p = get_obj('Patch Util')
+		p.set_field_property('Salary Structure', 'is_active', 'default', 'Yes')
+		p.set_field_property('Salary Structure', 'ctc', 'reqd', '1')
+		p.set_field_property('Earning Detail', 'modified_value', 'width', '')
+		p.set_field_property('Earning Detail', 'modified_value', 'trigger', 'Client')
+		p.set_field_property('Deduction Detail', 'd_modified_amt', 'width', '')
+		p.set_field_property('Earning Detail', 'd_modified_amt', 'trigger', 'Client')
+		sql("Update tabDocField set `description` = 'You can create more earning and deduction type from Setup --> HR' where label = 'Earning & Deduction' and parent = 'Salary Structure' and fieldtype = 'Section Break'")
+
+		# delete
+		sql("update `tabSalary Structure` set net_pay = total")
+		sql("delete from tabDocField where label in ('LWP Help', 'Calculate Total', 'Total') and parent = 'Salary Structure'")
+		sql("delete from tabDocPerm where parent in ('Earning Detail', 'Deduction Detail')")
+
+
+		# permission
+		p.delete_permission('Salary Structure', 'Administrator', 0)
+		p.delete_permission('Salary Structure', 'Administrator', 1)
+		p.add_permission('Salary Structure', 'Employee', 0, read = 1, match = 'owner')
+		p.add_permission('Salary Structure', 'Employee', 1, read = 1, match = 'owner')
+	elif patch_no == 77:
+		# sal slip patch
+		# import
+		from webnotes.modules.import_module import import_from_files
+		import_from_files(record_list=[['payroll','doctype','salary_slip'], ['payroll','doctype','ss_earning_detail'],['payroll','doctype','ss_deduction_detail'], ['mapper', 'DocType Mapper', 'Salary Structure-Salary Slip']])
+	elif patch_no == 78:
+		p = get_obj('Patch Util')
+		# delete
+		sql("update `tabSalary Slip` set leave_encashment_amount = encashment_amount")
+		p.delete_field('Salary Slip', 'encashment_amount')
+		p.delete_field('Salary Slip', 'year')
+		p.delete_field('Salary Slip', 'flag')
+		sql("delete from tabDocField where label = 'Process Payroll' and parent = 'Salary Slip'")
+
+		# field property
+		p.set_field_property('Salary Slip', 'bank_name', 'permlevel', '1')
+		p.set_field_property('Salary Slip', 'leave_without_pay', 'permlevel', '0')
+		p.set_field_property('Salary Slip', 'leave_without_pay', 'trigger', 'Client')
+		p.set_field_property('SS Earning Detail', 'e_type', 'permlevel', '0')
+		p.set_field_property('SS Earning Detail', 'e_type', 'fieldtype', 'Link')
+		p.set_field_property('SS Earning Detail', 'e_type', 'options', 'Earning Type')
+		p.set_field_property('SS Deduction Detail', 'd_type', 'permlevel', '0')
+		p.set_field_property('SS Deduction Detail', 'd_type', 'fieldtype', 'Link')
+		p.set_field_property('SS Deduction Detail', 'd_type', 'options', 'Deduction Type')
+		sql("update `tabSS Earning Detail` set e_modified_amount = e_amount")
+		sql("update `tabSS Deduction Detail` set d_modified_amount = d_amount")
+
+		# permission
+		p.delete_permission('Salary Slip', 'Administrator', 0)
+		p.delete_permission('Salary Slip', 'Administrator', 1)
+		p.add_permission('Salary Slip', 'Employee', 0, read = 1, match = 'owner')
+		p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner')
+	elif patch_no == 79:
+		# Import Modules
+		
+		import_from_files(record_list=[['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation'],['payroll','doctype','leave_control_panel'],['payroll','doctype','holiday_list'],['payroll','doctype','holiday_list_detail'],['payroll','Module Def','Payroll']])
+	elif patch_no == 80:
+		# Holiday List
+		sql("update `tabHoliday List Detail` set description = holiday_name")
+		sql("delete from tabDocField where parent = 'Holiday List Detail' and fieldname = 'holiday_name'")
+		sql("update tabDocField set fieldtype = 'Select', options = 'link:Fiscal Year' where parent = 'Holiday List' and fieldname = 'fiscal_year'")
+		sql("delete from tabDocPerm where role in ('Administrator','HR User') and parent = 'Holiday List'")
+
+		# Leave Control Panel
+		# --------------------
+		sql("delete from `tabDocField` where parent = 'Leave Control Panel' and label in ('Leave Control Panel','Allocation Details') and fieldtype = 'Section Break'")
+		sql("delete from tabDocField where parent = 'Leave Control Panel' and fieldname in ('col_brk3','allocation_type','col_brk2','from_date','to_date','leave_transaction_type','posting_date')")
+		sql("update tabDocField set fieldtype = 'Select', options = 'link:Fiscal Year' where parent = 'Leave Control Panel' and fieldname = 'fiscal_year'")
+		sql("update tabDocField set fieldtype = 'Select', options = 'link:Leave Type' where parent = 'Leave Control Panel' and fieldname = 'leave_type'")
+		sql("update tabDocField set reqd = 1 where parent = 'Leave Control Panel' and fieldname = 'no_of_days'")
+
+		# Leave Application
+		# ------------------
+		for d in sql("select * from `tabLeave Transaction` where leave_transaction_type = 'Deduction' and ifnull(deduction_type, '') = 'Leave'", as_dict = 1):
+			lp = Document('Leave Application')
+			lp.employee = d['employee']
+			lp.leave_type = d['leave_type']
+			lp.posting_date = d['date']
+			lp.fiscal_year = d['fiscal_year']
+			lp.leave_balance = d['pre_balance']
+			lp.half_day = d['half_day']
+			lp.from_date = d['from_date']
+			lp.to_date = d['to_date']
+			lp.total_leave_days = d['total_leave']
+			lp.description = d['reason']
+			lp.docstatus = cint(d['docstatus'])
+			lp.save(1)
+
+		# Leave Allocation
+		# -----------------
+		for d in sql("select * from `tabLeave Transaction` where leave_transaction_type = 'Allocation'", as_dict = 1):
+			la = Document('Leave Allocation')
+			la.employee = d['employee']
+			la.leave_type = d['leave_type']
+			la.posting_date = d['date']
+			la.fiscal_year = d['fiscal_year']
+			la.new_leaves_allocated = d['total_leave']
+			la.total_leaves_allocated = d['total_leave']
+			la.description = d['reason']
+			la.docstatus = cint(d['docstatus'])
+			la.save(1)
+
+		# Payroll Module Def
+		# -------------------
+		sql("delete from `tabModule Def Item` where doc_name = 'Leave Transaction' and display_name = 'Leave Transaction' and parent = 'Payroll' and doc_type = 'Forms'")
+
+	elif patch_no == 81:
+		# Import Modules
+		
+		import_from_files(record_list=[['payroll','Module Def','Payroll']])
+	elif patch_no == 82:
+		sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
+		sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
+	elif patch_no == 83:
+		# delete leave transaction
+		webnotes.conn.sql("set foreign_key_checks=0")
+		sql("delete from `tabLeave Transaction`")
+		import webnotes.model
+		webnotes.model.delete_doc('DocType','Badge Settings Detail')
+		webnotes.model.delete_doc('DocType','Leave Transaction')
+		webnotes.conn.sql("set foreign_key_checks=1")
+	elif patch_no == 84:
+		p = get_obj('Patch Util')
+		p.set_field_property('SS Earning Detail', 'e_amount', 'permlevel', '1')
+		p.set_field_property('SS Deduction Detail', 'd_amount', 'permlevel', '1')
+	elif patch_no == 85:
+		# permission
+		p = get_obj('Patch Util')
+		p.add_permission('Leave Application', 'Employee', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
+		p.add_permission('Leave Application', 'Employee', 1, read = 1, match = 'owner')
+		p.add_permission('Leave Allocation', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
+		p.add_permission('Leave Allocation', 'HR User', 1, read = 1)
+		sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'")
+	elif patch_no == 86:
+		# Import Modules
+		
+		import_from_files(record_list=[['payroll','doctype','leave_type']])
+	elif patch_no == 87:
+		sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'")
+	elif patch_no == 88:
+		# Import Modules
+		
+		import_from_files(record_list=[['payroll','doctype','leave_allocation']])
+	elif patch_no == 89:
+		sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'")
+		sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'")
+	elif patch_no == 90:
+		sql("update `tabLeave Allocation` set docstatus = 1")
+	elif patch_no == 91:
+		import webnotes
+		webnotes.conn.set_global("system_message", """<h3>System Updates</h3>Based on user feedback, we have cleaned up HR module (Partly):<ul><li>Employee and Employee Profile are merged into a single document</li><li>Salary Structure and Salary Slip are now more user friendly</li><li>Leave Transaction document is now divided into 2 documents Leave Application and Leave Allocation</li></ul>We will work on Reports, Attendance and other documents of Payroll module next week<br><br> Do send us your feedback!""")
+		webnotes.conn.set_global("system_message_id", "5")
+	elif patch_no == 92:
+		sql("update tabDocField set label = 'Get Charges' where parent IN ('Sales Order','Delivery Note','Receivable Voucher') and label = 'Get Other Charges' and fieldtype = 'Button'")
+		# Automated Other Charges Calculation basis
+		sql("update tabDocField set options = '', `trigger` = 'Client' where parent IN ('Quotation','Sales Order','Delivery Note','Receivable Voucher') and label = 'Get Charges' and fieldtype = 'Button'")
+	elif patch_no == 93:
+		sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'")
+		sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'")
+	elif patch_no == 94:
+		
+		import_from_files(record_list=[['crm','doctype','sms_center']])
+	elif patch_no == 95:
+		
+		import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
+	elif patch_no == 96:
+		sql("delete from `tabModule Def Item` where doc_type = 'Reports' and display_name = 'Cenvat Credit - Input or Capital Goods' and parent = 'Accounts'")
+	elif patch_no == 97:
+		sql("update tabFeed set doc_label = 'Feed', doc_name = name where ifnull(doc_name,'') = '' and ifnull(doc_label,'') = ''")
+	elif patch_no == 98:
+		import_from_files(record_list=[['accounts','doctype','payable_voucher']])
+	elif patch_no == 99:
+		import_from_files(record_list=[['accounts','doctype','account']])
+	elif patch_no == 100:
+		p = get_obj('Patch Util')
+		p.set_field_property('Account', 'level', 'hidden', '1')
+		p.set_field_property('Account', 'level', 'print_hide', '1')
+		p.set_field_property('Account', 'account_type', 'search_index', '0')
+		p.set_field_property('TDS Detail', 'tds_category', 'width', '150px')
+		p.set_field_property('TDS Detail', 'special_tds_rate_applicable', 'width', '150px')
+		p.set_field_property('TDS Detail', 'special_tds_rate', 'width', '150px')
+		p.set_field_property('TDS Detail', 'special_tds_limit', 'width', '150px')
+	elif patch_no == 101:
+		# Leave Application Details and Leave Allocation Details
+		sql("update tabDocField set search_index = 1, in_filter = 1 where fieldname in ('employee','leave_type','fiscal_year') and parent in ('Leave Application','Leave Allocation')")
+		get_obj('DocType','Leave Application').doc.save()
+		get_obj('DocType','Leave Allocation').doc.save()
+	elif patch_no == 102:
+		# make item description field editable in production order
+		sql("update tabDocField set permlevel = 0 where fieldname = 'description' and parent = 'Production Order'")
+	elif patch_no == 103:
+		sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'")
+	elif patch_no == 104:
+		
+		import_from_files(record_list=[['payroll','search_criteria','stdsrch_00001'],['payroll','search_criteria','stdsrch_00002'],['payroll','search_criteria','stdsrch_00003'],['payroll','Module Def','Payroll'],['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation']])
+	elif patch_no == 105:
+		# Employee Leave Balance
+		sql("delete from `tabModule Def Item` where parent = 'Payroll' and doc_type = 'Reports' and display_name IN ('Employeewise Leave Transaction Details','Employeewise Balance Leave Report')")
+		# Update Search Fields
+		sql("update tabDocType set search_fields = 'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
+		sql("update tabDocType set search_fields = 'employee,employee_name,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
+	elif patch_no == 106:
+		for d in sql("select name,employee,employee_name from `tabLeave Allocation`"):
+			if not cstr(d[2]):
+				sql("update `tabLeave Allocation` set employee_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Employee',cstr(d[1]),'employee_name'), cstr(d[0])))
+		for d in sql("select name,employee,employee_name from `tabLeave Application`"):
+			if not cstr(d[2]):
+				sql("update `tabLeave Application` set employee_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Employee',cstr(d[1]),'employee_name'), cstr(d[0])))
+	elif patch_no == 107:
+		sql("delete from `tabDocField` where fieldname = 'fiscal_year' and parent = 'Employee'")
+	elif patch_no == 108:
+		import_from_files(record_list=[['payroll','search_criteria','srch_std_00013']])
+	elif patch_no == 109:
+		import_from_files(record_list=[['payroll','search_criteria','srch_std_00015']])
+	elif patch_no == 110:
+		import_from_files(record_list=[['payroll','doctype','salary_structure'], ['payroll', 'doctype', 'salary_slip']])
+	elif patch_no == 111:
+		sql("update tabDocType set search_fields = 'transfer_date, from_warehouse, to_warehouse, purpose, remarks' where name = 'Stock Entry'")
+	elif patch_no == 112:
+		sql("delete from tabDocField where label = 'Get Other Charges' and fieldtype = 'Button' and parent = 'Receivable Voucher'")
+	elif patch_no == 113:
+		sql("update tabDocField set reqd = 1 where parent = 'Customer' and fieldname = 'phone_1'")
+	elif patch_no == 114:
+		for d in sql("select name, master_name, credit_days, credit_limit from tabAccount where master_type = 'Customer'"):
+			if cstr(d[1]):
+				days, limit = cint(d[2]), flt(d[3])
+				cust_det = sql("select credit_days, credit_limit from tabCustomer where name = '%s'" % (cstr(d[1])))
+				if not days: days = cust_det and cint(cust_det[0][0]) or 0
+				if not limit: limit = cust_det and flt(cust_det[0][1]) or 0
+				sql("COMMIT")
+				sql("START TRANSACTION")
+				sql("update tabAccount set credit_days = '%s', credit_limit = '%s' where name = '%s'" % (days, limit, cstr(d[0])))
+				sql("COMMIT")
+
+	elif patch_no == 115:
+		# patch for timesheet cleanup
+		from webnotes.model import delete_doc
+		delete_doc('DocType', 'Timesheet Detail')
+		
+		from webnotes.modules.import_module import import_from_files
+		import_from_files(record_list = [['Projects', 'DocType', 'Timesheet'], ['Projects', 'DocType', 'Timesheet Detail'], ['Projects', 'DocType', 'Activity Type']])
+
+	elif patch_no == 116:
+		# again!
+		from webnotes.model import delete_doc
+		delete_doc('DocType', 'Timesheet Detail')
+		
+		from webnotes.modules.import_module import import_from_files
+		import_from_files(record_list = [['Projects', 'DocType', 'Timesheet Detail']])
+	elif patch_no == 117:
+		op = '\n' + 'Walk In'
+		sql("update `tabDocField` set `options` = concat(options, %s) where parent = 'Enquiry' and fieldname = 'source' and options not like '%%Walk%%'", op)
+	elif patch_no == 118:
+		from webnotes.utils import get_defaults
+		ss = sql("select name, net_pay from `tabSalary Slip`")
+		for d in ss:
+			if d[1]:
+				w = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], d[1])
+				sql("update `tabSalary Slip` set net_pay_in_words = '%s' where name = '%s'" % (w, d[0]))
+	elif patch_no == 119:
+		sql("update tabDocType set in_create = 1 where name = 'Profile'")
+	elif patch_no == 120:
+		sql("update tabDocField set permlevel = 0 where parent = 'Sales and Purchase Return Wizard' and fieldname = 'return_date'")
+	elif patch_no == 121:
+		import_from_files(record_list = [['CRM', 'DocType', 'Return Detail'], ['Material Management', 'DocType', 'Sales and Purchase Return Wizard']])
+	elif patch_no == 122:
+		sql("delete from tabDocField where (fieldname = 'serial_no' or label = 'Warrany Status') and parent = 'Sales Order'")
+	elif patch_no == 123:
+		import_from_files(record_list = [['CRM', 'Module Def', 'CRM'], ['CRM', 'Search Criteria', 'STDSRCH/00004']])
+	elif patch_no == 124:
+		import webnotes
+		webnotes.conn.set_global("system_message", """<h3>Updates(New)</h3>We have added a new report in the Selling Module.<br><br><b>Sales Personwise Transaction Summary: </b>In this report you can see sales person's contribution in a particular order, delivery or invoice. You can select voucher type in "Based On" filter.<br><br> Do send us your feedback!""")
+		webnotes.conn.set_global("system_message_id", "5")
+	elif patch_no == 125:
+		import_from_files(record_list = [['Material Management', 'DocType', 'Delivery Note']])
+	elif patch_no == 126:
+		sql("delete from tabDocField where parent = 'Delivery Note' and label in ('Make Sales Invoice', 'Make Installation Note', 'Intro Note')")
+	elif patch_no == 127:
+		sql("delete from tabDocPerm where role = 'All' and parent = 'Expense Voucher' and (permlevel = 0 or permlevel = 2)")
+		p = get_obj('Patch Util')
+		p.add_permission('Expense Voucher', 'Employee', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
+		p.add_permission('Expense Voucher', 'HR Manager', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
+		p.add_permission('Expense Voucher', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
+	elif patch_no == 128:
+		from webnotes.modules import import_module
+		import_module.import_from_files(record_list=[['crm','doctype','sales_order'], ['crm','doctype','sales_order_detail'],  ['material_management','doctype','delivery_note'], ['material_management','doctype','delivery_note_detail']])
+	elif patch_no == 129:
+		sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail' and to_table = 'RV Detail'")
+		sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Delivery Note-Receivable Voucher' and from_table = 'Delivery Note Detail' and to_table = 'RV Detail'")
+	elif patch_no == 130:
+		# update from rv
+		from webnotes.model.code import get_obj
+		from webnotes.utils import cstr
+		for d in sql("select name, docstatus from `tabReceivable Voucher` where ifnull(docstatus,0) != 0"):
+			sql("COMMIT")
+			sql("START TRANSACTION")
+			try:
+				obj = get_obj('Receivable Voucher', cstr(d[0]), with_children = 1)
+				is_submit = 1
+				if cint(d[1]) == 2: is_submit = 0
+				get_obj('Sales Common').update_prevdoc_detail(is_submit, obj)
+			except:
+				pass
+			sql("COMMIT")
+
+		# update from dn
+		from webnotes.model.code import get_obj
+		for d in sql("select name, docstatus from `tabDelivery Note` where ifnull(docstatus,0) != 0"):
+			sql("COMMIT")
+			sql("START TRANSACTION")
+			try:
+				obj = get_obj('Delivery Note', cstr(d[0]), with_children = 1)
+				is_submit = 1
+				if cint(d[1]) == 2: is_submit = 0
+				get_obj('Sales Common').update_prevdoc_detail(is_submit, obj)
+			except:
+				pass
+			sql("COMMIT")
+	elif patch_no == 131:
+		sql("update `tabDocType` set allow_trash = 1 where name = 'Purchase Other Charges'")
+		sql("update tabDocPerm set `cancel` = 1 where parent = 'Purchase Other Charges' and permlevel = 0 and `read` = 1 and `write` = 1")
+	elif patch_no == 132:
+		sql("update tabDocField set no_copy = 0 where parent = 'Receivable Voucher' and fieldname = 'customer'")
+	elif patch_no == 133:
+		from webnotes.modules import import_module
+		import_module.import_from_files(record_list=[['accounts','doctype','receivable_voucher']])
+	elif patch_no == 134:
+		sql("update tabDocField set no_copy = 1 where parent = 'Receivable Voucher' and fieldname = 'posting_time'")
+	elif patch_no == 135:
+		sql("update tabDocField set `default` = 'Today' where parent = 'Receivable Voucher' and fieldname = 'due_date'")
+	elif patch_no == 136:
+		from webnotes.modules import import_module
+		import_module.import_from_files(record_list=[['accounts','doctype','rv_detail']])
+	elif patch_no == 137:
+		from webnotes.modules import import_module
+		import_module.import_from_files(record_list=[['setup','doctype','price_list']])
+	elif patch_no == 138:
+		sql("update `tabDocType` set allow_attach = 1 where name = 'Price List'")
+	elif patch_no == 139:
+		from webnotes.modules import import_module
+		import_module.import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
+	elif patch_no == 140:
+		from webnotes.modules import import_module
+		import_module.import_from_files(record_list=[['accounts','doctype','rv_detail']])
+	elif patch_no == 141:
+		sql("delete from tabDocField where (fieldname = 'letter_head' or label = 'Letter Head') and parent = 'Company'")
+	elif patch_no == 142:
+		# fixes to letter head and personalize
+		from webnotes.model import delete_doc
+		
+		delete_doc('DocType', 'Batch Settings')
+		delete_doc('DocType', 'Batch Settings Detail')
+		delete_doc('DocType', 'Social Badge')
+		delete_doc('Page', 'Personalize Page')
+		delete_doc('DocType', 'Personalize Page Control')
+		
+		import_from_files(record_list=[['core','doctype','letter_head'], ['setup','doctype','personalize']])
+	elif patch_no == 144:
+		webnotes.conn.sql("update tabDocField set fieldtype='Code' where parent='Letter Head' and fieldname='content'")
+	elif patch_no == 145:
+		sql("update `tabDocField` set permlevel=1 where fieldname = 'group_or_ledger' and parent = 'Account'")
+	elif patch_no == 146:
+		import_from_files(record_list=[['accounts','doctype','account']])
+	elif patch_no == 147:
+		import_from_files(record_list=[['mapper', 'DocType Mapper', 'Purchase Order-Payable Voucher'], ['mapper', 'DocType Mapper', 'Purchase Receipt-Payable Voucher'], ['mapper', 'DocType Mapper', 'Purchase Order-Purchase Receipt']])
+	elif patch_no == 148:
+		sql("delete from `tabDocField` where (fieldname = 'account_balances' or label = 'Balances') and parent = 'Account'")
+		sql("update tabDocType set istable = 0, section_style = 'Simple', search_fields = 'account, period, fiscal_year, balance' where name = 'Account Balance'")
+		sql("update tabDocField set permlevel = 0 where parent = 'Account Balance'")
+		p = get_obj('Patch Util')
+		p.add_permission('Account Balance', 'Accounts User', 0, read = 1)
+		p.add_permission('Account Balance', 'Accounts Manager', 0, read = 1)
+		import_from_files(record_list=[['accounts','doctype','account_balance']])
+	elif patch_no == 149:
+		sql("update `tabAccount Balance` set account = parent")
+	elif patch_no == 150:
+		sql("update tabDocField set in_filter = 1, search_index = 1 where parent = 'Account Balance' and fieldname in ('account', 'period', 'fiscal_year', 'start_date', 'end_date')")
+		ac_bal = Document("DocType", "Account Balance")
+		ac_bal.save()
+	elif patch_no == 151:
+		sql("delete from tabDocField where label = 'Add / Manage Contacts' and fieldtype = 'Button' and parent = 'Customer'")
+		sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'note' and to_field = 'note'")
+	elif patch_no == 152:
+		import_from_files(record_list=[['crm','doctype','sales_order'], ['material_management','doctype','delivery_note'], ['crm','doctype','customer'], ['crm','doctype','shipping_address'], ['mapper', 'DocType Mapper', 'Sales Order-Delivery Note']])
+	elif patch_no == 153:
+		sql("delete from `tabDocField` where fieldname = 'sales_person' and parent = 'Customer'")
+	elif patch_no == 154:
+		import_from_files(record_list=[['material_management','doctype','serial_no'], ['maintenance','doctype','customer_issue']])
+	elif patch_no == 155:
+		for d in sql("select name, item_code from `tabSerial No`"):
+			sql("COMMIT")
+			sql("START TRANSACTION")
+			sql("update `tabSerial No` set item_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Item',cstr(d[1]),'item_name'), cstr(d[0])))
+			sql("COMMIT")
+	elif patch_no == 156:
+		sql("update tabDocField set fieldtype = 'Code' where fieldname = 'html' and parent = 'Print Format'")
+	elif patch_no == 157:
+		import_from_files(record_list=[['accounts', 'doctype', 'journal_voucher'], ['accounts', 'Print Format', 'Payment Receipt Voucher'], ['accounts', 'Print Format', 'Cheque Printing Format']])
+	elif patch_no == 158:
+		from webnotes.model.doc import addchild
+		sql("delete from tabDocField where parent = 'Customer Issue' and fieldname = 'customer_group'")
+	elif patch_no == 159:
+		sql("update tabAccount set account_type = 'Chargeable' where account_name in ('Advertising and Publicity', 'Freight & Forwarding Charges', 'Miscellaneous Expenses', 'Sales Promotion Expenses')")
+	elif patch_no == 160:
+		sql("update `tabDocType` set search_fields = 'posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount' where name = 'Receivable Voucher'")
+		sql("update `tabDocType` set search_fields = 'posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount' where name = 'Payable Voucher'")
+	elif patch_no == 161:
+		sql("update tabDocType set autoname = 'field:batch_id' where name = 'Batch'")
+		sql("update tabDocField set no_copy = 1 where parent = 'Batch' and fieldname = 'batch_id'")
+	elif patch_no == 162:
+		import_from_files(record_list=[['crm', 'search_criteria', 'sales_order_pending_items1']])
+	elif patch_no == 163:
+		sql("delete from `tabModule Def Item` where display_name = 'Sales Orderwise Pending Packing Item Summary' and parent = 'CRM'")
+		import_from_files(record_list=[['crm', 'search_criteria', 'sales_orderwise_pending_qty_to_deliver'], ['crm', 'search_criteria', 'sales_orderwise_pending_amount_to_bill'], ['crm', 'search_criteria', 'delivered_items_to_be_install']])
+	elif patch_no == 164:
+		import_from_files(record_list=[['srm', 'search_criteria', 'pending_po_items_to_receive'], ['srm', 'search_criteria', 'pending_po_items_to_bill']])
+	elif patch_no == 165:
+		pass
+	elif patch_no == 166:
+		import_from_files(record_list=[['srm', 'doctype', 'purchase_order']])
+	elif patch_no == 167:
+		if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['ax0000956', 'ax0001338']:
+			sql("delete from tabDocField where parent = 'Purchase Order' and fieldname in ('test_certificate_required', 'estimated_cost', 'transport', 'vendor_reference', 'transportation_required', 'mode_of_dispatch', 'octroi')")
+	elif patch_no == 168:
+		sql("update tabDocField set fieldtype = 'Data', options = 'Suggest' where fieldname = 'bank_name' and parent = 'Employee'")
+	elif patch_no == 169:
+		import_from_files(record_list=[['accounts', 'doctype', 'pv_detail'], ['accounts', 'doctype', 'rv_detail']])
+	elif patch_no == 170:
+		import_from_files(record_list=[['mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher']])
+	elif patch_no == 171:
+		import_from_files(record_list=[['srm', 'doctype', 'supplier']])
+	elif patch_no == 172:
+		import webnotes
+		webnotes.conn.set_global("system_message", """<b>Welcome to the new financial year 2011-2012 !!! </b><br><br> So obvious question in your mind is how to start Entries in the New Fiscal Year in ERPNext? What are the changes you have to make in the system? <br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
+		webnotes.conn.set_global("system_message_id", "6")
+	elif patch_no == 173:
+		sql("delete from tabDocField where label = 'Get Other Charges' and parent = 'Delivery Note'")
+		sql("update tabDocField set reqd = 0 where fieldname = 'posting_time' and parent = 'Serial No'")
+	elif patch_no == 174:
+		c = sql("select count(name) from `tabField Mapper Detail` where parent = 'Delivery Note-Receivable Voucher' and from_field = 'description' and to_field = 'description' and match_id = 2")
+		if c and cint(c[0][0]) > 1:
+			sql("update `tabField Mapper Detail` set match_id = 1 where parent = 'Delivery Note-Receivable Voucher' and from_field = 'description' and to_field = 'description' limit 1")
+	elif patch_no == 175:
+		import webnotes
+		webnotes.conn.set_global("system_message", """If your financial year starts on 1st April then you have make some changes in the system to start entry in the new year.<br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
+		webnotes.conn.set_global("system_message_id", "6")
+	elif patch_no == 176:
+		sql("update tabDocPerm set role='Guest', `write`=0, `create`=0 where role='Administrator' and parent='Notification Control' limit 1")
+	elif patch_no == 177:
+		sql("delete from `tabDocField` where label = 'Next Steps' and parent = 'Purchase Order'")
+		sql("update tabDocField set options = 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order' where parent = 'Stock Entry' and fieldname = 'purpose'")
+	elif patch_no == 178:
+		import_from_files(record_list = [['payroll', 'doctype', 'salary_slip']])
+	elif patch_no == 179:
+		from webnotes.utils import get_defaults
+		sl = sql("select name, net_pay from `tabSalary Slip`")
+		for d in sl:
+			in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], round(flt(d[1])))
+			sql("update `tabSalary Slip` set rounded_total = '%s', total_in_words = '%s' where name = '%s'" % (round(flt(d[1])), in_words, d[0]))
+	elif patch_no == 180:
+		sql("delete from tabDocField where parent = 'Salary Slip' and fieldname = 'net_pay_in_words'")
+	elif patch_no == 181:
+		import_from_files(record_list = [['accounts', 'doctype', 'journal_voucher']])
+	elif patch_no == 182:
+		sql("update tabDocField set options = CONCAT(options, '\nWrite Off Voucher') where fieldname = 'voucher_type' and parent = 'Journal Voucher'")
+	elif patch_no == 183:
+		sql("delete from tabDocField where label = 'SMS' and fieldtype = 'Section Break' and parent in  ('Enquiry', 'Lead', 'Sales Order', 'Delivery Note')")
+	elif patch_no == 184:
+		from webnotes.model import delete_doc
+		delete_doc('DocType', 'Feed')
+		delete_doc('DocType', 'Feed List')
+		delete_doc('DocType', 'Feed Control')
+
+		# add trigger
+		from webnotes.model.triggers import add_trigger
+		add_trigger('*','*','*','event_updates.update_feed')
+
+		webnotes.conn.commit()
+
+		try:
+			sql("drop table tabFeed")
+			sql("drop table `tabFeed List`")
+		except: pass
+
+		# import
+		from webnotes.modules.module_manager import reload_doc
+		reload_doc('event_updates','doctype','feed')
+	elif patch_no==185:
+		sql("delete from tabDocTrigger where method = 'webnotes.widgets.follow.on_docsave'")
+	elif patch_no==186:
+		from webnotes.modules.module_manager import reload_doc
+		reload_doc('event_updates','doctype','feed')
+	elif patch_no == 187:
+		sql("update tabDocType set autoname = '' where name = 'QA Inspection Report'")
+	elif patch_no == 188:
+		import_from_files(record_list = [['srm', 'doctype', 'qa_inspection_report']])
+	elif patch_no == 189:
+		sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('entries', 'other_charges') and parent = 'Receivable Voucher'")
+	elif patch_no == 190:
+		sql("update tabDocField set permlevel=0 where fieldname = 'fiscal_year' and parent = 'Stock Entry'")
+	elif patch_no == 191:
+		import_from_files(record_list = [['maintenance', 'doctype', 'customer_issue']])
+	elif patch_no == 192:
+		sql("delete from `tabModule Def Item` where parent = 'Material Management' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
+		import_from_files(record_list = [['srm', 'Module Def', 'SRM']])
+	elif patch_no == 193:
+		sql("update tabDocField set fieldtype='Button', `trigger`='Client' where parent='Letter Head' and fieldname='set_from_image'")
+	elif patch_no == 194:
+		sql("delete from `tabModule Def Item` where parent = 'SRM' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
+		import_from_files(record_list = [['material_management', 'Module Def', 'Material Management']])
+	elif patch_no == 195:
+		from webnotes.modules.module_manager import reload_doc
+		reload_doc('setup','doctype','manage_account')
+	elif patch_no == 196:
+		sql("update `tabModule Def` set module_page = null where name = 'Material Management'")
+	elif patch_no == 197:
+		sql("update `tabDocField` set permlevel = 0, in_filter = 1 where fieldname = 'warranty_amc_status' and parent = 'Customer Issue'")
+		import_from_files(record_list = [['maintenance', 'doctype', 'customer_issue']])
+	elif patch_no == 198:
+		sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent in ('Quoattion', 'Sales Order', 'Delivery Note', 'Receivable Voucher')")
+		sql("delete from `tabDocField` where label in ('SMS', 'Send SMS') and parent = 'Purchase Order'")
+		sql("delete from `tabDocField` where (label in ('Send SMS', 'SMS Html') or fieldname in ('sms_message', 'lead_sms_detail', 'enquiry_sms_detail')) and parent in ('Lead', 'Enquiry')")
+		from webnotes.model import delete_doc
+		delete_doc('DocType', 'Lead SMS Detail')
+		delete_doc('DocType', 'Enquiry SMS Detail')
+	elif patch_no == 199:
+		sql("update tabDocField set reqd = 0 where parent = 'Attendance' and fieldname = 'shifts'")
+	elif patch_no == 200:
+		reload_doc('event_updates','page','profile_settings')
+	elif patch_no == 201:
+		reload_doc('setup','doctype','price_list')
+	elif patch_no == 202:
+		name1 = sql("select name from tabDocField where parent='Price List' and label='Clear Prices' limit 1,1")
+		name2 = sql("select name from tabDocField where parent='Price List' and label='Update Prices' limit 1,1")
+		if name1:
+			sql("delete from tabDocField where name=%s limit 1", name1[0][0])
+		if name2:
+			sql("delete from tabDocField where name=%s limit 1", name2[0][0])
+	elif patch_no == 203:
+		sql("delete from tabDocField where parent = 'Company' and fieldname = 'default_salary_account' limit 1")
+	elif patch_no == 204:
+		sql("delete from tabDocField where parent = 'Company' and fieldname = 'default_salary_acount' limit 1")
+	elif patch_no == 205:
+		sql("update `tabDocField` set `default` = '' where fieldname = 'naming_series' and parent = 'Installation Note'")
+	elif patch_no == 206:
+		reload_doc('crm','doctype','installation_note')
+	elif patch_no == 207:
+		import_from_files(record_list = [['setup', 'doctype', 'company']])
+	elif patch_no == 208:
+		sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent ='Quotation'")
+		default_currency = get_obj('Manage Account').doc.default_currency
+		sql("update tabCompany set default_currency = '%s'" % default_currency)
+	elif patch_no == 209:
+		import_from_files(record_list = [['setup', 'doctype', 'company']])
+	elif patch_no == 210:
+		sql("delete FROM `tabDocField` WHERE parent = 'Lead' AND label in ('CC:','Attachment Html','Create New File','Attachment')")
+	elif patch_no == 212:
+		# reload company because of disturbed UI
+		import_from_files(record_list = [['setup', 'doctype', 'company']])
+	elif patch_no == 213:
+		reload_doc('crm','doctype','lead')
+		reload_doc('setup','doctype','company')
+	elif patch_no == 214:
+		reload_doc('crm','doctype','sales_order')
+	elif patch_no == 215:
+		# patch for item and image in description
+		sql("update tabDocField set width = '300px' where fieldname='description'")
+		reload_doc('material_management', 'doctype', 'item')
+		sql("delete from __DocTypeCache")
+	elif patch_no == 216:
+		import_from_files(record_list = [['material_management', 'doctype', 'serial_no'], ['material_management', 'doctype', 'stock_ledger_entry']])
+	elif patch_no == 217:
+		sql("update tabDocField set options = '\nIn Store\nDelivered\nNot in Use' where fieldname = 'status' and parent = 'Serial No'")
+		sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Delivery Note Detail'")
+		sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Stock Entry Detail'")
+	elif patch_no == 218:
+		for d in sql("select name from `tabSerial No`"):
+			sql("Commit")
+			sql("Start Transaction")
+			s = Document('Serial No', d[0])
+			if s.pr_no:
+				s.purchase_document_type = 'Purchase Receipt'
+				s.purchase_document_no = s.pr_no
+			if s.delivery_note_no:
+				s.delivery_document_type = 'Delivery Note'
+				s.delivery_document_no = s.delivery_note_no
+			if s.notes:
+				s.delivery_note_no = s.notes
+			s.company = webnotes.utils.get_defaults()['company']
+			s.fiscal_year = webnotes.utils.get_defaults()['fiscal_year']
+			s.save()
+	elif patch_no == 219:
+		sql("delete from tabDocField where fieldname in ('pr_no', 'make', 'label', 'delivery_note_no', 'notes') and parent = 'Serial No'")
+	elif patch_no == 220:
+		sql("update tabDocField set label = 'Incoming Rate' where fieldname = 'purchase_rate' and parent = 'Serial No'")
+		sql("update tabDocField set label = 'Incoming Time' where fieldname = 'purchase_time' and parent = 'Serial No'")
+	elif patch_no == 221:
+		sql("update tabDocField set reqd = 1 where fieldname in ('purchase_rate', 'warehouse') and parent = 'Serial No'")
+	elif patch_no == 222:
+		sql("update tabDocField set options = '\nDelivery Note\nReceivable Voucher\nStock Entry' where fieldname = 'delivery_document_type' and parent = 'Serial No'")
+	elif patch_no == 223:
+		sql("update tabDocField set hidden = 0 where fieldname in ('pay_to_recd_from', 'total_amount', 'total_amount_in_words') and parent = 'Journal Voucher'")
+		sql("update tabDocField set permlevel = 0 where fieldname = 'pay_to_recd_from' and parent = 'Journal Voucher'")
+	elif patch_no == 224:
+		import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail'], ['accounts', 'Print Format', 'Payment Receipt Voucher']])
+	elif patch_no == 225:
+		import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail']])
+	elif patch_no == 226:
+		import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail']])
+	elif patch_no == 227:
+		reload_doc('material_management', 'doctype', 'item')
+		if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011':
+			sql("delete from tabDocField where parent = 'Item' and fieldname='alternate_description' limit 1")
+	elif patch_no == 228:
+		# knowledge base patch
+		reload_doc('knowledge_base', 'doctype', 'question')
+		reload_doc('knowledge_base', 'doctype', 'answer')
+		reload_doc('knowledge_base', 'page', 'questions')
+		reload_doc('knowledge_base', 'Module Def', 'Knowledge Base')
+		sql("update `tabModule Def` set disabled='No' where name='Knowledge Base'")
+	elif patch_no == 229:		
+		reload_doc('knowledge_base', 'page', 'question_view')
+	elif patch_no == 230:
+		reload_doc('srm', 'doctype', 'indent')
+		reload_doc('srm', 'doctype', 'indent_detail')
+		reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
+	elif patch_no == 231:
+		reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
+	elif patch_no == 232:
+		sql("update `tabDocField` set options = 'Sales Order' where fieldname = 'sales_order_no' and parent = 'Indent'")
+	elif patch_no == 233:
+		reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Receivable Voucher')
+		reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
+	elif patch_no == 234:
+		sql("update `tabTable Mapper Detail` set validation_logic = 'docstatus=1' where parent = 'Sales Order-Indent' and from_table = 'Sales Order Detail'")
+	elif patch_no == 235:
+		for sc in sql("""select name from `tabSearch Criteria` where ifnull(name,'') 
+			like 'srch%' or ifnull(name,'') like '%stdsrch'"""):
+			try:
+				get_obj('Search Criteria', sc[0]).rename()
+			except AttributeError, e:
+				pass
+		reload_doc('core', 'doctype', 'system_console')
+	elif patch_no == 236:
+		# warehouse not mandatory for delivered serial nos
+		sql("update tabDocField set reqd=0 where parent='Serial No' and fieldname='warehouse'")
+	elif patch_no == 237:
+		sql("update tabDocField set depends_on = 'eval:doc.is_pos==1' where fieldname = 'cash_bank_account' and parent = 'Receivable Voucher'")
+	elif patch_no == 238:
+		reload_doc('accounts', 'doctype', 'receivable_voucher')
+		reload_doc('accounts', 'GL Mapper', 'POS with write off')
+	elif patch_no == 239:
+		reload_doc('core', 'doctype', 'docfield')
+		reload_doc('core', 'doctype', 'doctype')
+		
+		from patches.feed_patch import set_subjects_and_tagfields
+		set_subjects_and_tagfields()
+	elif patch_no == 240:
+		# again for sales order (status)
+		from patches.feed_patch import set_subjects_and_tagfields
+		set_subjects_and_tagfields()
+	elif patch_no == 241:
+		sql("update `tabDocField` set fieldtype = 'Text', options = '', in_filter = '' where fieldname = 'serial_no' and parent = 'Stock Ledger Entry'")
+	elif patch_no == 242:
+		if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['axjanak2011']:
+			sql("commit")
+			try:
+				sql("alter table `tabStock Ledger Entry` drop index serial_no")
+			except:
+				pass
+
+			sql("alter table `tabStock Ledger Entry` change serial_no serial_no text")
+	elif patch_no == 243:
+		# moving custom script and custom fields to framework
+		webnotes.conn.set_value('DocType', 'Custom Script', 'module', 'Core')
+		webnotes.conn.set_value('DocType', 'Custom Field', 'module', 'Core')
+		reload_doc('setup', 'doctype', 'company')
+	elif patch_no == 244:
+		reload_doc('material_management', 'search_criteria', 'shortage_to_indent')
+	elif patch_no == 245:
+		from patches.doctype_permission_patch import set_doctype_permissions
+		set_doctype_permissions()
+
+		from patches.feed_patch import set_subjects_and_tagfields
+		set_subjects_and_tagfields()
+	elif patch_no == 246:
+		webnotes.conn.set_value('DocType','Stock Entry','tag_fields','purpose')
+		webnotes.conn.set_value('DocType','Stock Entry','subject','%(remarks)s')
+	elif patch_no == 247:
+		webnotes.conn.set_value('DocType','Stock Entry','subject','%(remarks)s')
+	elif patch_no == 248:
+		reload_doc('setup', 'doctype', 'manage_account')
+	elif patch_no == 249:
+		sql("update `tabDocPerm` t1, `tabDocType` t2 set t1.role = 'System Manager' where t1.role = 'Administrator' and t1.parent = t2.name and t2.module != 'Core'")
+	elif patch_no == 250:
+		from patches.feed_patch  import support_patch
+		support_patch()
+	elif patch_no == 251:
+		from webnotes.model import db_schema
+		db_schema.remove_all_foreign_keys()
+		from patches.customer_address import run_patch
+		run_patch()
+	elif patch_no == 252:
+		reload_doc('maintenance','doctype','support_ticket')
+		reload_doc('maintenance','doctype','support_ticket_response')
+	elif patch_no == 253:
+		reload_doc('accounts','doctype','ledger_balance_export')
+		reload_doc('accounts','doctype','ledger_detail')
+		reload_doc('accounts', 'Module Def', 'Accounts')
+
+		from webnotes.model.db_schema import updatedb
+		updatedb('Ledger Balance Export')
+		updatedb('Ledger Detail')
+	elif patch_no == 254:
+		reload_doc('settings', 'doctype', 'sms_settings')
+		reload_doc('settings', 'doctype', 'static_parameter_detail')
+
+		from webnotes.model.db_schema import updatedb
+		updatedb('SMS Settings')
+		updatedb('Static Parameter Detail')
+	elif patch_no == 255:
+		from patches.customer_address import run_old_data_sync_patch
+		run_old_data_sync_patch()
+	elif patch_no == 256:
+		sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170-test/', '')")
+		sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170-test/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
+		sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')")
+	elif patch_no == 257:
+		from patches.customer_address import run_old_data_sync_patch
+		run_old_data_sync_patch()	
+	elif patch_no == 258:
+		sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'")
+	elif patch_no == 259:
+		sql("update `tabQuotation Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
+		sql("update `tabSales Order Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
+		sql("update `tabRV Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
+		sql("update `tabDelivery Note Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
+	elif patch_no == 260:
+		sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170/', '')")
+		sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
+		sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170/', '')")
+		sql("update `tabQuotation Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
+		sql("update `tabSales Order Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
+		sql("update `tabRV Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
+		sql("update `tabDelivery Note Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
+	elif patch_no == 261:
+		sql("update `tabPrint Format` set html = replace(html, 'customer_address', 'address_display')")
+	elif patch_no == 262:
+		from patches.customer_address import sync_lead_phone
+		sync_lead_phone()
+	elif patch_no == 263:
+		ol = ['','Open','To Reply','Waiting for Customer','Hold','Closed']
+		sql("update tabDocField set options=%s where parent=%s and fieldname=%s", ('\n'.join(ol), 'Support Ticket', 'status'))
+	elif patch_no == 264:	
+		sql("delete from tabDocField where parent = 'Customer Issue' and (fieldname = 'issue_in' or fieldname = 'issue_category')")
+		sql("update tabDocField set options=NULL where parent='Support Ticket' and label = 'Send'")
+	elif patch_no == 266:
+		reload_doc('setup','doctype','support_email_settings')
+	elif patch_no == 267:
+		sql("update `tabPrint Format` set html = replace(html, 'supplier_address', 'address_display')")
+	elif patch_no == 268:
+		sql("update `tabDocPerm` set permlevel = 0 where permlevel is null")
+	elif patch_no == 269:
+		p = get_obj('Patch Util')
+		p.add_permission('GL Entry', 'Accounts User', 0, read = 1)
+	elif patch_no == 270:
+		pages = ['Accounts Setup', 'Accounts', 'Accounting Reports','GeneralLedger','How do I - Accounts','Making Opening Entries',\
+		'Analysis','How do I - CRM','How do I - Inventory','Inventory Setup', 'Stock','HR','HR & Payroll Setup',\
+		'Payroll Setup','Production Setup','Production','Buying','SRM Setup','Contact Page','Forum','Messages','Test Toolbar',\
+		'Trend Analyzer']
+		from webnotes.model import delete_doc
+		sql("delete from `tabPage Visit`")
+		for p in pages:
+			try: delete_doc('Page', p)
+			except: pass
+	elif patch_no == 271:
+		# tags patch
+		reload_doc('crm','doctype','sales_order')
+		reload_doc('material_management','doctype','delivery_note')
+		sql("delete from tabDocField where fieldname='per_amt_billed' and parent in ('Sales Order', 'Delivery Note')")
+		
+		sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered', 
+				if(per_delivered >= 99.99, 'Fully Delivered', 'Partly Delivered'))""")
+		sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed', 
+				if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
+		sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed', 
+				if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
+	elif patch_no == 272:
+		from webnotes.model import delete_doc
+		try:
+			delete_doc('Search Criteria', '_SRCH00003')
+		except:
+			pass
+		reload_doc('accounts', 'search_criteria', 'purchase_register')
+	elif patch_no == 276:
+		from webnotes.model import delete_doc
+		sn = sql("select name from `tabSearch Criteria` where criteria_name = 'Sales Personwise Transaction Summary'")
+		for d in sn:
+			delete_doc('Search Criteria', d[0])
+		reload_doc('crm', 'search_criteria', 'sales_personwise_transaction_summary')
diff --git a/payroll/Deduction Type/Income Tax/Income Tax.txt b/payroll/Deduction Type/Income Tax/Income Tax.txt
new file mode 100644
index 0000000..182c9b1
--- /dev/null
+++ b/payroll/Deduction Type/Income Tax/Income Tax.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Income Tax', 'parent': None, 'description': 'Income Tax', 'creation': '2010-04-02 10:33:23', 'is_active': 'Yes', 'modified': '2010-04-05 12:53:07', 'module': 'Payroll', 'doctype': 'Deduction Type', 'idx': None, 'parenttype': None, 'deduction_name': 'Income Tax', 'trash_reason': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Deduction Type/Professional Tax/Professional Tax.txt b/payroll/Deduction Type/Professional Tax/Professional Tax.txt
new file mode 100644
index 0000000..b5e886c
--- /dev/null
+++ b/payroll/Deduction Type/Professional Tax/Professional Tax.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Professional Tax', 'parent': None, 'description': 'Professional Tax', 'creation': '2010-04-02 10:34:14', 'is_active': 'Yes', 'modified': '2010-04-05 12:52:59', 'module': 'Payroll', 'doctype': 'Deduction Type', 'idx': None, 'parenttype': None, 'deduction_name': 'Professional Tax', 'trash_reason': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Deduction Type/Provident Fund/Provident Fund.txt b/payroll/Deduction Type/Provident Fund/Provident Fund.txt
new file mode 100644
index 0000000..77fd26f
--- /dev/null
+++ b/payroll/Deduction Type/Provident Fund/Provident Fund.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Provident Fund', 'parent': None, 'description': 'Provident fund', 'creation': '2010-04-02 10:32:23', 'is_active': 'Yes', 'modified': '2010-04-05 12:52:52', 'module': 'Payroll', 'doctype': 'Deduction Type', 'idx': None, 'parenttype': None, 'deduction_name': 'Provident Fund', 'trash_reason': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Earning Type/Basic/Basic.txt b/payroll/Earning Type/Basic/Basic.txt
new file mode 100644
index 0000000..e0243f5
--- /dev/null
+++ b/payroll/Earning Type/Basic/Basic.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Basic', 'parent': None, 'description': 'Basic', 'creation': '2010-04-02 10:29:08', 'is_active': 'Yes', 'modified': '2010-04-05 12:52:35', 'earning_name': 'Basic', 'doctype': 'Earning Type', 'taxable': 'Yes', 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'exemption_limit': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Earning Type/House Rent Allowance/House Rent Allowance.txt b/payroll/Earning Type/House Rent Allowance/House Rent Allowance.txt
new file mode 100644
index 0000000..760c4d8
--- /dev/null
+++ b/payroll/Earning Type/House Rent Allowance/House Rent Allowance.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'House Rent Allowance', 'parent': None, 'description': 'House Rent Allowance', 'creation': '2010-04-02 10:29:29', 'is_active': 'Yes', 'modified': '2010-04-05 12:33:19', 'earning_name': 'House Rent Allowance', 'doctype': 'Earning Type', 'taxable': 'No', 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'exemption_limit': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Expense Type/Calls/Calls.txt b/payroll/Expense Type/Calls/Calls.txt
new file mode 100644
index 0000000..2cd19e1
--- /dev/null
+++ b/payroll/Expense Type/Calls/Calls.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Calls', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:38', 'modified': '2010-08-23 18:26:38', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Calls', 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Expense Type/Food/Food.txt b/payroll/Expense Type/Food/Food.txt
new file mode 100644
index 0000000..d0266ad
--- /dev/null
+++ b/payroll/Expense Type/Food/Food.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Food', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:30', 'modified': '2010-08-23 18:26:30', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Food', 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Expense Type/Medical/Medical.txt b/payroll/Expense Type/Medical/Medical.txt
new file mode 100644
index 0000000..4e84862
--- /dev/null
+++ b/payroll/Expense Type/Medical/Medical.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Medical', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:49', 'modified': '2010-08-23 18:26:49', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Medical', 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Expense Type/Others/Others.txt b/payroll/Expense Type/Others/Others.txt
new file mode 100644
index 0000000..13a6af3
--- /dev/null
+++ b/payroll/Expense Type/Others/Others.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Others', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Others', 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Expense Type/Travel/Travel.txt b/payroll/Expense Type/Travel/Travel.txt
new file mode 100644
index 0000000..966c2ea
--- /dev/null
+++ b/payroll/Expense Type/Travel/Travel.txt
@@ -0,0 +1 @@
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Travel', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Travel', 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Leave Type/Casual Leave/Casual Leave.txt b/payroll/Leave Type/Casual Leave/Casual Leave.txt
new file mode 100644
index 0000000..fbd55a5
--- /dev/null
+++ b/payroll/Leave Type/Casual Leave/Casual Leave.txt
@@ -0,0 +1 @@
+[{'leave_type_name': 'Casual Leave', 'modified_by': 'Administrator', 'name': 'Casual Leave', 'parent': None, 'is_encash': 1, 'creation': '2010-04-02 10:52:32', 'is_active': 'Yes', 'modified': '2010-04-02 10:52:32', 'is_carry_forward': 1, 'doctype': 'Leave Type', 'max_days_allowed': '3', 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Leave Type/Compensatory Off/Compensatory Off.txt b/payroll/Leave Type/Compensatory Off/Compensatory Off.txt
new file mode 100644
index 0000000..896b3e2
--- /dev/null
+++ b/payroll/Leave Type/Compensatory Off/Compensatory Off.txt
@@ -0,0 +1 @@
+[{'leave_type_name': 'Compensatory Off', 'modified_by': 'Administrator', 'name': 'Compensatory Off', 'parent': None, 'is_encash': None, 'creation': '2010-04-02 10:59:30', 'is_active': 'Yes', 'modified': '2010-04-02 10:59:30', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Leave Type/Leave Without Pay/Leave Without Pay.txt b/payroll/Leave Type/Leave Without Pay/Leave Without Pay.txt
new file mode 100644
index 0000000..04fa707
--- /dev/null
+++ b/payroll/Leave Type/Leave Without Pay/Leave Without Pay.txt
@@ -0,0 +1 @@
+[{'leave_type_name': 'Leave Without Pay', 'modified_by': 'Administrator', 'name': 'Leave Without Pay', 'parent': None, 'is_encash': None, 'creation': '2010-04-02 10:57:37', 'is_active': 'Yes', 'modified': '2010-04-02 10:57:37', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Leave Type/Privilege Leave/Privilege Leave.txt b/payroll/Leave Type/Privilege Leave/Privilege Leave.txt
new file mode 100644
index 0000000..7024c50
--- /dev/null
+++ b/payroll/Leave Type/Privilege Leave/Privilege Leave.txt
@@ -0,0 +1 @@
+[{'leave_type_name': 'Privilege Leave', 'modified_by': 'Administrator', 'name': 'Privilege Leave', 'parent': None, 'is_encash': 1, 'creation': '2010-04-02 10:53:16', 'is_active': 'Yes', 'modified': '2010-04-02 10:53:16', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Leave Type/Sick Leave/Sick Leave.txt b/payroll/Leave Type/Sick Leave/Sick Leave.txt
new file mode 100644
index 0000000..2ccb3ba
--- /dev/null
+++ b/payroll/Leave Type/Sick Leave/Sick Leave.txt
@@ -0,0 +1 @@
+[{'leave_type_name': 'Sick Leave', 'modified_by': 'Administrator', 'name': 'Sick Leave', 'parent': None, 'is_encash': None, 'creation': '2010-04-02 10:54:12', 'is_active': 'Yes', 'modified': '2010-04-02 10:54:12', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/payroll/Module Def/Payroll/Payroll.js b/payroll/Module Def/Payroll/Payroll.js
new file mode 100644
index 0000000..98807ee
--- /dev/null
+++ b/payroll/Module Def/Payroll/Payroll.js
@@ -0,0 +1,9 @@
+var hr_set_tips = function() {
+  $c_obj('Module Tip Control', 'get_tip', 'hr', function(r,rt) { 
+    if(r.message) {
+      $(parent.tip_area).html('<b>Tip: </b>' + r.message).css('display','block');
+    }
+  } );
+}
+
+hr_set_tips();
\ No newline at end of file
diff --git a/payroll/Module Def/Payroll/Payroll.txt b/payroll/Module Def/Payroll/Payroll.txt
new file mode 100644
index 0000000..f7202e6
--- /dev/null
+++ b/payroll/Module Def/Payroll/Payroll.txt
@@ -0,0 +1,645 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:42:05',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2011-02-14 12:07:27',
+		'modified': '2011-02-17 12:00:37',
+		'modified_by': 'Administrator',
+		'module_desc': 'Human Resource Management - Employee Database, Salaries etc.',
+		'module_icon': 'HR.gif',
+		'module_label': 'HR',
+		'module_name': 'Payroll',
+		'module_page': None,
+		'module_seq': 9,
+		'name': 'Payroll',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Your Employee Database',
+		'display_name': 'Employee',
+		'doc_name': 'Employee',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'employee_name\nemployment_type\nstatus\nbranch\ndesignation\ndepartment\ngrade\nreports_to',
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00183',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Employees Daily Attendance Tracking Form',
+		'display_name': 'Attendance',
+		'doc_name': 'Attendance',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'employee\nemployee_name\nstatus\natt_date\nfiscal_year\ncompany',
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00184',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Upload Attendance data',
+		'display_name': 'Attendance Control Panel',
+		'doc_name': 'Attendance Control Panel',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:04:46',
+		'modified_by': 'Administrator',
+		'name': 'MDI00185',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Leave allocation for selected employees at a time',
+		'display_name': 'Leave Control Panel',
+		'doc_name': 'Leave Control Panel',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00187',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': 'Allocate leave for fiscal year',
+		'display_name': 'Leave Allocation',
+		'doc_name': 'Leave Allocation',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'employee\nleave_type\nfiscal_year\ntotal_leaves_allocated\nposting_date',
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00290',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': 'Apply Leave',
+		'display_name': 'Leave Application',
+		'doc_name': 'Leave Application',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'employee\nleave_type\nfiscal_year\nfrom_date\nto_date\ntotal_leave_days',
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00291',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Submit Employees Expenses',
+		'display_name': 'Expense Voucher',
+		'doc_name': 'Expense Voucher',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nemployee\nemployee_name\nposting_date\ntotal_claimed_amount\ntotal_sanctioned_amount\nexp_approver',
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00188',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Assign Responsibilities to employee and evaluate',
+		'display_name': 'Appraisal',
+		'doc_name': 'Appraisal',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nemployee\nemployee_name\nstart_date\nend_date\ntotal_score\nkra_approver',
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00189',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Generate Salary Structure heads for an employee',
+		'display_name': 'Salary Structure',
+		'doc_name': 'Salary Structure',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'employee\nis_active\nfiscal_year\nfrom_date\nctc\ntotal_earning\ntotal_deduction\ntotal',
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00190',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Generate Salary Slip for an employee',
+		'display_name': 'Salary Slip',
+		'doc_name': 'Salary Slip',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'month\nyear\nemployee\nemployee_name\npayment_days\narrear_amount\nencashment_amount\ngross_pay\ntotal_deduction\nnet_pay',
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00192',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Generate Salary Slip for all employee at a time',
+		'display_name': 'Salary Slip Control Panel',
+		'doc_name': 'Salary Slip Control Panel',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00193',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Job Applications received for various positions',
+		'display_name': 'Job Application',
+		'doc_name': 'Job Application',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'applicant_name\nemail\nposition',
+		'hide': None,
+		'icon': None,
+		'idx': 12,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00194',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'Monthly Attendance Details',
+		'doc_name': 'Attendance',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 16,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00296',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 15:32:43',
+		'description': None,
+		'display_name': 'Leave Application Details',
+		'doc_name': 'Leave Application',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 17,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00306',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 15:32:43',
+		'description': None,
+		'display_name': 'Leave Allocation Details',
+		'doc_name': 'Leave Allocation',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 18,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00307',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Employeewise Leave Transaction Details',
+		'doc_name': 'Leave Transaction',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 20,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003092',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'Employeewise Balance Leave Report',
+		'doc_name': 'Employee',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 21,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00293',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'Salary Structure Details',
+		'doc_name': 'Salary Structure',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 22,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00299',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'Salary Slips',
+		'doc_name': 'Salary Slip',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 24,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00300',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:05',
+		'description': 'Income Tax Calculation',
+		'display_name': 'IT Checklist',
+		'doc_name': 'IT Checklist',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'fiscal_year\nis_cheklist_active\nemployee\nnet_tot_tax_income\ntax_tot_income\nedu_cess\napplicable_from\nrem_months\ntax_per_month',
+		'hide': None,
+		'icon': None,
+		'idx': 26,
+		'modified': '2010-11-30 22:42:05',
+		'modified_by': 'Administrator',
+		'name': 'MDI00191',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'Employee Appraisals',
+		'doc_name': 'Appraisal',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 26,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00302',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:29',
+		'description': None,
+		'display_name': 'Expense Vouchers',
+		'doc_name': 'Expense Voucher',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 28,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00304',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': "Employee's Birthday",
+		'doc_name': 'Employee',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 31,
+		'modified': '2011-02-21 10:01:28',
+		'modified_by': 'Administrator',
+		'name': 'MDI00294',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'New or left employees for a month',
+		'doc_name': 'Employee',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 32,
+		'modified': '2011-02-21 10:01:28',
+		'modified_by': 'Administrator',
+		'name': 'MDI00295',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 15:32:43',
+		'description': None,
+		'display_name': 'Employee Leave Balance Report',
+		'doc_name': 'Employee',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 36,
+		'modified': '2011-02-21 15:32:43',
+		'modified_by': 'Administrator',
+		'name': 'MDI00308',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:28',
+		'description': None,
+		'display_name': 'Salary Slips',
+		'doc_name': 'Salary Slip',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 41,
+		'modified': '2011-02-21 10:01:28',
+		'modified_by': 'Administrator',
+		'name': 'MDI00301',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:29',
+		'description': None,
+		'display_name': 'Employee Appraisals',
+		'doc_name': 'Appraisal',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 43,
+		'modified': '2011-02-21 10:01:29',
+		'modified_by': 'Administrator',
+		'name': 'MDI00303',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-02-21 10:01:29',
+		'description': None,
+		'display_name': 'Expense Vouchers',
+		'doc_name': 'Expense Voucher',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 45,
+		'modified': '2011-02-21 10:01:29',
+		'modified_by': 'Administrator',
+		'name': 'MDI00305',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Payroll',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 22:42:05',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-11-30 22:42:05',
+		'modified_by': 'Administrator',
+		'name': 'MDR00038',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'HR Manager'
+	},
+	{
+		'creation': '2010-11-30 22:42:05',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-11-30 22:42:05',
+		'modified_by': 'Administrator',
+		'name': 'MDR00039',
+		'owner': 'Administrator',
+		'parent': 'Payroll',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'HR User'
+	}
+]
\ No newline at end of file
diff --git a/payroll/__init__.py b/payroll/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/__init__.py
diff --git a/payroll/doctype/__init__.py b/payroll/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/__init__.py
diff --git a/payroll/doctype/absent_days_detail/__init__.py b/payroll/doctype/absent_days_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/absent_days_detail/__init__.py
diff --git a/payroll/doctype/absent_days_detail/absent_days_detail.txt b/payroll/doctype/absent_days_detail/absent_days_detail.txt
new file mode 100644
index 0000000..7f10b91
--- /dev/null
+++ b/payroll/doctype/absent_days_detail/absent_days_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:39', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Absent Days Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00708', 'parent': 'Absent Days Detail', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 15:00:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': '', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'leave_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Leave Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04160', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'leave_type', 'fieldtype': 'Select', 'options': 'link:Leave Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'no_of_leave_days', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'No of leave days', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04161', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'no_of_leave_days', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'from_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'From Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04162', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'from_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'to_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'To Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04163', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'to_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'previous_balance', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Previous Balance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04164', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'previous_balance', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'current_balance', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Current Balance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04165', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'current_balance', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'max_allowed', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Max. Allowed', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Absent Days Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04166', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:23', 'parenttype': 'DocType', 'fieldname': 'max_allowed', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/action_detail/__init__.py b/payroll/doctype/action_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/action_detail/__init__.py
diff --git a/payroll/doctype/action_detail/action_detail.txt b/payroll/doctype/action_detail/action_detail.txt
new file mode 100644
index 0000000..d1e5234
--- /dev/null
+++ b/payroll/doctype/action_detail/action_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:39', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Action Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'rule_master', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Master', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04167', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:43', 'parenttype': 'DocType', 'fieldname': 'rule_master', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'rule_field', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04168', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:43', 'parenttype': 'DocType', 'fieldname': 'rule_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'expression', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Expression', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04169', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:43', 'parenttype': 'DocType', 'fieldname': 'expression', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/appraisal/__init__.py b/payroll/doctype/appraisal/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/appraisal/__init__.py
diff --git a/payroll/doctype/appraisal/appraisal.js b/payroll/doctype/appraisal/appraisal.js
new file mode 100644
index 0000000..89f40ba
--- /dev/null
+++ b/payroll/doctype/appraisal/appraisal.js
@@ -0,0 +1,143 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
+  if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
+  if(doc.amended_from && doc.__islocal) cur_frm.cscript.refresh_appraisal_details(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+  if(user == doc.kra_approver && doc.status == 'Submitted') unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
+  else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
+  
+  if(!doc.docstatus) unhide_field('Fetch Template');
+  else hide_field('Fetch Template');
+}
+
+
+cur_frm.cscript.refresh_appraisal_details = function(doc, cdt, cdn){
+  var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
+  for(var i = 0; i<val.length; i++){
+    set_multiple('Appraisal Detail', val[i].name, {'target_achieved':'', 'score':'', 'scored_earned':''}, 'appraisal_details');
+  }
+  doc.total_score = '';
+  refresh_field('appraisal_details');
+  refresh_field('total_score');
+}
+
+cur_frm.cscript.employee = function(doc,cdt,cdn){
+  if(doc.employee){
+    $c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
+      if(r.message){
+        doc.employee_name = r.message['emp_nm'];
+        get_field(doc.doctype, 'kra_approver' , doc.name).options = r.message['app_lst'];        
+        refresh_many(['kra_approver','employee_name']);
+      }    
+    });
+  }
+}
+
+cur_frm.cscript['Calculate Total Score'] = function(doc,cdt,cdn){
+  //get_server_fields('calculate_total','','',doc,cdt,cdn,1);
+  var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
+  var total =0;
+  for(var i = 0; i<val.length; i++){
+    total = flt(total)+flt(val[i].score_earned)
+  }
+  doc.total_score = flt(total)
+  refresh_field('total_score')
+}
+
+/*cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
+  $c_obj(make_doclist(doc.doctype, doc.name),'declare_completed','', function(r,rt){
+    if(r.message){
+      refresh_field('Status');
+      cur_frm.cscript.refresh(doc,cdt,cdn);
+    }
+  });
+}*/
+
+cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
+  var declare_completed_dialog;
+  
+  set_declare_completed_dialog = function() {
+    declare_completed_dialog = new Dialog(400, 200, 'Declare Completed');
+    declare_completed_dialog.make_body([
+      ['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after declaring this Appraisal as completed. Are you sure, you want to declare it as completed ?</div>'],
+      ['HTML', 'Response', '<div class = "comment" id="declare_completed_dialog_response"></div>'],
+      ['HTML', 'Declare Completed', '<div></div>']
+    ]);
+    
+    var declare_completed_btn1 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button');
+    declare_completed_btn1.innerHTML = 'Yes';
+    declare_completed_btn1.onclick = function(){ declare_completed_dialog.add(); }
+    
+    var declare_completed_btn2 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button');
+    declare_completed_btn2.innerHTML = 'No';
+    $y(declare_completed_btn2,{marginLeft:'4px'});
+    declare_completed_btn2.onclick = function(){ declare_completed_dialog.hide();}
+    
+    declare_completed_dialog.onshow = function() {
+      $i('declare_completed_dialog_response').innerHTML = '';
+    }
+    
+    declare_completed_dialog.refresh_dt = function(){
+      cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn);
+      msgprint("refersh done");
+      $c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){});
+    }
+    
+    declare_completed_dialog.add = function() {
+      // sending...
+      $i('declare_completed_dialog_response').innerHTML = 'Processing...';
+      var m_arg = user+ '~~' + this.msg_nm_lst;
+      
+      $c_obj(make_doclist(this.doc.doctype, this.doc.name),'declare_completed','', function(r,rt){
+        
+        if(r.message.status == 'Completed'){
+          $i('declare_completed_dialog_response').innerHTML = 'Done';
+          refresh_field('status');
+          declare_completed_dialog.refresh_dt();
+          hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
+          declare_completed_dialog.hide();
+        }
+        else if(r.message.status == 'Incomplete'){
+          $i('declare_completed_dialog_response').innerHTML = 'Incomplete Appraisal';
+        }
+        else if(r.message.status == 'No Score'){
+          $i('declare_completed_dialog_response').innerHTML = 'Calculate total score';
+        }
+      });
+    }
+  }  
+  
+  if(!declare_completed_dialog){
+    set_declare_completed_dialog();
+  }  
+  declare_completed_dialog.doc = doc;
+  declare_completed_dialog.cdt = cdt;
+  declare_completed_dialog.cdn = cdn;
+  declare_completed_dialog.show();
+}
+
+cur_frm.cscript.score = function(doc,cdt,cdn){
+  var d = locals[cdt][cdn];
+  if (d.score){
+    total = flt(d.per_weightage*d.score)/100;
+    d.score_earned = total.toPrecision(2);
+    refresh_field('score_earned', d.name, 'appraisal_details');
+  }
+  else{
+    d.score_earned = '';
+    refresh_field('score_earned', d.name, 'appraisal_details');
+  }
+  cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+
+cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
+  var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
+  var total =0;
+  for(var i = 0; i<val.length; i++){
+    total = flt(total)+flt(val[i].score_earned);
+  }
+  doc.total_score = flt(total);
+  refresh_field('total_score');
+}
\ No newline at end of file
diff --git a/payroll/doctype/appraisal/appraisal.py b/payroll/doctype/appraisal/appraisal.py
new file mode 100644
index 0000000..1731559
--- /dev/null
+++ b/payroll/doctype/appraisal/appraisal.py
@@ -0,0 +1,147 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  def get_employee_name(self):
+    emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
+    emp_nm= emp_nm and emp_nm[0][0] or ''
+    self.doc.employee_name = emp_nm
+    return cstr(emp_nm)
+  
+  def fetch_kra(self):
+    if not self.doc.kra_template:
+      msgprint("Please select KRA Template to be be fetched")
+      raise Exception
+    self.doc.clear_table(self.doclist,'appraisal_details')
+    get_obj('DocType Mapper', 'KRA Template-Appraisal').dt_map('KRA Template', 'Appraisal', self.doc.kra_template, self.doc, self.doclist, "[['KRA Template','Appraisal'],['KRA Sheet', 'Appraisal Detail']]")
+  
+  def validate_dates(self):
+    if getdate(self.doc.start_date) > getdate(self.doc.end_date):
+      msgprint("End Date can not be less than Start Date")
+      raise Exception
+  
+  def validate_existing_appraisal(self):
+    chk = sql("select name from `tabAppraisal` where employee=%s and (status='Submitted' or status='Completed') and ((start_date>=%s and start_date<=%s) or (end_date>=%s and end_date<=%s))",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
+    if chk:
+      msgprint("You have already created Appraisal "+cstr(chk[0][0])+" in the current date range for employee "+cstr(self.doc.employee_name))
+      raise Exception
+  
+  def validate_curr_appraisal(self):
+    for d in getlist(self.doclist, 'appraisal_details'):
+      if d.target_achieved or d.score:
+        if self.doc.status == 'Draft':
+          msgprint("Target achieved or Score can be added only for submitted Appraisal")
+          raise Exception
+        elif self.doc.status == 'Submitted' and session['user'] != self.doc.kra_approver:
+          msgprint("Target achieved or Score can be added only by Appraisal Approver")
+          raise Exception
+  
+  def validate_fiscal_year(self):
+    fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
+    ysd=fy and fy[0][0] or ""
+    yed=add_days(str(ysd),365)
+    if str(self.doc.start_date) < str(ysd) or str(self.doc.start_date) > str(yed) or str(self.doc.end_date) < str(ysd) or str(self.doc.end_date) > str(yed):
+      msgprint("Appraisal date range is not within the Fiscal Year selected")
+      raise Exception
+  
+  def validate(self):
+    self.validate_dates()
+    self.validate_existing_appraisal()
+    self.validate_curr_appraisal()
+    self.validate_fiscal_year()
+  
+  def set_approver(self):
+    ret={}
+    approver_lst =[]
+    emp_nm = self.get_employee_name()
+    approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
+    if approver_lst1:
+      approver_lst=approver_lst1
+    else:
+      approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
+    ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
+    return ret
+  
+  def calculate_total(self):
+    total = 0
+    for d in getlist(self.doclist, 'appraisal_details'):
+      if d.score:
+        total = total + flt(d.score_earned)
+    ret={'total_score':flt(total)}
+    return cstr(ret)
+  
+  def declare_completed(self):
+    ret={}
+    for d in getlist(self.doclist, 'appraisal_details'):
+      if not d.target_achieved or not d.score or not d.score_earned:
+        msgprint("Please add 'Target Achieved' and 'Score' for all KPI")
+        ret = {'status':'Incomplete'}
+        return ret
+    
+    if not self.doc.total_score:
+      msgprint("Please calculate total score using button 'Calculate Total Score'")
+      ret = {'status':'No Score'}
+      return ret
+    self.update_appraisal()
+    #set(self.doc, 'status', 'Completed')
+    ret = {'status':'Completed'}
+    return ret
+  
+  def update_appraisal(self):
+    for d in getlist(self.doclist, 'appraisal_details'):
+      if not d.kra or not d.per_weightage:
+        msgprint("Please remove the extra blank row added")
+        raise Exception
+      d.save()
+    if self.doc.total_score:
+      set(self.doc,'total_score',self.doc.total_score)
+  
+  def on_update(self):
+    set(self.doc, 'status', 'Draft')
+  
+  def validate_total_weightage(self):
+    total_w = 0
+    for d in getlist(self.doclist, 'appraisal_details'):
+      total_w = flt(total_w) + flt(d.per_weightage)
+    
+    if flt(total_w)>100 or flt(total_w)<100:
+      msgprint("Total of weightage assigned to KPI is "+cstr(total_w)+".It should be 100(%)")
+      raise Exception
+  
+  def validate_appraisal_detail(self):
+    if not self.doc.kra_approver:
+      msgprint("Please mention the name of Approver")
+      raise Exception
+    
+    if not getlist(self.doclist, 'appraisal_details'):
+      msgprint("Please add KRA Details")
+      raise Exception    
+    
+    self.validate_total_weightage()
+  
+  def on_submit(self):
+    self.validate_appraisal_detail()
+    set(self.doc, 'status', 'Submitted')
+  
+  def on_cancel(self): 
+    set(self.doc, 'status', 'Cancelled')
\ No newline at end of file
diff --git a/payroll/doctype/appraisal/appraisal.txt b/payroll/doctype/appraisal/appraisal.txt
new file mode 100644
index 0000000..ef86204
--- /dev/null
+++ b/payroll/doctype/appraisal/appraisal.txt
@@ -0,0 +1,962 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'APRSL.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-09-20 14:06:57',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Appraisal',
+		'name_case': '',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': '',
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status, employee, employee_name',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'subject': '',
+		'tag_fields': '',
+		'use_template': None,
+		'version': 159
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00658',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00659',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00660',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00661',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00662',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00663',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00664',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-09-01 15:47:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00665',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Employee Details',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03790',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03791',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nCompleted\nCancelled',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Employee',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03792',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Employee Name',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03793',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03794',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03795',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03796',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'start_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Start Date',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03797',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'start_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'end_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'End Date',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03798',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'end_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'kra_approver',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 0,
+		'label': 'Approver',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03799',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'kra_approver',
+		'oldfieldtype': 'Select',
+		'options': '',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03800',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03801',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Declare Completed',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03802',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': '',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03803',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select template from which you want to fetch KRA',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'kra_template',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'KRA Template',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03804',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'kra_template',
+		'oldfieldtype': 'Link',
+		'options': 'KRA Template',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Fetch Template',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03805',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'fetch_kra',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Update',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03806',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': '',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'appraisal_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Appraisal Details',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03807',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'appraisal_details',
+		'oldfieldtype': 'Table',
+		'options': 'Appraisal Detail',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Calculate Total Score',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03808',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'calculate_total',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_score',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Total Score',
+		'modified': '2010-09-01 15:47:54',
+		'modified_by': 'Administrator',
+		'name': 'FL03809',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_score',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Appraisal',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/appraisal_detail/__init__.py b/payroll/doctype/appraisal_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/appraisal_detail/__init__.py
diff --git a/payroll/doctype/appraisal_detail/appraisal_detail.txt b/payroll/doctype/appraisal_detail/appraisal_detail.txt
new file mode 100644
index 0000000..702d655
--- /dev/null
+++ b/payroll/doctype/appraisal_detail/appraisal_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-30 15:44:06', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'APRSLD.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Appraisal Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'kra', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'KRA', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Key Responsibility Area', 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06074', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'kra', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'per_weightage', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Weightage (%)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06075', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'per_weightage', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Small Text', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'target_achieved', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Target Achieved', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL06076', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'target_achieved', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'score', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Score (0-5)', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL06077', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'score', 'fieldtype': 'Select', 'options': '\n0\n1\n2\n3\n4\n5', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'score_earned', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Score Earned', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06078', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'score_earned', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/attendance/__init__.py b/payroll/doctype/attendance/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/attendance/__init__.py
diff --git a/payroll/doctype/attendance/attendance.js b/payroll/doctype/attendance/attendance.js
new file mode 100644
index 0000000..25c35b9
--- /dev/null
+++ b/payroll/doctype/attendance/attendance.js
@@ -0,0 +1,12 @@
+//get employee's name based on employee id selected
+cur_frm.cscript.employee = function(doc,cdt,cdn){
+  if(doc.employee) get_server_fields('get_emp_name', '', '', doc, cdt, cdn, 1);
+  refresh_field('employee_name'); 
+}
+
+
+//Employee
+//-----------------------------
+cur_frm.fields_dict['employee'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabEmployee`.`name` FROM `tabEmployee` WHERE `tabEmployee`.status = "Active" AND `tabEmployee`.`docstatus`!= 2 AND `tabEmployee`.%(key)s LIKE "%s"  ORDER BY `tabEmployee`.`name` ASC LIMIT 50';
+}
diff --git a/payroll/doctype/attendance/attendance.py b/payroll/doctype/attendance/attendance.py
new file mode 100644
index 0000000..664a3cb
--- /dev/null
+++ b/payroll/doctype/attendance/attendance.py
@@ -0,0 +1,133 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    
+    # Notification objects    
+    self.badge_obj = get_obj('Badge Settings','Badge Settings','','',1)
+  
+  #autoname function
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+  
+  #get employee name based on employee id selected 
+  def get_emp_name(self):
+    emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
+
+    #this is done because sometimes user entered wrong employee name while uploading employee attendance
+    set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
+
+    ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
+    return str(ret)
+  
+  #validation for duplicate record
+  def validate_duplicate_record(self):   
+    res = sql("select name from `tabAttendance` where employee = '%s' and att_date = '%s' and not name = '%s' and docstatus = 1"%(self.doc.employee,self.doc.att_date, self.doc.name))
+    if res:
+      msgprint("Employee's attendance already marked.")
+      raise Exception
+      
+  #validation - leave_type is mandatory for status absent/ half day else not required to entered.
+  def validate_status(self):
+    if self.doc.status == 'Present' and self.doc.leave_type:
+      msgprint("You can not enter leave type for attendance status 'Present'")
+      raise Exception
+
+    elif (self.doc.status == 'Absent' or self.doc.status == 'Half Day') and not self.doc.leave_type:
+      msgprint("Please enter leave type for attendance status 'Absent'")
+      raise Exception
+  
+  #check for already record present in leave transaction for same date
+  def check_leave_record(self):
+    if self.doc.status == 'Present':
+      chk = sql("select name from `tabLeave Transaction` where employee=%s and (from_date <= %s and to_date >= %s) and status = 'Submitted' and leave_transaction_type = 'Deduction' and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
+      if chk:
+        msgprint("Leave Application created for employee "+self.doc.employee+" whom you are trying to mark as 'Present' ")
+        raise Exception
+  
+  #For absent/ half day record - check for leave balances of the employees 
+  def validate_leave_type(self):
+    if not self.doc.status =='Present' and self.doc.leave_type not in ('Leave Without Pay','Compensatory Off'):
+      #check for leave allocated to employee from leave transaction
+      ret = sql("select name from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and leave_transaction_type = 'Allocation' and fiscal_year = '%s'"%(self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))   
+      
+      #if leave allocation is present then calculate leave balance i.e. sum(allocation) - sum(deduction) 
+      if ret:
+        q1 = 'SUM(CASE WHEN leave_transaction_type = "Allocation" THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = "Deduction" THEN total_leave ELSE 0 END)'
+        q2 = "select %s from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1"
+        
+        res = sql(q2%(q1,self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
+       
+        if res:
+          if self.doc.status == 'Absent' and flt(res[0][0]) < 1:
+            msgprint("%s balances are insufficient to cover a day absence, please select other leave type."%self.doc.leave_type)
+            raise Exception
+          if self.doc.status == 'Half Day' and flt(res[0][0]) < 0.5:
+            msgprint("%s balances are insufficient to cover a half day absence, please select other leave type."%self.doc.leave_type)
+            raise Exception
+
+      else:
+        msgprint("Leave Allocation for employee %s not done.\n You can allocate leaves from HR -> Leave Transaction OR HR -> Leave Control Panel."%self.doc.employee)
+        raise Exception
+         
+  def validate_fiscal_year(self):
+    fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"% self.doc.fiscal_year)
+    ysd=fy and fy[0][0] or ""
+    yed=add_days(str(ysd),365)
+    if str(self.doc.att_date) < str(ysd) or str(self.doc.att_date) > str(yed):
+      msgprint("'%s' Not Within The Fiscal Year selected"%(self.doc.att_date))
+      raise Exception
+  
+  def validate_att_date(self):
+    import datetime
+    if getdate(self.doc.att_date)>getdate(datetime.datetime.now().date().strftime('%Y-%m-%d')):
+      msgprint("Attendance can not be marked for future dates")
+      raise Exception
+
+  # Validate employee
+  #-------------------
+  def validate_employee(self):
+    emp = sql("select name, status from `tabEmployee` where name = '%s'" % self.doc.employee)
+    if not emp:
+      msgprint("Employee: %s does not exists in the system" % self.doc.employee, raise_exception=1)
+    elif emp[0][1] != 'Active':
+      msgprint("Employee: %s is not Active" % self.doc.employee, raise_exception=1)
+      
+  # validate...
+  def validate(self):
+    self.validate_fiscal_year()
+    self.validate_att_date()
+    #self.validate_leave_type()
+    self.validate_duplicate_record()
+    #self.validate_status()
+    self.check_leave_record()
+    
+  def on_update(self):
+    #self.validate()
+    
+    #this is done because sometimes user entered wrong employee name while uploading employee attendance
+    x=self.get_emp_name()
+
+  def on_submit(self):
+    #this is done because while uploading attendance chnage docstatus to 1 i.e. submit
+    set(self.doc,'docstatus',1)
+    pass
diff --git a/payroll/doctype/attendance/attendance.txt b/payroll/doctype/attendance/attendance.txt
new file mode 100644
index 0000000..0b3620c
--- /dev/null
+++ b/payroll/doctype/attendance/attendance.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-09-03 14:33:46', 'search_fields': 'employee, employee_name, att_date, status', 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 79, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': 'Master', 'name': 'Attendance', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-18 17:57:41', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01160', 'parent': 'Attendance', 'read': 1, 'create': 1, 'creation': '2010-09-03 14:33:46', 'modified': '2010-10-27 12:26:00', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01180', 'parent': 'Attendance', 'read': 1, 'create': 1, 'creation': '2010-09-29 14:35:23', 'modified': '2010-10-27 12:26:00', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': 'owner', 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01181', 'parent': 'Attendance', 'read': 1, 'create': 1, 'creation': '2010-09-29 14:35:23', 'modified': '2010-10-27 12:26:00', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-09-03 14:37:09', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Attendance Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06110', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-09-03 15:08:57', 'doctype': 'DocField', 'oldfieldname': 'naming_series', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Naming Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06111', 'idx': 2, 'default': 'ATT', 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'naming_series', 'fieldtype': 'Select', 'options': 'ATT', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'employee', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Employee', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL06102', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'employee', 'fieldtype': 'Link', 'options': 'Employee', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'employee_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Employee Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06103', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'employee_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'status', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Status', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL06105', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'status', 'fieldtype': 'Select', 'options': '\nPresent\nAbsent\nHalf Day', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'leave_type', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Leave Type', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06106', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'leave_type', 'fieldtype': 'Link', 'options': 'Leave Type', 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-09-03 14:37:09', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06109', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'att_date', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Attendance Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL06104', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'att_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06107', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-09-03 14:33:46', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06108', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-10-27 12:26:00', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/attendance_control_panel/__init__.py b/payroll/doctype/attendance_control_panel/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/attendance_control_panel/__init__.py
diff --git a/payroll/doctype/attendance_control_panel/attendance_control_panel.js b/payroll/doctype/attendance_control_panel/attendance_control_panel.js
new file mode 100644
index 0000000..c36a72a
--- /dev/null
+++ b/payroll/doctype/attendance_control_panel/attendance_control_panel.js
@@ -0,0 +1,50 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  cur_frm.log_div = $a(cur_frm.fields_dict['Import Log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
+  hide_field('Import Log1')
+  doc.att_fr_date = get_today();
+  doc.file_list = '';
+  doc.overwrite = 0;
+  refresh_many(['att_fr_date','file_list','overwrite']);
+
+
+}
+
+//download attendance template - csv file
+cur_frm.cscript['Get Template'] = function(doc,cdt,cdn){
+
+  if(doc.att_to_date && !doc.att_fr_date)
+    alert("Please enter 'Attendance To Date'");
+  else if(doc.att_to_date && doc.att_fr_date && doc.att_to_date < doc.att_fr_date)
+    alert("Attendance to date cannot be less than from date.");
+  else
+    $c_obj_csv(make_doclist(cdt,cdn),'get_att_list','');
+}
+
+//---------------------------------------------------------
+cur_frm.cscript['Import'] = function(doc,cdt,cdn){
+  if(!doc.file_list){
+    alert("Please upload attendance data CSV file");
+  }
+  else{
+    var call_back = function(r,rt){
+      cur_frm.log_div.innerHTML = '';
+      if(r.message)
+        cur_frm.log_div.innerHTML = r.message;
+         
+      cur_frm.cscript.refresh(doc,cdt,cdn);
+    }
+
+    $c_obj(make_doclist(cdt,cdn),'import_att_data','',call_back);
+  }
+  cur_frm.cscript.refresh(doc,cdt,cdn);
+}
+
+//====================================================
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+  if(cur_frm.log_div.innerHTML == '')
+    hide_field('Import Log1');
+  else
+    unhide_field('Import Log1');
+  refresh_field('Import Log1');
+
+}
\ No newline at end of file
diff --git a/payroll/doctype/attendance_control_panel/attendance_control_panel.py b/payroll/doctype/attendance_control_panel/attendance_control_panel.py
new file mode 100644
index 0000000..febcd91
--- /dev/null
+++ b/payroll/doctype/attendance_control_panel/attendance_control_panel.py
@@ -0,0 +1,105 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dt):
+    self.doc, self.doclist = d,dt
+    
+  #==========================================================================
+  def get_att_list(self):
+    
+    lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
+    
+    dt = self.date_diff_list()          # get date list inbetween from date and to date
+    
+    att_dt = self.get_att_data()        # get default attendance data like fiscal yr, company, naming series
+      
+    fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']
+   
+    res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2") 
+   
+    for d in dt:
+      for r in res:       
+        lst.append([r[0],r[1],d,'',fy,comp,sr])
+
+    return lst
+  
+  #------------------------------------------------------------------------------
+  # get date list inbetween from date and to date
+  def date_diff_list(self):
+    import datetime
+    #get from date 
+    att_fr_date = self.doc.att_fr_date and self.doc.att_fr_date or ''
+    
+    #get to date
+    att_to_date = self.doc.att_to_date and self.doc.att_to_date or ''
+
+    if att_to_date:
+      r = (getdate(self.doc.att_to_date)+datetime.timedelta(days=1)-getdate(self.doc.att_fr_date)).days
+    else:
+      r = 1
+    dateList = [getdate(self.doc.att_fr_date)+datetime.timedelta(days=i) for i in range(0,r)]
+    dt=([str(date) for date in dateList])
+    
+    return dt
+
+  #------------------------------------------------------------------------------
+  def get_att_data(self):
+    
+    fy = get_defaults()['fiscal_year']    #get default fiscal year 
+
+    comp = get_defaults()['company']    #get default company
+    
+    #get naming series of attendance
+    #sr = sql("select series_options from `tabNaming Series Options` where doc_type='Attendance'")
+    sr = sql("select options from `tabDocField` where parent = 'Attendance' and fieldname = 'naming_series'")
+    if not sr:
+      msgprint("Please create naming series for Attendance.\nGo to Setup--> Manage Series.")
+      raise Exception
+    else:
+      sr = sr and sr[0][0]
+    
+    return {'fy':fy,'comp':comp,'sr':sr}
+
+  #=================================================================================  
+  def import_att_data(self):
+    filename = self.doc.file_list.split(',')
+
+    if not filename:
+      msgprint("Please attach a .CSV File.")
+      raise Exception
+    
+    if filename[0].find('.csv') < 0:
+      raise Exception
+    
+    if not filename and filename[0] and file[1]:
+      msgprint("Please Attach File. ")
+      raise Exception
+      
+    from webnotes.utils import file_manager
+    fn, content = file_manager.get_file(filename[1])
+    
+    if not type(content) == str:
+      content = content.tostring()
+
+    import webnotes.model.import_docs
+    im = webnotes.model.import_docs.CSVImport()
+    out = im.import_csv(content,self.doc.import_date_format, cint(self.doc.overwrite))
+    return out
+
diff --git a/payroll/doctype/attendance_control_panel/attendance_control_panel.txt b/payroll/doctype/attendance_control_panel/attendance_control_panel.txt
new file mode 100644
index 0000000..433466c
--- /dev/null
+++ b/payroll/doctype/attendance_control_panel/attendance_control_panel.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-10-05 14:25:28', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': 1, 'show_in_menu': None, 'max_attachments': 1, 'version': 128, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Attendance Control Panel', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-12-02 18:06:47', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01205', 'parent': 'Attendance Control Panel', 'read': 1, 'create': 1, 'creation': '2010-10-05 14:25:28', 'modified': '2010-12-02 18:06:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01206', 'parent': 'Attendance Control Panel', 'read': 1, 'create': 1, 'creation': '2010-10-05 14:25:28', 'modified': '2010-12-02 18:06:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01207', 'parent': 'Attendance Control Panel', 'read': 1, 'create': 1, 'creation': '2010-10-05 14:25:28', 'modified': '2010-12-02 18:06:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01210', 'parent': 'Attendance Control Panel', 'read': 1, 'create': None, 'creation': '2010-10-05 16:09:12', 'modified': '2010-12-02 18:06:47', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01211', 'parent': 'Attendance Control Panel', 'read': 1, 'create': None, 'creation': '2010-10-05 16:09:12', 'modified': '2010-12-02 18:06:47', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 16:24:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Download Template', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': "Get the template of the Attendance for which you want to import in CSV (Comma seperated values) format.\nFill data in the template. Save the template in CSV format.\nAll attendance dates inbetween 'Attendance From Date' and 'Attendance To Date' will come in the template with employees list.", 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06221', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-10-05 14:25:28', 'doctype': 'DocField', 'oldfieldname': 'attenadnce_date', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Attendance From Date', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Selected Attendance date will comes in the attendance template.', 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06205', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': 'att_fr_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-10-05 14:25:28', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Get Template', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': '', 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06206', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 16:36:27', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06224', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 16:36:27', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Attendance To Date', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'All attendance dates inbetween selected Attendance From Date and Attendance To Date will come in the template with employees list.', 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06225', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': 'att_to_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 16:24:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Upload Attendance Data', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'To import attendance data, click on "Add" button, select the saved CSV file and click on "Upload".\nSelect the date format as attendance date format in CSV file.\nClick on "Import".', 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06222', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 18:31:39', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Import Date Format ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06232', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': 'import_date_format', 'fieldtype': 'Select', 'options': 'yyyy-mm-dd\nmm/dd/yyyy\nmm/dd/yy\ndd-mm-yyyy\ndd/mm/yyyy', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 18:31:39', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Overwrite', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06233', 'idx': 8, 'default': '', 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': 'overwrite', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 16:16:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Import', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06215', 'idx': 9, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-05 16:05:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'File List', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06214', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': 'file_list', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-06 10:56:22', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Import Log', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06235', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-06 10:56:22', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Import Log1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Attendance Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06236', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-12-02 18:06:47', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/branch/__init__.py b/payroll/doctype/branch/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/branch/__init__.py
diff --git a/payroll/doctype/branch/branch.js b/payroll/doctype/branch/branch.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/branch/branch.js
diff --git a/payroll/doctype/branch/branch.txt b/payroll/doctype/branch/branch.txt
new file mode 100644
index 0000000..13420fc
--- /dev/null
+++ b/payroll/doctype/branch/branch.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:39', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:branch', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Branch', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00710', 'parent': 'Branch', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:39', 'modified': '2010-09-20 08:57:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00797', 'parent': 'Branch', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:14', 'modified': '2010-09-20 08:57:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00798', 'parent': 'Branch', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:14', 'modified': '2010-09-20 08:57:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Branch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04827', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:23', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'branch', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Branch', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Branch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04177', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:23', 'parenttype': 'DocType', 'fieldname': 'branch', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/chapter_vi_a_detail/__init__.py b/payroll/doctype/chapter_vi_a_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/chapter_vi_a_detail/__init__.py
diff --git a/payroll/doctype/chapter_vi_a_detail/chapter_vi_a_detail.txt b/payroll/doctype/chapter_vi_a_detail/chapter_vi_a_detail.txt
new file mode 100644
index 0000000..198b9de
--- /dev/null
+++ b/payroll/doctype/chapter_vi_a_detail/chapter_vi_a_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:39', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Chapter VI A Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00711', 'parent': 'Chapter VI A Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 15:01:44', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00712', 'parent': 'Chapter VI A Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 15:01:44', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'particulars3', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Particulars', 'width': '300px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Chapter VI A Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04178', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:01:44', 'parenttype': 'DocType', 'fieldname': 'particulars3', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'under_section3', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Under Section', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Chapter VI A Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04179', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:01:44', 'parenttype': 'DocType', 'fieldname': 'under_section3', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'max_limit3', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Max. Limit', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Chapter VI A Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04180', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:01:44', 'parenttype': 'DocType', 'fieldname': 'max_limit3', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'actual_amount3', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Actual Amount', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Chapter VI A Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04181', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:01:44', 'parenttype': 'DocType', 'fieldname': 'actual_amount3', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'eligible_amount3', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Eligible Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Chapter VI A Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04182', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:01:44', 'parenttype': 'DocType', 'fieldname': 'eligible_amount3', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'modified_amount3', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Modified Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Chapter VI A Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04183', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-01 15:01:44', 'parenttype': 'DocType', 'fieldname': 'modified_amount3', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/city/__init__.py b/payroll/doctype/city/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/city/__init__.py
diff --git a/payroll/doctype/city/city.js b/payroll/doctype/city/city.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/city/city.js
diff --git a/payroll/doctype/city/city.txt b/payroll/doctype/city/city.txt
new file mode 100644
index 0000000..400209d
--- /dev/null
+++ b/payroll/doctype/city/city.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:city_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'City', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00713', 'parent': 'City', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:40', 'modified': '2010-09-20 09:04:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00789', 'parent': 'City', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:52:11', 'modified': '2010-09-20 09:04:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00790', 'parent': 'City', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:52:11', 'modified': '2010-09-20 09:04:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'City', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04831', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:30', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'city_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'City Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'City', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04184', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:30', 'parenttype': 'DocType', 'fieldname': 'city_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'state', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'State', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'City', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04185', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:30', 'parenttype': 'DocType', 'fieldname': 'state', 'fieldtype': 'Link', 'options': 'State', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/condition_detail/__init__.py b/payroll/doctype/condition_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/condition_detail/__init__.py
diff --git a/payroll/doctype/condition_detail/condition_detail.txt b/payroll/doctype/condition_detail/condition_detail.txt
new file mode 100644
index 0000000..2dcc6a2
--- /dev/null
+++ b/payroll/doctype/condition_detail/condition_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 16, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Condition Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00714', 'parent': 'Condition Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:40', 'modified': '2010-04-01 15:02:27', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'rule_master', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Form', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04198', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'rule_master', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'rule_field', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04199', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'rule_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'operator', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Operator', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04200', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'operator', 'fieldtype': 'Select', 'options': '\nEquals\nNot Equals\nGreater than\nGreater than or Equals\nLess than\nLess than or Equals', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'value', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Value', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04201', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/declaration_detail/__init__.py b/payroll/doctype/declaration_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/declaration_detail/__init__.py
diff --git a/payroll/doctype/declaration_detail/declaration_detail.txt b/payroll/doctype/declaration_detail/declaration_detail.txt
new file mode 100644
index 0000000..62e58f7
--- /dev/null
+++ b/payroll/doctype/declaration_detail/declaration_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 7, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Declaration Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00715', 'parent': 'Declaration Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:40', 'modified': '2010-04-01 15:02:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00716', 'parent': 'Declaration Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:40', 'modified': '2010-04-01 15:02:51', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'particulars1', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Particulars', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04203', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:02:51', 'parenttype': 'DocType', 'fieldname': 'particulars1', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'under_section1', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Under Section', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04204', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:02:51', 'parenttype': 'DocType', 'fieldname': 'under_section1', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'max_limit1', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Max. Limit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04205', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:02:51', 'parenttype': 'DocType', 'fieldname': 'max_limit1', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'actual_amount1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Actual Amount', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04206', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:51', 'parenttype': 'DocType', 'fieldname': 'actual_amount1', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'eligible_amount1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Eligible Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04207', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:02:51', 'parenttype': 'DocType', 'fieldname': 'eligible_amount1', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'modified_amount1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Modified Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04208', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-01 15:02:51', 'parenttype': 'DocType', 'fieldname': 'modified_amount1', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/deduction_detail/__init__.py b/payroll/doctype/deduction_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/deduction_detail/__init__.py
diff --git a/payroll/doctype/deduction_detail/deduction_detail.txt b/payroll/doctype/deduction_detail/deduction_detail.txt
new file mode 100644
index 0000000..4ac264d
--- /dev/null
+++ b/payroll/doctype/deduction_detail/deduction_detail.txt
@@ -0,0 +1,160 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': '',
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:57',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-11-02 20:44:58',
+		'modified_by': 'sneha@webnotestech.com',
+		'module': 'Payroll',
+		'name': 'Deduction Detail',
+		'name_case': '',
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': '',
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': '',
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 14
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'd_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Type',
+		'modified': '2010-08-08 17:08:57',
+		'modified_by': 'Administrator',
+		'name': 'FL00900',
+		'no_copy': None,
+		'oldfieldname': 'd_type',
+		'oldfieldtype': 'Select',
+		'options': 'Deduction Type',
+		'owner': 'Administrator',
+		'parent': 'Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'd_modified_amt',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2010-08-08 17:08:57',
+		'modified_by': 'Administrator',
+		'name': 'FL00902',
+		'no_copy': None,
+		'oldfieldname': 'd_modified_amt',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'depend_on_lwp',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Depend on LWP',
+		'modified': '2010-08-08 17:08:57',
+		'modified_by': 'Administrator',
+		'name': 'FL00903',
+		'no_copy': None,
+		'oldfieldname': 'depend_on_lwp',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/deduction_type/__init__.py b/payroll/doctype/deduction_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/deduction_type/__init__.py
diff --git a/payroll/doctype/deduction_type/deduction_type.js b/payroll/doctype/deduction_type/deduction_type.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/deduction_type/deduction_type.js
diff --git a/payroll/doctype/deduction_type/deduction_type.txt b/payroll/doctype/deduction_type/deduction_type.txt
new file mode 100644
index 0000000..0e0256e
--- /dev/null
+++ b/payroll/doctype/deduction_type/deduction_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': 1, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:deduction_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': 'Master', 'name': 'Deduction Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-12 17:19:47', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00719', 'parent': 'Deduction Type', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-10-12 17:19:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00803', 'parent': 'Deduction Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:55:37', 'modified': '2010-10-12 17:19:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00804', 'parent': 'Deduction Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:55:37', 'modified': '2010-10-12 17:19:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Deduction Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04838', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-12 17:19:47', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'deduction_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Deduction Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04212', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-12 17:19:47', 'parenttype': 'DocType', 'fieldname': 'deduction_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Deduction Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04213', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-12 17:19:47', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/department/__init__.py b/payroll/doctype/department/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/department/__init__.py
diff --git a/payroll/doctype/department/department.js b/payroll/doctype/department/department.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/department/department.js
diff --git a/payroll/doctype/department/department.txt b/payroll/doctype/department/department.txt
new file mode 100644
index 0000000..da9f38c
--- /dev/null
+++ b/payroll/doctype/department/department.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:department_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Department', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00720', 'parent': 'Department', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-09-20 09:24:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00793', 'parent': 'Department', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:18', 'modified': '2010-09-20 09:24:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00794', 'parent': 'Department', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:18', 'modified': '2010-09-20 09:24:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Department', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04839', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:25', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'department_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Department', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Department', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04215', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:25', 'parenttype': 'DocType', 'fieldname': 'department_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/designation/__init__.py b/payroll/doctype/designation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/designation/__init__.py
diff --git a/payroll/doctype/designation/designation.js b/payroll/doctype/designation/designation.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/designation/designation.js
diff --git a/payroll/doctype/designation/designation.txt b/payroll/doctype/designation/designation.txt
new file mode 100644
index 0000000..eb58d05
--- /dev/null
+++ b/payroll/doctype/designation/designation.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:designation_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Designation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00721', 'parent': 'Designation', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-09-20 09:24:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00795', 'parent': 'Designation', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:48', 'modified': '2010-09-20 09:24:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00796', 'parent': 'Designation', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:48', 'modified': '2010-09-20 09:24:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Designation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04840', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:40', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'designation_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Designation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04216', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:40', 'parenttype': 'DocType', 'fieldname': 'designation_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/earn_deduction_detail/__init__.py b/payroll/doctype/earn_deduction_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/earn_deduction_detail/__init__.py
diff --git a/payroll/doctype/earn_deduction_detail/earn_deduction_detail.txt b/payroll/doctype/earn_deduction_detail/earn_deduction_detail.txt
new file mode 100644
index 0000000..1e8cb1c
--- /dev/null
+++ b/payroll/doctype/earn_deduction_detail/earn_deduction_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Earn Deduction Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00722', 'parent': 'Earn Deduction Detail', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-04-01 15:04:16', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'earn_deduction_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Earn/Deduction Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earn Deduction Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04217', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:04:16', 'parenttype': 'DocType', 'fieldname': 'earn_deduction_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'mode', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Mode', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earn Deduction Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04218', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:04:16', 'parenttype': 'DocType', 'fieldname': 'mode', 'fieldtype': 'Select', 'options': '\n%\nRs', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'per', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Per.(%)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earn Deduction Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04219', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:04:16', 'parenttype': 'DocType', 'fieldname': 'per', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earn Deduction Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04220', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-01 15:04:16', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earn Deduction Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04221', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:04:16', 'parenttype': 'DocType', 'fieldname': 'type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/earning_detail/__init__.py b/payroll/doctype/earning_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/earning_detail/__init__.py
diff --git a/payroll/doctype/earning_detail/earning_detail.txt b/payroll/doctype/earning_detail/earning_detail.txt
new file mode 100644
index 0000000..fafcf43
--- /dev/null
+++ b/payroll/doctype/earning_detail/earning_detail.txt
@@ -0,0 +1,160 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:59',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': 0,
+		'hide_toolbar': 0,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-09 13:02:55',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Earning Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 28
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'e_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Type',
+		'modified': '2011-02-09 13:02:55',
+		'modified_by': 'Administrator',
+		'name': 'FL01069',
+		'no_copy': None,
+		'oldfieldname': 'e_type',
+		'oldfieldtype': 'Data',
+		'options': 'Earning Type',
+		'owner': 'Administrator',
+		'parent': 'Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'modified_value',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-02-09 13:02:55',
+		'modified_by': 'Administrator',
+		'name': 'FL01071',
+		'no_copy': None,
+		'oldfieldname': 'modified_value',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'depend_on_lwp',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Depend on LWP',
+		'modified': '2011-02-09 13:02:55',
+		'modified_by': 'Administrator',
+		'name': 'FL01072',
+		'no_copy': None,
+		'oldfieldname': 'depend_on_lwp',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/earning_type/__init__.py b/payroll/doctype/earning_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/earning_type/__init__.py
diff --git a/payroll/doctype/earning_type/earning_type.js b/payroll/doctype/earning_type/earning_type.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/earning_type/earning_type.js
diff --git a/payroll/doctype/earning_type/earning_type.txt b/payroll/doctype/earning_type/earning_type.txt
new file mode 100644
index 0000000..4bb27a9
--- /dev/null
+++ b/payroll/doctype/earning_type/earning_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': 1, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:earning_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': 'Master', 'name': 'Earning Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-12 17:15:46', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00725', 'parent': 'Earning Type', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-10-12 17:15:46', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00801', 'parent': 'Earning Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:55:12', 'modified': '2010-10-12 17:15:46', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00802', 'parent': 'Earning Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:55:12', 'modified': '2010-10-12 17:15:46', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Earning Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04841', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-12 17:15:46', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'earning_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earning Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04226', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-12 17:15:46', 'parenttype': 'DocType', 'fieldname': 'earning_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earning Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04227', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-12 17:15:46', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'taxable', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Taxable', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Earning Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04229', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-12 17:15:46', 'parenttype': 'DocType', 'fieldname': 'taxable', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'exemption_limit', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Exemption Limit', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Earning Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04230', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-12 17:15:46', 'parenttype': 'DocType', 'fieldname': 'exemption_limit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/educational_qualifications/__init__.py b/payroll/doctype/educational_qualifications/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/educational_qualifications/__init__.py
diff --git a/payroll/doctype/educational_qualifications/educational_qualifications.txt b/payroll/doctype/educational_qualifications/educational_qualifications.txt
new file mode 100644
index 0000000..4578677
--- /dev/null
+++ b/payroll/doctype/educational_qualifications/educational_qualifications.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 11, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Educational Qualifications', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-25 14:55:39', 'doctype': 'DocField', 'oldfieldname': 'school_univ', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'School/University', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05041', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-25 14:55:39', 'parenttype': 'DocType', 'fieldname': 'school_univ', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'qualification', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Qualification (Degree/Diploma)', 'width': '170px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL04232', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-05-25 14:55:39', 'parenttype': 'DocType', 'fieldname': 'qualification', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'level', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Level', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL04233', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-05-25 14:55:39', 'parenttype': 'DocType', 'fieldname': 'level', 'fieldtype': 'Select', 'options': '\nGraduate\nPost Graduate\nUnder Graduate', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'year_of_passing', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Year of Passing', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04234', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-05-25 14:55:39', 'parenttype': 'DocType', 'fieldname': 'year_of_passing', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'class_percent', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Class / Percentage', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04235', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-05-25 14:55:39', 'parenttype': 'DocType', 'fieldname': 'class_percent', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'maj_opt_sub', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Major / Optional Subject', 'width': '170px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04236', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-05-25 14:55:39', 'parenttype': 'DocType', 'fieldname': 'maj_opt_sub', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/educational_qualifications_detail/__init__.py b/payroll/doctype/educational_qualifications_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/educational_qualifications_detail/__init__.py
diff --git a/payroll/doctype/educational_qualifications_detail/educational_qualifications_detail.txt b/payroll/doctype/educational_qualifications_detail/educational_qualifications_detail.txt
new file mode 100644
index 0000000..3c83000
--- /dev/null
+++ b/payroll/doctype/educational_qualifications_detail/educational_qualifications_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Educational Qualifications Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-25 15:05:17', 'doctype': 'DocField', 'oldfieldname': 'school_univ', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'School/University', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05046', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-25 15:05:17', 'parenttype': 'DocType', 'fieldname': 'school_univ', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'qualification', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Qualification', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04238', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-05-25 15:05:17', 'parenttype': 'DocType', 'fieldname': 'qualification', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'level', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Level', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04239', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-05-25 15:05:17', 'parenttype': 'DocType', 'fieldname': 'level', 'fieldtype': 'Select', 'options': 'Graduate\nPost Graduate\nUnder Graduate', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'year_of_passing', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Year of Passing', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04240', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-05-25 15:05:17', 'parenttype': 'DocType', 'fieldname': 'year_of_passing', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'class_per', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Class / Percentage', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04241', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-05-25 15:05:17', 'parenttype': 'DocType', 'fieldname': 'class_per', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-05-25 15:05:17', 'doctype': 'DocField', 'oldfieldname': 'maj_opt_subj', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Major/Optional Subjects', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Educational Qualifications Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05047', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-05-25 15:05:17', 'parenttype': 'DocType', 'fieldname': 'maj_opt_subj', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/employee/__init__.py b/payroll/doctype/employee/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/employee/__init__.py
diff --git a/payroll/doctype/employee/employee.js b/payroll/doctype/employee/employee.js
new file mode 100644
index 0000000..2bd8e1e
--- /dev/null
+++ b/payroll/doctype/employee/employee.js
@@ -0,0 +1,51 @@
+// get retirement date
+//========================================================
+cur_frm.cscript.date_of_birth = function(doc, dt, dn) {
+  get_server_fields('get_retirement_date','','',doc,dt,dn,1);
+}
+
+// salutation-gender
+//========================================================
+cur_frm.cscript.salutation = function(doc,dt,dn) {
+  if(doc.salutation){
+    if(doc.salutation=='Mr')
+      doc.gender='Male';
+    else if(doc.salutation=='Ms')
+      doc.gender='Female';
+    refresh_field('gender');
+  }
+}
+
+// On refresh
+//========================================================
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+  if(doc.__islocal!=1){
+    cur_frm.add_custom_button('Make Salary Structure', cur_frm.cscript['Make Salary Structure']);
+  }  
+}
+
+//Make Salary Structure
+//========================================================
+cur_frm.cscript['Make Salary Structure']=function(){
+  $c_obj(make_doclist (doc.doctype,doc.name),'check_sal_structure',cur_frm.doc.name,function(r, rt) {
+    if(r.message)
+      alert("You have already created Active salary structure.\nIf you want to create new one, please ensure that no active salary structure exist.\nTo inactive salary structure select 'Is Active' as 'No'.");
+    else
+      cur_frm.cscript.make_salary_structure(cur_frm.doc); 
+  });
+}
+
+// Load sal structure
+//========================================================
+cur_frm.cscript.make_salary_structure = function(doc,dt,dn,det){
+  var st = LocalDB.create('Salary Structure');
+  st = locals['Salary Structure'][st];
+  st.employee = doc.name;
+  st.employee_name = doc.employee_name;
+  st.branch=doc.branch;
+  st.designation=doc.designation;
+  st.department=doc.department;
+  st.fiscal_year = doc.fiscal_year
+  st.grade=doc.grade;
+  loaddoc('Salary Structure', st.name);
+}
diff --git a/payroll/doctype/employee/employee.py b/payroll/doctype/employee/employee.py
new file mode 100644
index 0000000..54142db
--- /dev/null
+++ b/payroll/doctype/employee/employee.py
@@ -0,0 +1,118 @@
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Autoname
+  #========================================================================================================
+  def autoname(self):
+    ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
+    if not ret:
+      msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
+      raise Exception 
+    else:
+      if ret[0][0]=='Naming Series':
+        self.doc.name = make_autoname(self.doc.naming_series + '.####')
+      elif ret[0][0]=='Employee Number':
+        self.doc.name = make_autoname(self.doc.employee_number)
+        
+  # Get retirement date
+  #========================================================================================================
+  def get_retirement_date(self):    
+    import datetime
+    ret = {}
+    if self.doc.date_of_birth:
+      dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
+      ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
+    return str(ret)
+
+  # check if salary structure exists
+  #========================================================================================================
+  def check_sal_structure(self, nm):
+    ret_sal_struct=sql("select name from `tabSalary Structure` where employee='%s' and is_active = 'Yes'"%nm)
+    return ret_sal_struct and ret_sal_struct[0][0] or ''
+
+  #========================================================================================================
+  def validate(self):
+    self.validate_date()
+    self.validate_email()
+    self.validate_name()
+    self.validate_status()
+  
+  # Validate dates
+  #========================================================================================================
+  def validate_date(self):  
+    import datetime
+    if self.doc.date_of_birth and self.doc.date_of_joining and getdate(self.doc.date_of_birth) >= getdate(self.doc.date_of_joining):
+      msgprint('Date of Joining must be greater than Date of Birth')
+      raise Exception
+
+    elif self.doc.scheduled_confirmation_date and self.doc.date_of_joining and (getdate(self.doc.scheduled_confirmation_date) < getdate(self.doc.date_of_joining)):
+      msgprint('Scheduled Confirmation Date must be greater than Date of Joining')
+      raise Exception
+    
+    elif self.doc.final_confirmation_date and self.doc.date_of_joining and (getdate(self.doc.final_confirmation_date) < getdate(self.doc.date_of_joining)):
+      msgprint('Final Confirmation Date must be greater than Date of Joining')
+      raise Exception
+    
+    elif self.doc.date_of_retirement and self.doc.date_of_joining and (getdate(self.doc.date_of_retirement) <= getdate(self.doc.date_of_joining)):
+      msgprint('Date Of Retirement must be greater than Date of Joining')
+      raise Exception
+    
+    elif self.doc.relieving_date and self.doc.date_of_joining and (getdate(self.doc.relieving_date) <= getdate(self.doc.date_of_joining)):
+      msgprint('Relieving Date must be greater than Date of Joining')
+      raise Exception
+    
+    elif self.doc.contract_end_date and self.doc.date_of_joining and (getdate(self.doc.contract_end_date)<=getdate(self.doc.date_of_joining)):
+      msgprint('Contract End Date must be greater than Date of Joining')
+      raise Exception
+   
+  # Validate email id
+  #========================================================================================================
+  def validate_email(self):
+    if self.doc.company_email and not validate_email_add(self.doc.company_email):
+      msgprint("Please enter valid Company Email")
+      raise Exception
+    if self.doc.personal_email and not validate_email_add(self.doc.personal_email):
+      msgprint("Please enter valid Personal Email")
+      raise Exception
+
+  # Validate name
+  #========================================================================================================
+  def validate_name(self):  
+    ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
+
+    if not ret:
+      msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
+      raise Exception 
+    else:
+      if ret[0][0]=='Naming Series' and not self.doc.naming_series:
+        msgprint("Please select Naming Series.")
+        raise Exception 
+      elif ret[0][0]=='Employee Number' and not self.doc.employee_number:
+        msgprint("Please enter Employee Number.")
+        raise Exception 
+        
+  # Validate status
+  #========================================================================================================
+  def validate_status(self):
+    if self.doc.status == 'Left' and not self.doc.relieving_date:
+      msgprint("Please enter relieving date.")
+      raise Exception
diff --git a/payroll/doctype/employee/employee.txt b/payroll/doctype/employee/employee.txt
new file mode 100644
index 0000000..a1ee880
--- /dev/null
+++ b/payroll/doctype/employee/employee.txt
@@ -0,0 +1,3135 @@
+[
+	{
+		'_last_update': '1300962300',
+		'allow_attach': 1,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:59',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-11 19:15:10',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Employee',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'employee_name',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(employee_name)s',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 437
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00793',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00794',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:59',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:08:59',
+		'modified_by': 'Administrator',
+		'name': 'PERM00205',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:59',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:08:59',
+		'modified_by': 'Administrator',
+		'name': 'PERM00206',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:59',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:08:59',
+		'modified_by': 'Administrator',
+		'name': 'PERM00207',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:59',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:08:59',
+		'modified_by': 'Administrator',
+		'name': 'PERM00208',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:59',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:08:59',
+		'modified_by': 'Administrator',
+		'name': 'PERM00209',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2010-08-08 17:08:59',
+		'modified_by': 'Administrator',
+		'name': 'FL01094',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Basic Information',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04533',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04534',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'salutation',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Salutation',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01097',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'salutation',
+		'oldfieldtype': 'Select',
+		'options': '\nMr\nMs',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Employee Name',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01098',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': 'EMP/',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Naming Series',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01099',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'EMP/',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Employee Number',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01100',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee_number',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date_of_joining',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Date of Joining',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01101',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'date_of_joining',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date_of_birth',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 1,
+		'label': 'Date of Birth',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01103',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'date_of_birth',
+		'oldfieldtype': 'Date',
+		'options': '',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'gender',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Gender',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01102',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'gender',
+		'oldfieldtype': 'Select',
+		'options': '\nMale\nFemale',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04535',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': 'Active',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01111',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nActive\nLeft',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employment_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Employment Type',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01106',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employment_type',
+		'oldfieldtype': 'Link',
+		'options': 'Employment Type',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'scheduled_confirmation_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': 1,
+		'label': 'Scheduled Confirmation Date',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01107',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'scheduled_confirmation_date',
+		'oldfieldtype': 'Date',
+		'options': '',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'final_confirmation_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Final Confirmation Date',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01108',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'final_confirmation_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contract_end_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Contract End Date',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01109',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contract_end_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date_of_retirement',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Date Of Retirement',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01110',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'date_of_retirement',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': 'Applicable Holiday List',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'holiday_list',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Holiday List',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01112',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'holiday_list',
+		'oldfieldtype': 'Link',
+		'options': 'Holiday List',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Job Profile',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04536',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04537',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'branch',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': 1,
+		'label': 'Branch',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01114',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'branch',
+		'oldfieldtype': 'Link',
+		'options': 'Branch',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Department',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01115',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'department',
+		'oldfieldtype': 'Link',
+		'options': 'Department',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'Designation',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01118',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'designation',
+		'oldfieldtype': 'Link',
+		'options': 'Designation',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grade',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': 1,
+		'label': 'Grade',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01119',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grade',
+		'oldfieldtype': 'Link',
+		'options': 'Grade',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reports_to',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Reports to',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01116',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'reports_to',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': 'Provide email id registered in company',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': 1,
+		'label': 'Email (By company)',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01120',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company_email',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Salary Information',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04538',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'salary_mode',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Salary Mode',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01122',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'salary_mode',
+		'oldfieldtype': 'Select',
+		'options': '\nBank\nCash\nCheque',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': "eval:doc.salary_mode == 'Bank'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bank_name',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 31,
+		'in_filter': 1,
+		'label': 'Bank Name',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01123',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bank_name',
+		'oldfieldtype': 'Link',
+		'options': 'Suggest',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': "eval:doc.salary_mode == 'Bank'",
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bank_ac_no',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Bank A/C No.',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01124',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bank_ac_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'esic_card_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'ESIC CARD No',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01125',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'esic_card_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pf_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'PF Number',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01126',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'pf_number',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'gratuity_lic_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Gratuity LIC ID',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01127',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'gratuity_lic_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Contact Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04539',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04540',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cell_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Cell Number',
+		'modified': '2011-02-21 09:23:52',
+		'modified_by': 'Administrator',
+		'name': 'FL04503',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'personal_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Personal Email',
+		'modified': '2011-02-21 09:23:52',
+		'modified_by': 'Administrator',
+		'name': 'FL04504',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'notice_number_of_days',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Notice - Number of Days',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01132',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'notice_number_of_days',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '',
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Emergency Contact Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04541',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<b>Emergency Contact Details</b>',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'person_to_be_contacted',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Person To Be Contacted',
+		'modified': '2011-02-21 09:23:52',
+		'modified_by': 'Administrator',
+		'name': 'FL04506',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'relation',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Relation',
+		'modified': '2011-02-21 09:23:52',
+		'modified_by': 'Administrator',
+		'name': 'FL04507',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'emergency_phone_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Emergency Phone Number',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04508',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04542',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'permanent_accommodation_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Permanent Accommodation Type',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04509',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nRented\nOwned',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'permanent_address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Permanent Address',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04510',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'current_accommodation_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'Current Accommodation Type',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04511',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nRented\nOwned',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'current_address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Current Address',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04512',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Personal Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04543',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04544',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pan_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'PAN Number',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04514',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'passport_number',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Passport Number',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04515',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'Employee Profile',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01143',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date_of_issue',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Date of Issue',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04516',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'valid_upto',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'Valid Upto',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04517',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': 'Salary Structure',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01145',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'place_of_issue',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 59,
+		'in_filter': None,
+		'label': 'Place of Issue',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04518',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'marital_status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'Marital Status',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04519',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nSingle\nMarried\nDivorced\nWidowed',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'blood_group',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': None,
+		'label': 'Blood Group',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04520',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04545',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': 'Here you can maintain family details like name and occupation of parent, spouse and children',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'family_background',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'Family Background',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04521',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': 'Here you can maintain height, weight, allergies, medical concerns etc',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'health_details',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': 'Health Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04522',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': None,
+		'label': 'Educational Qualification',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04546',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'educational_qualification_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': 'Educational Qualification Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04524',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Educational Qualifications Detail',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': None,
+		'label': 'Career History',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04547',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'Previous Work Experience',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04548',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'previous_experience_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Previous Experience Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04527',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Previous Experience Detail',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'History In Company',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04549',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'experience_in_company_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': 'Experience In Company Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04529',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Experience In Company Detail',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 72,
+		'in_filter': None,
+		'label': 'Exit',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04550',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 73,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04551',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'resignation_letter_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 74,
+		'in_filter': None,
+		'label': 'Resignation Letter Date',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01130',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'resignation_letter_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'relieving_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 75,
+		'in_filter': 1,
+		'label': 'Relieving Date',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01131',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'relieving_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reason_for_leaving',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 77,
+		'in_filter': None,
+		'label': 'Reason for Leaving',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01133',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'reason_for_leaving',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_encashed',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 78,
+		'in_filter': None,
+		'label': 'Leave Encashed?',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01134',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'leave_encashed',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'encashment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 79,
+		'in_filter': None,
+		'label': 'Encashment Date',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01135',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'encashment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 80,
+		'in_filter': None,
+		'label': 'Exit Interview Details',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04552',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'col_brk6',
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'held_on',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 81,
+		'in_filter': None,
+		'label': 'Held On',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01137',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'held_on',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reason_for_resignation',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 82,
+		'in_filter': None,
+		'label': 'Reason for Resignation',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01138',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'reason_for_resignation',
+		'oldfieldtype': 'Select',
+		'options': '\nBetter Prospects\nHealth Concerns',
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'new_workplace',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 83,
+		'in_filter': None,
+		'label': 'New Workplace',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01139',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'new_workplace',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'feedback',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 84,
+		'in_filter': None,
+		'label': 'Feedback',
+		'modified': '2010-08-08 17:09:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01140',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'feedback',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:53',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 85,
+		'in_filter': None,
+		'label': 'Attachments',
+		'modified': '2011-02-21 09:23:53',
+		'modified_by': 'Administrator',
+		'name': 'FL04553',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Employee',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/employee_profile/__init__.py b/payroll/doctype/employee_profile/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/employee_profile/__init__.py
diff --git a/payroll/doctype/employee_profile/employee_profile.js b/payroll/doctype/employee_profile/employee_profile.js
new file mode 100644
index 0000000..aedfc34
--- /dev/null
+++ b/payroll/doctype/employee_profile/employee_profile.js
@@ -0,0 +1,44 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn){
+  $c('runserverobj', args={'method':'cal_tot_exp','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+function(r, rt) { refresh_many(['year','months']); });
+}
+
+//===========================================================
+
+cur_frm.cscript.employee = function(doc, cdt, cdn){
+  $c('runserverobj', args={'method':'get_doj','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+function(r, rt) { refresh_many(['employee_name','date_of_joining']); });
+}
+
+//===========================================================
+
+cur_frm.cscript.country1 = function(doc, cdt, cdn) {
+  var mydoc=doc;
+  $c('runserverobj', args={'method':'check_state','arg':doc.country1, 'docs':compress_doclist([doc])},
+    function(r,rt){
+
+      if(r.message) {
+        var doc = locals[mydoc.doctype][mydoc.name];
+        doc.state1 = '';
+        get_field(doc.doctype, 'state1' , doc.name).options = r.message;
+        refresh_field('state1');
+      }
+    }  
+  );
+}
+
+//===========================================================
+cur_frm.cscript.country2 = function(doc, cdt, cdn) {
+  var mydoc=doc;
+  $c('runserverobj', args={'method':'check_state', 'arg':doc.country2,'docs':compress_doclist([doc])},
+    function(r,rt){
+
+      if(r.message) {
+        var doc = locals[mydoc.doctype][mydoc.name];
+        doc.state2 = '';
+        get_field(doc.doctype, 'state2' , doc.name).options = r.message;
+        refresh_field('state2');
+      }
+    }  
+  );
+}
\ No newline at end of file
diff --git a/payroll/doctype/employee_profile/employee_profile.py b/payroll/doctype/employee_profile/employee_profile.py
new file mode 100644
index 0000000..130395d
--- /dev/null
+++ b/payroll/doctype/employee_profile/employee_profile.py
@@ -0,0 +1,73 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  #init function
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+
+  #=============================================================
+  def autoname(self):
+    self.doc.name = make_autoname('EMP-'+self.doc.employee)
+
+  #=============================================================
+  def validate(self):
+    if self.doc.personal_email:
+      if not validate_email_add(self.doc.personal_email):
+        msgprint("Please enter valid Personal Email")
+        raise Exception
+    ret = sql("select name from `tabEmployee Profile` where employee = '%s' and name !='%s'"%(self.doc.employee,self.doc.name))
+    if ret:
+      msgprint("Employee Profile is already created for Employee : '%s'"%self.doc.employee)
+      raise Exception
+
+  #=============================================================
+  def get_doj(self):
+    ret_doj = sql("select employee_name,date_of_joining from `tabEmployee` where name = '%s'"%self.doc.employee)
+    if ret_doj:
+      set(self.doc, 'employee_name', cstr(ret_doj[0][0]))
+      set(self.doc,'date_of_joining', ret_doj[0][1].strftime('%Y-%m-%d'))
+
+  #=============================================================
+  #calculate total experience in company - total year and month
+  def cal_tot_exp(self):
+    if not self.doc.date_of_joining:
+      self.get_doj()
+    
+      import datetime
+      today  = nowdate()
+    
+      diff = (getdate(today) - getdate(self.doc.date_of_joining)).days
+      diff1 = cint(diff)/365
+      a = cint(diff)%365
+      diff2 = cint(a)/30
+      if(cint(diff1)<0):
+        set(self.doc,'year', 0)
+      else:
+        set(self.doc,'year', cint(diff1))
+      if(cint(diff1)<0):
+        set(self.doc,'months', 0)
+      else:
+        set(self.doc,'months', cint(diff2)) 
+
+  #=============================================================
+  def check_state(self,country):
+    return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " %country)])
diff --git a/payroll/doctype/employee_profile/employee_profile.txt b/payroll/doctype/employee_profile/employee_profile.txt
new file mode 100644
index 0000000..2417846
--- /dev/null
+++ b/payroll/doctype/employee_profile/employee_profile.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:43', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 134, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Employee Profile', 'idx': None, 'hide_toolbar': None, 'colour': 'Light Blue:DEF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00728', 'parent': 'Employee Profile', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:43', 'modified': '2010-05-26 12:27:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00729', 'parent': 'Employee Profile', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:43', 'modified': '2010-05-26 12:27:30', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00809', 'parent': 'Employee Profile', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:57:38', 'modified': '2010-05-26 12:27:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00810', 'parent': 'Employee Profile', 'read': 1, 'create': None, 'creation': '2010-04-19 09:57:38', 'modified': '2010-05-26 12:27:30', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00811', 'parent': 'Employee Profile', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:57:38', 'modified': '2010-05-26 12:27:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00812', 'parent': 'Employee Profile', 'read': 1, 'create': None, 'creation': '2010-04-19 09:57:38', 'modified': '2010-05-26 12:27:30', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04843', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Contact', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04302', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Personal Contact Details', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04303', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'employee', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Employee', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04304', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'employee', 'fieldtype': 'Link', 'options': 'Employee', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-25 09:59:10', 'doctype': 'DocField', 'oldfieldname': 'employee_name', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Employee Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05037', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'employee_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'date_of_joining', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Date of Joining', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04305', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'date_of_joining', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'cell_number', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Cell Number', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04306', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'cell_number', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'personal_email', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Personal Email', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04307', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'personal_email', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Emergency Contact Details', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04308', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'person_to_be_contacted', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Person to be contacted', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04309', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'person_to_be_contacted', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'relation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Relation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04310', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'relation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'emergency_phone_number', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Emergency Phone Number', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04311', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'emergency_phone_number', 'fieldtype': 'Data', 'options': 'Phone', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Address', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04312', 'idx': 13, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Permanent Address', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04313', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'permanent_accommodation_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Permanent Accommodation Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04314', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'permanent_accommodation_type', 'fieldtype': 'Select', 'options': '\nRented\nOwned', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'permanent_address_line_1', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Permanent Address Line 1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04315', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'permanent_address_line_1', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'permanent_address_line_2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Permanent Address Line 2', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04316', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'permanent_address_line_2', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'city1', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'City / Town(P)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04317', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'city1', 'fieldtype': 'Link', 'options': 'City', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'country1', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Country(P)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04319', 'idx': 19, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'country1', 'fieldtype': 'Select', 'options': 'link:Country', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'state1', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'State(P)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04318', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'state1', 'fieldtype': 'Select', 'options': 'link:State', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'phn_no1', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Phone No(P)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04320', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'phn_no1', 'fieldtype': 'Data', 'options': 'Phone', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'pin_code1', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Pin Code (P)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04321', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'pin_code1', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Current Address', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04322', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Column Break', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'present_accommodation_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Current Accommodation Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04323', 'idx': 24, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'present_accommodation_type', 'fieldtype': 'Select', 'options': '\nRented\nOwned', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'present_address_line_1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Current Address Line 1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04324', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'present_address_line_1', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'present_address_line_2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Current Address Line 2', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04325', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'present_address_line_2', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'city2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'City / Town(C)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04326', 'idx': 27, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'city2', 'fieldtype': 'Link', 'options': 'City', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'country2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Country(C)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04328', 'idx': 28, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'country2', 'fieldtype': 'Select', 'options': 'link:Country', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'state2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'State(C)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04327', 'idx': 29, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'state2', 'fieldtype': 'Select', 'options': 'link:State', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'phn_no2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Phone No(C)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04329', 'idx': 30, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'phn_no2', 'fieldtype': 'Data', 'options': 'Phone', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'pin_code2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Pin Code (C)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04330', 'idx': 31, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'pin_code2', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Family ', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04331', 'idx': 32, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'fathers_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Father Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04332', 'idx': 33, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'fathers_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'fathers_occupation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Father Occupation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04333', 'idx': 34, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'fathers_occupation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'mothers_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Mother Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04334', 'idx': 35, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'mothers_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'mothers_occupation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Mother Occupation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04335', 'idx': 36, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'mothers_occupation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'marital_status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Marital Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04336', 'idx': 37, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'marital_status', 'fieldtype': 'Select', 'options': '\nSingle\nMarried\nDivorced\nWidowed', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'spouses_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Spouse Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04337', 'idx': 38, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'spouses_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'spouses_occupation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Spouse Occupation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04338', 'idx': 39, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'spouses_occupation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Health', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04339', 'idx': 40, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'height_cms', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Height(cms)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04340', 'idx': 41, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'height_cms', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'blood_group', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Blood Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04341', 'idx': 42, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'blood_group', 'fieldtype': 'Select', 'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'weight_kgs', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Weight(kgs)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04342', 'idx': 43, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'weight_kgs', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'allergies', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Allergies', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04343', 'idx': 44, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'allergies', 'fieldtype': 'Select', 'options': '\nDiabetes\nBP\nHeart Ailments\nEpilepsy\nOthers', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'other_medical_concerns', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Other Medical Concerns', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04344', 'idx': 45, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'other_medical_concerns', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'physical_handicap', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Physical Handicap(if any)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04345', 'idx': 46, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'physical_handicap', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Qualification', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04346', 'idx': 47, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'educational_qualification_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Educational Qualification Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04347', 'idx': 48, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'educational_qualification_details', 'fieldtype': 'Table', 'options': 'Educational Qualifications Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Training / Seminar', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04348', 'idx': 49, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Prior to join current company', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04349', 'idx': 50, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': 'prior_training', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Prior to join current company1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04350', 'idx': 51, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'prior_training', 'fieldtype': 'Table', 'options': 'Professional Training Details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'In current company', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04351', 'idx': 52, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'in_company', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'In current company1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04352', 'idx': 53, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'in_company', 'fieldtype': 'Table', 'options': 'Professional Training Details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Career History', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04353', 'idx': 54, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Total Prior Experience', 'width': '40%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04354', 'idx': 55, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<b>Total Prior Experience</b>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': '30%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04355', 'idx': 56, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'year', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04356', 'idx': 57, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'year', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': '30%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04357', 'idx': 58, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'months', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Months', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04358', 'idx': 59, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'months', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Previous Work Experience', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04359', 'idx': 60, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'previous_experience_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Previous Experience Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04360', 'idx': 61, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'previous_experience_details', 'fieldtype': 'Table', 'options': 'Previous Experience Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'History In Company', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04361', 'idx': 62, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'experience_in_company_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Experience In Company Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04362', 'idx': 63, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'experience_in_company_details', 'fieldtype': 'Table', 'options': 'Experience In Company Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Other Info', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04363', 'idx': 64, 'default': None, 'colour': 'Light Blue:DEF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'pan_number', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'PAN Number', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04364', 'idx': 65, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'pan_number', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04365', 'idx': 66, 'default': None, 'colour': 'White:FFF', 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Passport Info', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04366', 'idx': 67, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<b>Passport Info</b>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'passport_number', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Passport Number', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04367', 'idx': 68, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'passport_number', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'date_of_issue', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Date of Issue', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04368', 'idx': 69, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'date_of_issue', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'valid_upto', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Valid upto', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04369', 'idx': 70, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'valid_upto', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'place_of_issue', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Place Of Issue', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employee Profile', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04370', 'idx': 71, 'default': None, 'colour': None, 'modified': '2010-05-26 12:27:30', 'parenttype': 'DocType', 'fieldname': 'place_of_issue', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/employment_type/__init__.py b/payroll/doctype/employment_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/employment_type/__init__.py
diff --git a/payroll/doctype/employment_type/employment_type.js b/payroll/doctype/employment_type/employment_type.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/employment_type/employment_type.js
diff --git a/payroll/doctype/employment_type/employment_type.txt b/payroll/doctype/employment_type/employment_type.txt
new file mode 100644
index 0000000..1a5bd4a
--- /dev/null
+++ b/payroll/doctype/employment_type/employment_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 18, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:employee_type_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Employment Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00730', 'parent': 'Employment Type', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:44', 'modified': '2010-09-20 09:38:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00807', 'parent': 'Employment Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:56:40', 'modified': '2010-09-20 09:38:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00808', 'parent': 'Employment Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:56:41', 'modified': '2010-09-20 09:38:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'employee_type_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Employment Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employment Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04371', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:38:36', 'parenttype': 'DocType', 'fieldname': 'employee_type_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Employment Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04844', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:38:36', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/expense_type/__init__.py b/payroll/doctype/expense_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/expense_type/__init__.py
diff --git a/payroll/doctype/expense_type/expense_type.js b/payroll/doctype/expense_type/expense_type.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/expense_type/expense_type.js
diff --git a/payroll/doctype/expense_type/expense_type.txt b/payroll/doctype/expense_type/expense_type.txt
new file mode 100644
index 0000000..67573aa
--- /dev/null
+++ b/payroll/doctype/expense_type/expense_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-23 18:05:43', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:expense_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Expense Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01128', 'parent': 'Expense Type', 'read': 1, 'create': 1, 'creation': '2010-08-23 18:24:07', 'modified': '2010-09-20 09:39:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01129', 'parent': 'Expense Type', 'read': 1, 'create': 1, 'creation': '2010-08-23 18:24:07', 'modified': '2010-09-20 09:39:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01159', 'parent': 'Expense Type', 'read': 1, 'create': 1, 'creation': '2010-09-03 10:46:22', 'modified': '2010-09-20 09:39:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-23 18:05:43', 'doctype': 'DocField', 'oldfieldname': 'expense_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': 0, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expense Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Type', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL05980', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:39:02', 'parenttype': 'DocType', 'fieldname': 'expense_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-23 18:05:43', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05981', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:39:02', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/expense_voucher/__init__.py b/payroll/doctype/expense_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/expense_voucher/__init__.py
diff --git a/payroll/doctype/expense_voucher/expense_voucher.js b/payroll/doctype/expense_voucher/expense_voucher.js
new file mode 100644
index 0000000..3be9f2d
--- /dev/null
+++ b/payroll/doctype/expense_voucher/expense_voucher.js
@@ -0,0 +1,211 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
+  if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
+  
+  if (doc.__islocal) {
+    if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
+    var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
+    for(var i = 0; i<val.length; i++){
+      val[i].sanctioned_amount ='';
+    }
+    //doc.total_claimed_amount = '';
+    doc.total_sanctioned_amount = '';
+    refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
+  }
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+  if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('Calculate Total Amount');
+  else hide_field('Calculate Total Amount');
+  
+  if(user == doc.exp_approver && doc.approval_status == 'Submitted')  unhide_field(['Update Voucher', 'Approve', 'Reject']);
+
+  else hide_field(['Update Voucher', 'Approve', 'Reject']);
+
+  
+  if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
+  else set_field_permlevel('remark', 1);
+}
+
+cur_frm.cscript.employee = function(doc,cdt,cdn){
+  if(doc.employee){
+    $c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
+      if(r.message){
+        doc.employee_name = r.message['emp_nm'];
+        get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];        
+        refresh_many(['exp_approver','employee_name']);
+      }    
+    });
+  }
+}
+
+cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
+  if(doc.approval_status == 'Draft'){
+    var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
+    var total_claim =0;
+    for(var i = 0; i<val.length; i++){
+      total_claim = flt(total_claim)+flt(val[i].claim_amount);
+    }
+    doc.total_claimed_amount = flt(total_claim);
+    refresh_field('total_claimed_amount');
+    
+    $c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
+      if(r.message){
+        if(r.message['valid_approver'] == 'No'){
+          doc.exp_approver ='';
+        }
+        get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
+        get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
+        refresh_field('exp_approver');
+      }
+    });
+  }
+  else if(doc.approval_status == 'Submitted'){
+    var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
+    var total_sanctioned = 0;
+    for(var i = 0; i<val.length; i++){
+      total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
+    }
+    doc.total_sanctioned_amount = flt(total_sanctioned);
+    refresh_field('total_sanctioned_amount');
+  }
+}
+
+cur_frm.cscript['Calculate Total Amount'] = function(doc,cdt,cdn){
+  cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
+  cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+cur_frm.cscript.sanctioned_amount = function(doc,cdt,cdn){
+  cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+
+cur_frm.cscript['Approve'] = function(doc,cdt,cdn){
+
+  if(user == doc.exp_approver){
+    var approve_voucher_dialog;
+    
+    set_approve_voucher_dialog = function() {
+      approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
+      approve_voucher_dialog.make_body([
+        ['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
+        ['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
+        ['HTML', 'Approve Voucher', '<div></div>']
+      ]);
+      
+      var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
+      approve_voucher_btn1.innerHTML = 'Yes';
+      approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
+      
+      var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
+      approve_voucher_btn2.innerHTML = 'No';
+      $y(approve_voucher_btn2,{marginLeft:'4px'});
+      approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
+      
+      approve_voucher_dialog.onshow = function() {
+        $i('approve_voucher_dialog_response').innerHTML = '';
+      }
+      
+      approve_voucher_dialog.add = function() {
+        // sending...
+        $i('approve_voucher_dialog_response').innerHTML = 'Processing...';
+        
+        $c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
+          if(r.message == 'Approved'){
+            $i('approve_voucher_dialog_response').innerHTML = 'Approved';
+            refresh_field('approval_status');
+            hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
+            approve_voucher_dialog.hide();
+          }
+          else if(r.message == 'Incomplete'){
+            $i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
+          }
+          else if(r.message == 'No Amount'){
+            $i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
+          }
+        });
+      }
+    }  
+    
+    if(!approve_voucher_dialog){
+      set_approve_voucher_dialog();
+    }  
+    approve_voucher_dialog.doc = doc;
+    approve_voucher_dialog.cdt = cdt;
+    approve_voucher_dialog.cdn = cdn;
+    approve_voucher_dialog.show();
+    refresh_field('expense_voucher_details');
+    doc.__unsaved = 0;
+    cur_frm.refresh_header();
+  }else{
+    msgprint("Expense Voucher can be approved by Approver only");
+  }
+}
+
+cur_frm.cscript['Reject'] = function(doc,cdt,cdn){
+  if(user == doc.exp_approver){
+    var reject_voucher_dialog;
+    
+    set_reject_voucher_dialog = function() {
+      reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
+      reject_voucher_dialog.make_body([
+        ['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
+        ['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
+        ['HTML', 'Reject Voucher', '<div></div>']
+      ]);
+      
+      var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
+      reject_voucher_btn1.innerHTML = 'Yes';
+      reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
+      
+      var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
+      reject_voucher_btn2.innerHTML = 'No';
+      $y(reject_voucher_btn2,{marginLeft:'4px'});
+      reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
+      
+      reject_voucher_dialog.onshow = function() {
+        $i('reject_voucher_dialog_response').innerHTML = '';
+      }
+      
+      reject_voucher_dialog.add = function() {
+        // sending...
+        $i('reject_voucher_dialog_response').innerHTML = 'Processing...';
+        
+        $c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
+          if(r.message == 'Rejected'){
+            $i('reject_voucher_dialog_response').innerHTML = 'Rejected';
+            refresh_field('approval_status');
+            hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
+            reject_voucher_dialog.hide();
+          }
+        });
+      }
+    }  
+    
+    if(!reject_voucher_dialog){
+      set_reject_voucher_dialog();
+    }  
+    reject_voucher_dialog.doc = doc;
+    reject_voucher_dialog.cdt = cdt;
+    reject_voucher_dialog.cdn = cdn;
+    reject_voucher_dialog.show();
+    refresh_field('expense_voucher_details');
+    doc.__unsaved = 0;
+    cur_frm.refresh_header();
+  }else{
+    msgprint("Expense Voucher can be rejected by Approver only");
+  }
+}
+
+//update follow up
+//=================================================================================
+cur_frm.cscript['Update Voucher'] = function(doc){
+
+  $c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
+    refresh_field('expense_voucher_details');
+    doc.__unsaved = 0;
+    cur_frm.refresh_header();
+  });
+}
diff --git a/payroll/doctype/expense_voucher/expense_voucher.py b/payroll/doctype/expense_voucher/expense_voucher.py
new file mode 100644
index 0000000..01db068
--- /dev/null
+++ b/payroll/doctype/expense_voucher/expense_voucher.py
@@ -0,0 +1,143 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def get_employee_name(self):
+    emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
+    emp_nm = emp_dtl and emp_dtl[0][0] or ''
+    self.doc.employee_name = emp_nm
+    self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
+
+    return cstr(emp_nm)  
+  
+  def get_approver_lst(self):
+    approver_lst =[]
+    approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
+    if approver_lst1:
+      approver_lst=approver_lst1
+    else:
+      approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
+    return approver_lst
+
+  def set_approver(self):
+    ret={}
+    approver_lst =[]
+    emp_nm = self.get_employee_name()
+    approver_lst = self.get_approver_lst()    
+    ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
+    return ret
+
+  def update_voucher(self):
+    sql("delete from `tabExpense Voucher Detail` where parent = '%s'"%self.doc.name)
+    for d in getlist(self.doclist, 'expense_voucher_details'):
+      if not d.expense_type or not d.claim_amount:
+        msgprint("Please remove the extra blank row added")
+        raise Exception
+      d.save(1)
+    if self.doc.total_sanctioned_amount:
+      set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
+    if self.doc.remark:
+      set(self.doc, 'remark', self.doc.remark)
+  
+  def approve_voucher(self):
+    for d in getlist(self.doclist, 'expense_voucher_details'):
+      if not d.sanctioned_amount:
+        msgprint("Please add 'Sanctioned Amount' for all expenses")
+        return cstr('Incomplete')
+    
+    if not self.doc.total_sanctioned_amount:
+      msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
+      return cstr('No Amount')
+    self.update_voucher()
+    
+    set(self.doc, 'approval_status', 'Approved')    
+    # on approval notification
+    get_obj('Notification Control').notify_contact('Expense Voucher Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
+
+    return cstr('Approved')
+  
+  def reject_voucher(self):
+    
+    if self.doc.remark:
+      set(self.doc, 'remark', self.doc.remark)   
+    set(self.doc, 'approval_status', 'Rejected')    
+
+    # on approval notification
+    get_obj('Notification Control').notify_contact('Expense Voucher Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
+
+    return cstr('Rejected')
+  
+  def validate_curr_exp(self):
+    for d in getlist(self.doclist, 'expense_voucher_details'):
+      if flt(d.sanctioned_amount) > 0:
+        if self.doc.approval_status == 'Draft':
+          msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Voucher")
+          raise Exception
+        elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
+          msgprint("Sanctioned amount can be added only by expense voucher Approver")
+          raise Exception
+  
+  def validate_fiscal_year(self):
+    fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
+    ysd=fy and fy[0][0] or ""
+    yed=add_days(str(ysd),365)
+    if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
+      msgprint("Posting Date is not within the Fiscal Year selected")
+      raise Exception
+    
+  def validate(self):
+    self.validate_curr_exp()
+    self.validate_fiscal_year()
+  
+  def on_update(self):
+    set(self.doc, 'approval_status', 'Draft')
+  
+  def validate_exp_details(self):
+    if not getlist(self.doclist, 'expense_voucher_details'):
+      msgprint("Please add expense voucher details")
+      raise Exception
+    
+    if not self.doc.total_claimed_amount:
+      msgprint("Please calculate Total Claimed Amount")
+      raise Exception
+    
+    if not self.doc.exp_approver:
+      msgprint("Please select Expense Voucher approver")
+      raise Exception
+  
+  def validate_approver(self):
+    app_lst = self.get_approver_lst()
+    if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
+      msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
+      valid_app = 'No'
+    else:
+      valid_app = 'Yes'
+    ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
+    return ret
+  
+  def on_submit(self):
+    self.validate_exp_details()
+    set(self.doc, 'approval_status', 'Submitted')
+  
+  def on_cancel(self):
+    set(self.doc, 'approval_status', 'Cancelled')
\ No newline at end of file
diff --git a/payroll/doctype/expense_voucher/expense_voucher.txt b/payroll/doctype/expense_voucher/expense_voucher.txt
new file mode 100644
index 0000000..09221e7
--- /dev/null
+++ b/payroll/doctype/expense_voucher/expense_voucher.txt
@@ -0,0 +1,906 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'EXP.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-10-14 11:41:31',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Expense Voucher',
+		'name_case': '',
+		'owner': 'harshada@webnotestech.com',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': '',
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'approval_status,employee,employee_name',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'subject': 'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
+		'tag_fields': 'approval_status',
+		'use_template': None,
+		'version': 133
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-03-05 17:16:47',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-03-05 17:16:47',
+		'modified_by': 'Administrator',
+		'name': 'PERM00815',
+		'owner': 'Administrator',
+		'parent': 'Expense Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-03-05 17:16:47',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': None,
+		'modified': '2011-03-05 17:16:47',
+		'modified_by': 'Administrator',
+		'name': 'PERM00816',
+		'owner': 'Administrator',
+		'parent': 'Expense Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-03-05 17:16:47',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': None,
+		'modified': '2011-03-05 17:16:47',
+		'modified_by': 'Administrator',
+		'name': 'PERM00817',
+		'owner': 'Administrator',
+		'parent': 'Expense Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-09-03 16:45:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': '',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00677',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Details',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03870',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'approval_status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Approval Status',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03871',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'approval_status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nApproved \nRejected\nCancelled',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'From Employee',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03872',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Employee Name',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03873',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03874',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03875',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03876',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Posting Date',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03877',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'posting_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'exp_approver',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Approver',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03878',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'exp_approver',
+		'oldfieldtype': 'Select',
+		'options': '',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remark',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Remark',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03879',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remark',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03880',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03881',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Approve',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03882',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Reject',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03883',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Expense Details',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03884',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Calculate Total Amount',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03885',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_claimed_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 0,
+		'label': 'Total Claimed Amount',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03886',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_claimed_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': '',
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_sanctioned_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 0,
+		'label': 'Total Sanctioned Amount',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03887',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_sanctioned_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Update Voucher',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03888',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': '',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-09-03 16:45:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'expense_voucher_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Expense Voucher Details',
+		'modified': '2010-09-03 16:45:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03889',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'expense_voucher_details',
+		'oldfieldtype': 'Table',
+		'options': 'Expense Voucher Detail',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-15 14:56:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Employees Email Id',
+		'modified': '2010-10-15 14:56:33',
+		'modified_by': 'Administrator',
+		'name': 'FL03982',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'email_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Expense Voucher',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/expense_voucher_detail/__init__.py b/payroll/doctype/expense_voucher_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/expense_voucher_detail/__init__.py
diff --git a/payroll/doctype/expense_voucher_detail/expense_voucher_detail.txt b/payroll/doctype/expense_voucher_detail/expense_voucher_detail.txt
new file mode 100644
index 0000000..66afc70
--- /dev/null
+++ b/payroll/doctype/expense_voucher_detail/expense_voucher_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-23 18:10:16', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Expense Voucher Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'expense_date', 'owner': 'harshada@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expense Date', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05982', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'expense_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'expense_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expense Type', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05983', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'expense_type', 'fieldtype': 'Link', 'options': 'Expense Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05984', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'claim_amount', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Claim Amount', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05985', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'claim_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'sanctioned_amount', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Sanctioned Amount', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL05986', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'sanctioned_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/experience_in_company_detail/__init__.py b/payroll/doctype/experience_in_company_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/experience_in_company_detail/__init__.py
diff --git a/payroll/doctype/experience_in_company_detail/experience_in_company_detail.txt b/payroll/doctype/experience_in_company_detail/experience_in_company_detail.txt
new file mode 100644
index 0000000..0e3fa75
--- /dev/null
+++ b/payroll/doctype/experience_in_company_detail/experience_in_company_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Experience In Company Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'branch', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Branch', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Experience In Company Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04372', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:13:20', 'parenttype': 'DocType', 'fieldname': 'branch', 'fieldtype': 'Select', 'options': 'link:Branch', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'department', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Department', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Experience In Company Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04373', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:13:20', 'parenttype': 'DocType', 'fieldname': 'department', 'fieldtype': 'Select', 'options': 'link:Department', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'designation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Experience In Company Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04374', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:13:20', 'parenttype': 'DocType', 'fieldname': 'designation', 'fieldtype': 'Select', 'options': 'link:Designation', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'grade', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Grade', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Experience In Company Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04375', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-01 15:13:20', 'parenttype': 'DocType', 'fieldname': 'grade', 'fieldtype': 'Select', 'options': 'link:Grade', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'from_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'From Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Experience In Company Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04376', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:13:20', 'parenttype': 'DocType', 'fieldname': 'from_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'to_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'To Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Experience In Company Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04377', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-01 15:13:20', 'parenttype': 'DocType', 'fieldname': 'to_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/grade/__init__.py b/payroll/doctype/grade/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/grade/__init__.py
diff --git a/payroll/doctype/grade/grade.js b/payroll/doctype/grade/grade.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/grade/grade.js
diff --git a/payroll/doctype/grade/grade.txt b/payroll/doctype/grade/grade.txt
new file mode 100644
index 0000000..7732cf1
--- /dev/null
+++ b/payroll/doctype/grade/grade.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:grade_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Grade', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00731', 'parent': 'Grade', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:44', 'modified': '2010-09-20 09:41:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00799', 'parent': 'Grade', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:49', 'modified': '2010-09-20 09:41:00', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00800', 'parent': 'Grade', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:49', 'modified': '2010-09-20 09:41:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Grade', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04846', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:41:00', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'grade_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Grade', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Grade', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04378', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:41:00', 'parenttype': 'DocType', 'fieldname': 'grade_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/holiday_list/__init__.py b/payroll/doctype/holiday_list/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/holiday_list/__init__.py
diff --git a/payroll/doctype/holiday_list/holiday_list.js b/payroll/doctype/holiday_list/holiday_list.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/holiday_list/holiday_list.js
diff --git a/payroll/doctype/holiday_list/holiday_list.py b/payroll/doctype/holiday_list/holiday_list.py
new file mode 100644
index 0000000..afafcec
--- /dev/null
+++ b/payroll/doctype/holiday_list/holiday_list.py
@@ -0,0 +1,116 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+
+import datetime
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # ---------
+  # autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.fiscal_year +"/"+ self.doc.holiday_list_name+"/.###")
+
+
+# *************************************************** utilities ***********************************************
+  # ----------------
+  # validate values
+  # ----------------
+  def validate_values(self):
+    if not self.doc.fiscal_year:
+      msgprint("Please select Fiscal Year")
+      raise Exception
+    if not self.doc.weekly_off:
+      msgprint("Please select weekly off day")
+      raise Exception
+
+
+  # ------------------------------------
+  # get fiscal year start and end dates
+  # ------------------------------------
+  def get_fy_start_end_dates(self):
+    st_date = sql("select year_start_date from `tabFiscal Year` where name = '%s'" %(self.doc.fiscal_year))
+    st_date = st_date and st_date[0][0].strftime('%Y-%m-%d') or ''
+    ed_date = add_days(add_years(st_date,1), -1)
+    return st_date, ed_date
+
+  # -------------------------
+  # get weekly off date list
+  # -------------------------
+  def get_weekly_off_date_list(self, yr_start_date, yr_end_date):
+    days_dict, dt_list, lst_st = {'Monday':0,'Tuesday':1,'Wednesday':2,'Thursday':3,'Friday':4,'Saturday':5,'Sunday':6}, [], ''
+
+    w = cint(days_dict[self.doc.weekly_off])    # Weekly Off Day No.
+
+    st_dt_weekday = getdate(yr_start_date).weekday()    # Year Start Date weekday()
+
+    if w == st_dt_weekday:     # Get Start Date
+      lst_st = yr_start_date
+      dt_list.append(lst_st)
+    elif w > st_dt_weekday:
+      lst_st = add_days(yr_start_date,w - st_dt_weekday)
+      dt_list.append(lst_st)
+    else:
+      lst_st = add_days(yr_start_date,6 - st_dt_weekday + 1)
+      dt_list.append(lst_st)
+
+    while getdate(lst_st) < getdate(yr_end_date):    # Get list of dates
+      lst_st = add_days(lst_st,7)
+      if getdate(lst_st) > getdate(yr_end_date):
+        break
+      dt_list.append(lst_st)
+
+    return dt_list
+
+  # ---------------------
+  # get weekly off dates
+  # ---------------------
+  def get_weekly_off_dates(self):
+    self.validate_values()
+    yr_start_date, yr_end_date = self.get_fy_start_end_dates()
+    date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
+    for d in date_list:
+      ch = addchild(self.doc, 'holiday_list_details', 'Holiday List Detail', 1, self.doclist)
+      ch.description = self.doc.weekly_off
+      ch.holiday_date = d
+
+  # ------------
+  # clear table
+  # ------------
+  def clear_table(self):
+    self.doc.clear_table(self.doclist,'holiday_list_details')
+
+
+# ***************************************** validate *************************************************
+
+  # ---------------------------
+  # check default holiday list
+  # ---------------------------
+  def update_default_holiday_list(self):
+    sql("update `tabHoliday List` set is_default = 0 where ifnull(is_default, 0) = 1 and fiscal_year = '%s'" % (self.doc.fiscal_year))
+
+
+  # ---------
+  # validate
+  # ---------
+  def validate(self):
+    self.update_default_holiday_list()
diff --git a/payroll/doctype/holiday_list/holiday_list.txt b/payroll/doctype/holiday_list/holiday_list.txt
new file mode 100644
index 0000000..14b6c28
--- /dev/null
+++ b/payroll/doctype/holiday_list/holiday_list.txt
@@ -0,0 +1,381 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:03',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Holiday List',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 17
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:03',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'PERM00249',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Holiday List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-02-11 14:00:28',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'PERM00806',
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01452',
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'holiday_list_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Holiday List Name',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01453',
+		'no_copy': None,
+		'oldfieldname': 'holiday_list_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-12 13:37:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_default',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Default',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL04508',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01454',
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Link',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-11 14:00:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'weekly_off',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Weekly Off',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL04505',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday',
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-11 14:00:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Get Weekly Off Dates',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL04506',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'get_weekly_off_dates',
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'holiday_list_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Holiday List Details',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01455',
+		'no_copy': None,
+		'oldfieldname': 'holiday_list_details',
+		'oldfieldtype': 'Table',
+		'options': 'Holiday List Detail',
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-11 17:19:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Clear Table',
+		'modified': '2011-02-12 13:37:12',
+		'modified_by': 'Administrator',
+		'name': 'FL04507',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'clear_table',
+		'owner': 'Administrator',
+		'parent': 'Holiday List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/holiday_list_detail/__init__.py b/payroll/doctype/holiday_list_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/holiday_list_detail/__init__.py
diff --git a/payroll/doctype/holiday_list_detail/holiday_list_detail.txt b/payroll/doctype/holiday_list_detail/holiday_list_detail.txt
new file mode 100644
index 0000000..2c2406b
--- /dev/null
+++ b/payroll/doctype/holiday_list_detail/holiday_list_detail.txt
@@ -0,0 +1,125 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:03',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-11 14:23:09',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Holiday List Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 4
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-02-11 14:23:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01456',
+		'no_copy': None,
+		'oldfieldname': 'holiday_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Holiday List Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'holiday_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Date',
+		'modified': '2011-02-11 14:23:09',
+		'modified_by': 'Administrator',
+		'name': 'FL01457',
+		'no_copy': None,
+		'oldfieldname': 'holiday_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Holiday List Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/invest_80_declaration_detail/__init__.py b/payroll/doctype/invest_80_declaration_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/invest_80_declaration_detail/__init__.py
diff --git a/payroll/doctype/invest_80_declaration_detail/invest_80_declaration_detail.txt b/payroll/doctype/invest_80_declaration_detail/invest_80_declaration_detail.txt
new file mode 100644
index 0000000..c2cb6ca
--- /dev/null
+++ b/payroll/doctype/invest_80_declaration_detail/invest_80_declaration_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 10, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Invest 80 Declaration Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00733', 'parent': 'Invest 80 Declaration Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:44', 'modified': '2010-04-01 15:14:59', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00734', 'parent': 'Invest 80 Declaration Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:44', 'modified': '2010-04-01 15:14:59', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'particulars4', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Particulars', 'width': '300px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Invest 80 Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04383', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:14:59', 'parenttype': 'DocType', 'fieldname': 'particulars4', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'under_section4', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Under Section', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Invest 80 Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04384', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:14:59', 'parenttype': 'DocType', 'fieldname': 'under_section4', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'max_limit4', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Max. Limit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Invest 80 Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04385', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:14:59', 'parenttype': 'DocType', 'fieldname': 'max_limit4', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'actual_amount4', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Actual Amount', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Invest 80 Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04386', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:14:59', 'parenttype': 'DocType', 'fieldname': 'actual_amount4', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'eligible_amount4', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Eligible Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Invest 80 Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04387', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:14:59', 'parenttype': 'DocType', 'fieldname': 'eligible_amount4', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'modified_amount4', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Modified Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Invest 80 Declaration Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04388', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-01 15:14:59', 'parenttype': 'DocType', 'fieldname': 'modified_amount4', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/it_checklist/__init__.py b/payroll/doctype/it_checklist/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/it_checklist/__init__.py
diff --git a/payroll/doctype/it_checklist/it_checklist.js b/payroll/doctype/it_checklist/it_checklist.js
new file mode 100644
index 0000000..d30e35a
--- /dev/null
+++ b/payroll/doctype/it_checklist/it_checklist.js
@@ -0,0 +1,161 @@
+cur_frm.cscript.onload=function(doc,cdt,cdn){
+
+  if(doc.employee && doc.__islocal ==1){
+    cur_frm.cscript.employee(doc,cdt,cdn);
+  }
+  if(doc.rent_acc == "Yes") unhide_field('ann_rent');
+}
+
+// when user select an employee corresponding basic, gross income and pf is set.
+cur_frm.cscript.employee = function(doc,cdt,cdn){
+  var mydoc=doc;
+  $c('runserverobj', args={'method':'set_values','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+      function(r, rt) {
+        var doc = locals[mydoc.doctype][mydoc.name];
+       
+        if(r.message){
+        doc.hra_count = r.message;
+        refresh_field('hra_count')
+        }
+        refresh_many(['employee','employee_name','basic','gross_income','pf']);
+        
+      }
+    );
+}
+
+cur_frm.fields_dict['employee'].get_query = function(doc,dt,dn) {
+   return 'SELECT tabEmployee.name FROM tabEmployee WHERE tabEmployee.status = "Active" AND tabEmployee.docstatus !=2 AND tabEmployee.name LIKE "%s" ORDER BY tabEmployee.name DESC LIMIT 50'
+}
+
+//---------------------------------------------------------
+//if rent accomodation is yes then unhide annual rent paid else unhide.
+cur_frm.cscript.rent_acc = function(doc,cdt,cdn){
+  doc.ann_rent = 0
+  if(doc.rent_acc == 'Yes')
+    unhide_field('ann_rent');
+  else
+    hide_field('ann_rent');
+  refresh_field('ann_rent');
+}
+
+//---------------------------------------------------------
+//On done button click check for all values filled or not, and accordingly add records in child tables
+
+cur_frm.cscript['Done']=function(doc,cdt,cdn){
+  var mydoc=doc;
+
+  if(doc.employee && doc.fiscal_year && doc.metro && doc.sr_citizen && doc.part_sr_citizen && doc.basic && doc.gross_income){
+    if((doc.rent_acc == "Yes" && doc.ann_rent) || (doc.rent_acc == "No")){
+        
+        $c('runserverobj', args={'method':'set_tables', 'arg': doc.hra_count, 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+        function(r, rt) {
+          var doc = locals[mydoc.doctype][mydoc.name];
+          refresh_many(['edu_cess','tax_tot_income','net_tot_tax_income','tax_per_month','applicable_from','rem_months']);
+          refresh_many(['exe_declaration_details','oth_inc_decl_details','chap_via_decl_details','invest_80_decl_details']);
+          }
+        );
+      
+    }
+    
+    else if(doc.rent_acc == "Yes" && !doc.ann_rent)
+      alert("Please enter annual rent");
+  }
+  else
+    alert("please fill up all data");
+}
+
+
+//---------------------------------------------------------
+//change event of actual amount1 field (exemption declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
+cur_frm.cscript.actual_amount1= function(doc,cdt,cdn){
+  
+  var cl = getchildren('Declaration Detail', doc.name, 'exe_declaration_details');
+  for(var c=0; c<cl.length; c++) {
+    if(cl[c].name == cdn){
+      if(((flt(cl[c].actual_amount1) <= flt(cl[c].max_limit1)) || (flt(cl[c].actual_amount1) == 0)) || ((cl[c].particulars1 != 'House Rent Allowance') && (flt(cl[c].max_limit1) == 0.00)) || ((cl[c].particulars1 == 'House Rent Allowance') && (flt(cl[c].max_limit1) != 0.00) && (flt(cl[c].actual_amount1) <= flt(cl[c].max_limit1)))){
+        cl[c].eligible_amount1 =cl[c].actual_amount1
+        cl[c].modified_amount1 =cl[c].actual_amount1
+      } 
+      else {
+        
+        cl[c].eligible_amount1 =cl[c].max_limit1
+        cl[c].modified_amount1 =cl[c].max_limit1
+      } 
+     
+      refresh_field('exe_declaration_details'); 
+    }
+  }
+ 
+}
+
+
+
+//---------------------------------------------------------
+////change event of actual amount2 field (Other Income declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
+cur_frm.cscript.actual_amount2= function(doc,cdt,cdn){
+  var cl = getchildren('Other Income Detail', doc.name, 'oth_inc_decl_details');
+  for(var c=0; c<cl.length; c++) {
+    if(cl[c].name == cdn){
+      if((flt(cl[c].actual_amount2) <= flt(cl[c].max_limit2)) || flt((cl[c].actual_amount2) ==0) || !(cl[c].max_limit2)){
+        cl[c].eligible_amount2 =cl[c].actual_amount2
+        cl[c].modified_amount2 =cl[c].actual_amount2
+          
+      } 
+      else {
+        cl[c].eligible_amount2 =cl[c].max_limit2
+        cl[c].modified_amount2 =cl[c].max_limit2
+      } 
+    
+    
+      refresh_field('oth_inc_decl_details');
+    }
+  }
+}
+
+//---------------------------------------------------------
+//change event of actual amount3 field (Chapter VI A declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
+cur_frm.cscript.actual_amount3= function(doc,cdt,cdn){
+  
+
+  var cl = getchildren('Chapter VI A Detail', doc.name, 'chap_via_decl_details');
+  for(var c=0; c<cl.length; c++) {
+    if(cl[c].name == cdn){
+      if((flt(cl[c].actual_amount3) <= flt(cl[c].max_limit3)) || flt((cl[c].actual_amount3) ==0) || !(cl[c].max_limit3)){
+        cl[c].eligible_amount3 =cl[c].actual_amount3
+        cl[c].modified_amount3 =cl[c].actual_amount3
+          
+      } 
+      else {
+        cl[c].eligible_amount3 =cl[c].max_limit3
+        cl[c].modified_amount3 =cl[c].max_limit3
+      } 
+    
+      refresh_field('chap_via_decl_details');
+    }
+  }
+}
+
+//---------------------------------------------------------
+//change event of actual amount4 field (Invest 80 declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
+cur_frm.cscript.actual_amount4= function(doc,cdt,cdn){
+  
+  var cl = getchildren('Invest 80 Declaration Detail', doc.name, 'invest_80_decl_details');
+  for(var c=0; c<cl.length; c++) {
+    if(cl[c].name == cdn){
+      if((flt(cl[c].actual_amount4) <= flt(cl[c].max_limit4)) || flt((cl[c].actual_amount4) ==0) || !(cl[c].max_limit4)){
+        cl[c].eligible_amount4 =cl[c].actual_amount4
+        cl[c].modified_amount4 =cl[c].actual_amount4
+          
+      } 
+      else {
+        cl[c].eligible_amount4 =cl[c].max_limit4
+        cl[c].modified_amount4 =cl[c].max_limit4
+      } 
+   
+      refresh_field('invest_80_decl_details');
+    }
+  }  
+}
+cur_frm.cscript.refresh=function(doc,cdt,cdn){
+
+}
diff --git a/payroll/doctype/it_checklist/it_checklist.py b/payroll/doctype/it_checklist/it_checklist.py
new file mode 100644
index 0000000..abed301
--- /dev/null
+++ b/payroll/doctype/it_checklist/it_checklist.py
@@ -0,0 +1,419 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  #init function
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist  
+  
+  def autoname(self):
+    self.doc.name = make_autoname('IT Check/' +self.doc.employee + '/.#####')
+    
+  #===========================================================
+  #check for already exist IT Checklist for resp. Employee
+  def exist_IT_Check(self):
+    
+    #query for return already exist IT Checklist for respective employee
+    exist_ret = sql("select name from `tabIT Checklist` where is_cheklist_active = 'Yes' and employee = '%s' and name!='%s'"%(self.doc.employee,self.doc.name))
+    
+    # validation - if exist then raise exception 
+    if exist_ret:
+      msgprint("Active IT Checklist '%s' for employee '%s' exist."%(exist_ret[0][0],self.doc.employee))
+      self.doc.employee = ""
+      self.doc.basic = 0
+      self.doc.gross_income = 0
+      self.doc.pf = 0
+      return 0
+    else:
+      flag = self.exist_sal_struct() #check for slaray structure exist or not, if exist then further action can be done.
+      return flag
+      
+  #===========================================================
+  #check for salary structure exist or not, if exist then further action can be done.
+  def exist_sal_struct(self):
+    #query return salary structure for particular employee exist or not
+    exist_salstr=sql("select name from `tabSalary Structure` where employee = '%s' and is_active='Yes'"%self.doc.employee)
+    if not exist_salstr:
+      msgprint("Please first create salary structure for employee '%s'"%self.doc.employee)
+      self.doc.employee = ''
+      return 0
+    else:
+      return 1
+    
+  #===========================================================
+  #get previous salary slip gross income and basic amount
+  def get_info(self):
+    ret_sal_slip = sql("select count(name), sum(gross_pay) from `tabSalary Slip` where docstatus =1 and fiscal_year = '%s' and employee = '%s'"%(self.doc.fiscal_year,self.doc.employee))
+    
+    sum_basic = sum_pf = 0
+    
+    if ret_sal_slip:
+      #get name of salary slip of resp. employee 
+      ret_name =convert_to_lists(sql("select name from `tabSalary Slip` where docstatus =1 and fiscal_year = '%s' and employee = '%s' "%(self.doc.fiscal_year,self.doc.employee)))
+      
+      if ret_name:
+        for b in ret_name:
+          #get earning amount of basic 
+          ret_basic = sql("select e_amount from `tabSS Earning Detail` where parent = '%s' and e_type = 'Basic'"%(b[0]))
+          sum_basic += ret_basic[0][0] or 0  
+          
+          #get deduction amount of Provident Fund
+          ret_pf = sql("select d_amount from `tabSS Deduction Detail` where parent = '%s' and d_type = 'Provident Fund'"%(b[0]))
+          
+          sum_pf += ret_pf[0][0] or 0
+                  
+    ret_list = [ret_sal_slip[0][0] or 0,ret_sal_slip[0][1] or 0, sum_basic, sum_pf]
+    return ret_list  
+  
+  #-------------------------------------------
+  def get_basic_gross(self,ret_list0,ret_list1,ret_list2):
+   
+    self.doc.basic = self.doc.gross_income = 0
+    #query return list of earning types and resp. modified amount
+    ret = convert_to_lists(sql("select e.e_type, e.modified_value from `tabEarning Detail` e , `tabSalary Structure` s where s.is_active = 'Yes' and s.employee='%s' and e.parent = s.name" %(self.doc.employee)))
+    hra_count=1
+    if ret:
+      count = 0.0
+      for i in ret:
+        if i[0] == 'Basic':
+          if i[1] == 0:  
+            msgprint("Basic is zero in salary structure")
+
+          self.doc.basic = flt(i[1])*(12-int(ret_list0)) + flt(ret_list2)
+        count += flt(i[1])
+        if i[0] =='House Rent Allowance':
+          hra_count = flt(i[1])
+      if count == 0:
+        msgprint("Gross Income is zero in salary structure")    
+
+     
+      self.doc.gross_income = count*(12-int(ret_list0)) + flt(ret_list1)
+
+    if hra_count == 0 or hra_count == "":
+      hra_count=1
+          
+    return hra_count
+    
+  #-------------------------------------------
+  def get_pf(self,ret_list0,ret_list3):
+    self.doc.pf = 0.0    
+              
+    #query returns amount 
+    ret_ded = sql("select d.d_modified_amt from `tabDeduction Detail` d , `tabSalary Structure` s where s.is_active = 'Yes' and s.employee='%s' and d.parent = s.name and d.d_type = 'Provident Fund'" %(self.doc.employee))
+    
+    if not ret_ded:
+      msgprint("PF Amount in Salary Structure is zero")
+    
+    ret_ded = flt(ret_ded[0][0]) or 0
+        
+    #annual pf = salary structure * (12 - remaining month to complete fiscal year)- previous salary slip's total pf for current fiscal year
+    self.doc.pf = (ret_ded*(12 - int(ret_list0)))+flt(ret_list3)  
+    
+    
+  #-------------------------------------------
+  def set_values(self):
+    hra_count=1
+    if not self.doc.fiscal_year:
+      msgprint("Please select Fiscal Year")
+      self.doc.employee = ''
+    
+    elif self.doc.employee:
+      
+      flag = self.exist_IT_Check()   #check for already exist IT Checklist for resp. Employee
+    
+      if flag == 1:
+     
+        ename = sql("select employee_name from `tabEmployee` where name = '%s'"%self.doc.employee)[0][0]
+        set(self.doc,'employee_name',cstr(ename))
+        #call get_info to get values of salary slip's total basic, pf and gross income amount
+        ret_list = self.get_info()
+
+        self.get_pf(ret_list[0],ret_list[3])
+      
+        hra_count = self.get_basic_gross(ret_list[0],ret_list[1],ret_list[2])        
+  
+    return hra_count
+  
+  #===========================================================  
+  #-------------------------------------------
+  def set_tables(self, hra_count):        #set tables values
+    
+    self.set_exemption_table(hra_count)
+    self.set_other_income_table()
+    self.set_deduction_via_table()
+    self.set_invest_80c_table()
+    self.doc.edu_cess = self.doc.tax_tot_income = self.doc.net_tot_tax_income = self.doc.tax_per_month = 0
+    self.doc.applicable_from = self.doc.rem_months=''
+    msgprint("Successful")
+    return ''
+  
+  #-------------------------------------------
+  def get_month_diff(self):
+    #end_month = get_defaults()['end_month']
+      
+    month_dict = {"January" :'01', "February" :'02',"March" :'03',"April":'04',"May":'05',"June":'06',"July":'07',"August":'08',"September":'09',"October":'10',"November":'11',"December":'12'}
+    
+    import datetime
+
+    start_month =  getdate(get_defaults()['year_start_date']).month
+    end_month = cint(start_month) - 1
+    if end_month <= 0:
+      end_month = 12
+    str_end_month = cstr(end_month)
+    
+    if len(str_end_month)==1:
+      str_end_month = '0'+str_end_month
+    
+    
+    to_month = datetime.date.today().strftime("%B")
+    to_year = datetime.date.today().strftime("%Y")
+    
+    fiscal_year = self.doc.fiscal_year
+    
+    str_fy =fiscal_year.split("-")
+    
+    endym=int(str_fy[1]+str_end_month)
+    startym= int(to_year+month_dict[to_month])
+
+    month_diff =sql("SELECT PERIOD_DIFF(%d,%d);" %(endym,startym))[0][0]+1
+    
+    return month_diff
+  
+  
+ 
+  #------------------------------------------- 
+  def set_exemption_values(self,ann_hra):
+    ret = convert_to_lists(sql("select name, exemption_limit from `tabEarning Type` where taxable = 'No' and docstatus !=2"))
+    
+    if ret:
+      for r in ret:
+
+        ch = addchild(self.doc,'exe_declaration_details','Declaration Detail',0, self.doclist)
+        ch.particulars1 = r[0]
+        ch.under_section1 = "U/Sec 10 & 17"
+        
+        if r[0] == 'House Rent Allowance':
+          if (self.doc.ann_rent <= 0.00):
+            ch.max_limit1 = 0.00
+            
+          else:
+            hra1=0.00
+            if(self.doc.metro == 'Yes'):
+              hra1 = flt(self.doc.basic)*50/100
+            elif(self.doc.metro == 'No'):
+              hra1 = flt(self.doc.basic)*40/100
+            hra2 = flt(ann_hra)
+            hra3 = flt(self.doc.ann_rent) - (flt(self.doc.basic)/10)
+
+
+            if hra1 <= 0 or hra2 <=0 or hra3 <=0:
+              ch.max_limit1 = 0
+            else:
+              ch.max_limit1=min(hra1,min(hra2,hra3))
+        else:    
+          ch.max_limit1 = r[1]
+        
+        ch.actual_amount1 = 0.00
+        ch.eligible_amount1 = 0.00
+        ch.modified_amount1 = 0.00
+  
+  #-------------------------------------------    
+  def set_exemption_table(self, hra_count):
+    self.doc.clear_table(self.doclist, 'exe_declaration_details',1)
+    ann_hra = 0
+    if (self.doc.ann_rent > 0):
+    
+      #query return sum of earning types amount where earning type = 'HRA'
+      ret_sal_slip = sql("select sum(e.e_amount) from `tabSS Earning Detail` e , `tabSalary Slip` s where s.fiscal_year = '%s' and s.docstatus = 1 and s.employee='%s' and e.parent = s.name and e.e_type = 'House Rent Allowance'" %(self.doc.fiscal_year,self.doc.employee))
+      if not ret_sal_slip:
+        ret_sal_slip = 0.00
+      else:
+        ret_sal_slip = ret_sal_slip[0][0]      
+     
+      month_diff = self.get_month_diff()     
+      
+      #ret_sal_slip = ret_sal_slip[0][0] or 0.00
+      ann_hra = (flt(hra_count)*flt(month_diff))+flt(ret_sal_slip);
+      
+    self.set_exemption_values(ann_hra)
+ 
+  #-------------------------------------------     
+  def set_other_income_table(self):
+    self.doc.clear_table(self.doclist, 'oth_inc_decl_details',1)
+    other_income =[["Income from Housing","----",0.00],["Relief on interest paid on Housing Loan","U/S 24(1)(Vi)",150000],["Any other Income","----",0.00]]
+    
+    for oi in other_income:
+      ch1 = addchild(self.doc,'oth_inc_decl_details','Other Income Detail',0, self.doclist)
+      ch1.particulars2 = oi[0]
+      ch1.under_section2 = oi[1]
+      ch1.max_limit2 = oi[2]
+      ch1.actual_amount2 = 0.00
+      ch1.eligible_amount2 = 0.00
+      ch1.modified_amount2 = 0.00
+  
+  
+  #---------------------------------------  
+  def get_maxlmt_via(self):
+    if(self.doc.part_sr_citizen == 'Yes'): 
+      max_lmt1 = 20000
+    else:
+      max_lmt1 = 15000
+      
+    if(self.doc.per_dep_dis == "Less than 80% disability"):
+      max_lmt2 = 50000
+    elif(self.doc.per_dep_dis == "More than 80% disability"):
+      max_lmt2 = 100000
+    else:
+      max_lmt2 = 0.00
+
+    if(self.doc.per_self_dis == "Less than 80% disability"):
+      max_lmt3 = 50000
+    elif(self.doc.per_self_dis == "More than 80% disability"):
+      max_lmt3 = 75000
+    else:
+      max_lmt3 = 0.00
+    
+    maxlmt_lst=[max_lmt1,max_lmt2,max_lmt3]
+    
+    return maxlmt_lst
+
+  #---------------------------------------     
+  def set_deduction_via_table(self):
+    self.doc.clear_table(self.doclist, 'chap_via_decl_details',1)
+    
+    maxlmt_lst = self.get_maxlmt_via()
+
+    deduct_via = [["Medical Insurance Premium","U/Sec 80D(2A)",15000],["Medical Insurance Premium for parents","U/Sec 80D(2A)", maxlmt_lst[0]],["Medical for handicapped dependents","U/Sec 80DD",maxlmt_lst[1]],["Medical for specified diseases","U/Sec 80DDB",40000],["Higher Education Loan Interest Repayment","U/Sec 80E",0.00],["*Donation to approved Fund and charities","U/sec 80G",0.00],["*Rent deduction only if HRA not received","U/sec 80GG",0.00],["Deduction for permanent disability","U/Sec 80 U",maxlmt_lst[2]],["Any other deductions","----",0.00]]
+   
+    
+    for dv in deduct_via:
+      ch = addchild(self.doc,'chap_via_decl_details','Chapter VI A Detail',0, self.doclist)
+      ch.particulars3 = dv[0]
+      ch.under_section3 = dv[1]
+      ch.max_limit3 = dv[2]
+      ch.actual_amount3 = 0.00
+      ch.eligible_amount3 = 0.00
+      ch.modified_amount3 = 0.00
+    
+   
+  #----------------------------------------   
+  def set_invest_80c_table(self):
+    self.doc.clear_table(self.doclist, 'invest_80_decl_details',1)
+    invest_lst = [["Employees Provident Fund","U/Sec 80C",0.00],["Voluntary Contribution Provident Fund","U/Sec 80C",0.00],["Investment in Pension Scheme","U/Sec 80 CCC",10000],["Housing Loan Principal Repayment","U/Sec 80C",0.00],["Public Provident Fund (PPF)","U/Sec 80C",0.00],["Life Insurance Premium Paid","U/Sec 80C",0.00],["Unit Linked Insurance Plans","U/Sec 80C",0.00],["NSC - National Saving Certificate","U/Sec 80C",0.00],["Deposite in National Saving Scheme (NSS)","U/Sec 80C",0.00],["Infrastructure Investment in approved Shares, Debentures & Bonds","U/Sec 80C",0.00],["Mutual Funds notified under Section 10 (23D)","U/Sec 80C",0.00],["Equity Link Saving Scheme (ELSS) Mutual Funds notified under Section 10 (23D)","U/Sec 80C",0.00],["Term Deposite with a SCH. Bank in a notified Scheme for a team not less than 5 years ","U/Sec 80C",0.00],["Tution Fees Paid (Only full time education tution fees paid to any Indian Univ, College, School)","U/Sec 80C","24000"],["Senior Citizen Savings Scheme Rules, 2004","U/Sec 80C",0.00],["Post Office Time Deposit Rules, 1981 for a term not less than 5 years","U/Sec 80C",0.00]]
+  
+  
+    for il in invest_lst:
+      ch = addchild(self.doc,'invest_80_decl_details','Invest 80 Declaration Detail',0, self.doclist)
+      ch.particulars4 = il[0]
+      ch.under_section4 = il[1]
+      ch.max_limit4 = il[2]
+      ch.actual_amount4 = 0.00
+      ch.eligible_amount4 = 0.00
+      ch.modified_amount4 = 0.00
+      
+      
+  #---------------------------------------
+  def sum_mod_val(self):
+    count = count1 = count2 = 0.0
+    
+    for e in getlist(self.doclist,'exe_declaration_details'):
+      count += flt(e.modified_amount1)
+    
+    count = round(flt(self.doc.gross_income)) - count
+    
+    for oi in getlist(self.doclist,'oth_inc_decl_details'):
+      count += flt(oi.modified_amount2)
+    
+    for vi in getlist(self.doclist,'chap_via_decl_details'):
+      count2 += flt(vi.modified_amount3)
+    
+    count = count - count2
+    
+    for inv in getlist(self.doclist,'invest_80_decl_details'):
+      count1 += flt(inv.modified_amount4)
+      if(count1 >= 100000):
+        break
+      
+    if(count1>100000):
+      count1=100000
+      
+    count_lst = [count,count1]
+    return count_lst
+  
+  #----------------------------------------  
+  def calculate_tax(self):
+    
+    count_lst = self.sum_mod_val()
+    
+    count = round(flt(count_lst[0]) - flt(count_lst[1]))
+    if(count>0):
+      self.doc.net_tot_tax_income = count
+      
+      ret_gender = sql("select gender from `tabEmployee` where name = '%s' "%self.doc.employee)[0][0]
+      
+      if(self.doc.sr_citizen == 'Yes'):
+        self.calc_tax(count,240000)        
+      elif(ret_gender == 'Male'):
+        self.calc_tax(count,160000)
+      elif(ret_gender == 'Female'):
+        self.calc_tax(count,190000)
+    else:
+      self.doc.net_tot_tax_income = 0
+      self.doc.tax_tot_income = 0
+      self.doc.edu_cess = 0
+  #-----------------------------------------------    
+  def calc_tax(self,count,upper_limit):
+    balance = 0
+    tax = 0
+    if(count> upper_limit):
+      balance = count - upper_limit
+      if balance > (500000 - upper_limit):
+        balance = balance - (500000 - upper_limit)
+        tax = round(balance/10)
+        if balance > 300000:
+          balance = balance - 300000
+          tax = round(tax+ 60000)
+          if balance > 0:
+            tax = round(tax + (balance * 30 / 100))
+        else:
+          tax = round(balance * 20 / 100 )
+      else:
+        tax = round(balance /10)
+    else:
+      tax = 0
+    
+    self.doc.tax_tot_income = tax
+    self.doc.edu_cess = round(tax*3/100)
+    
+  #-----------------------------------------------     
+  def calc_tax_pm(self):
+       
+    ret_income_tax = 0
+    ret_income_tax = sql("select sum(d.d_amount) from `tabSS Deduction Detail` d , `tabSalary Slip` s where s.docstatus = 1 and s.fiscal_year = '%s' and s.employee='%s' and d.parent = s.name and d.d_type = 'Income Tax'" %(self.doc.fiscal_year,self.doc.employee))
+    
+    new_tot_income = cint(self.doc.tax_tot_income) + cint(self.doc.edu_cess) - (cint(ret_income_tax[0][0]) or 0)
+    
+    self.doc.tax_per_month = new_tot_income/cint(self.doc.rem_months)
+
+  # on update
+  def on_update(self):
+    obj = get_obj('Feed Control', 'Feed Control')
+   
+    obj.make_feed(self.doc)
\ No newline at end of file
diff --git a/payroll/doctype/it_checklist/it_checklist.txt b/payroll/doctype/it_checklist/it_checklist.txt
new file mode 100644
index 0000000..16d0431
--- /dev/null
+++ b/payroll/doctype/it_checklist/it_checklist.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 456, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'IT Checklist', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00735', 'parent': 'IT Checklist', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:44', 'modified': '2010-09-08 17:17:29', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00825', 'parent': 'IT Checklist', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:02:04', 'modified': '2010-09-08 17:17:29', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00826', 'parent': 'IT Checklist', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:02:04', 'modified': '2010-09-08 17:17:29', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01010', 'parent': 'IT Checklist', 'read': 1, 'create': None, 'creation': '2010-05-25 10:47:36', 'modified': '2010-09-08 17:17:29', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01011', 'parent': 'IT Checklist', 'read': 1, 'create': None, 'creation': '2010-05-25 10:47:36', 'modified': '2010-09-08 17:17:29', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01012', 'parent': 'IT Checklist', 'read': 1, 'create': None, 'creation': '2010-05-25 10:47:36', 'modified': '2010-09-08 17:17:29', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04848', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04389', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04390', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'is_cheklist_active', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Is IT Cheklist Active?', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04391', 'idx': 4, 'default': 'Yes', 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'is_cheklist_active', 'fieldtype': 'Select', 'options': 'Yes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Employee Information', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04392', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04393', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'employee', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Employee', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04394', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'employee', 'fieldtype': 'Link', 'options': 'Employee', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-25 10:45:58', 'doctype': 'DocField', 'oldfieldname': 'employee_name', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Employee Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05039', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'employee_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'hra_count', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'saumil@webnotestech.com', 'label': 'HRA Count', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04395', 'idx': 9, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'hra_count', 'fieldtype': 'Currency', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'metro', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Is location a metro city?', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04396', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'metro', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'sr_citizen', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Is senior citizen?', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04397', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'sr_citizen', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'part_sr_citizen', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Parents are sr. citizen?', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04398', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'part_sr_citizen', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'basic', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Annual Basic', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04399', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'basic', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'gross_income', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Annual Gross Income', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'sum of earning terms', 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04400', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'gross_income', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Done', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Please fill up all data then press "Done"', 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04401', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04402', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'rent_acc', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Having rented accomodation?', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04403', 'idx': 17, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'rent_acc', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'ann_rent', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Enter annual rent paid', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04404', 'idx': 18, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'ann_rent', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'per_dep_dis', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Dependents Disability %', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Disability % of the Handicapped Dependents', 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04405', 'idx': 19, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'per_dep_dis', 'fieldtype': 'Select', 'options': '\nLess than 80% disability\nMore than 80% disability', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'per_self_dis', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Self disability %', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04406', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'per_self_dis', 'fieldtype': 'Select', 'options': '\nLess than 80% disability\nMore than 80% disability', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'pf', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Annual PF', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04407', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'pf', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Exemptions', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04408', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Exemptions1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04409', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<b>Exemptions under section 10 & 17</b>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'exe_declaration_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Exemption Detail', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04410', 'idx': 24, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'exe_declaration_details', 'fieldtype': 'Table', 'options': 'Declaration Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Other Income', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04411', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'oth_inc_decl_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Other Income Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04412', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'oth_inc_decl_details', 'fieldtype': 'Table', 'options': 'Other Income Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Chapter VI A', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04413', 'idx': 27, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'deduction chap via', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04414', 'idx': 28, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<b>Deduction under Chapter VI A</b>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'chap_via_decl_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Chap VI A Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04415', 'idx': 29, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'chap_via_decl_details', 'fieldtype': 'Table', 'options': 'Chapter VI A Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '80 C', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04416', 'idx': 30, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'investment 80 C', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04417', 'idx': 31, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<b>Investment under Section 80 C & 80CCC qualifying for deduction upto RS. 1 Lac</b>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'invest_80_decl_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Invest 80 Decl Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04418', 'idx': 32, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'invest_80_decl_details', 'fieldtype': 'Table', 'options': 'Invest 80 Declaration Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Total Taxable Income', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04419', 'idx': 33, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Section Break', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Calculate', 'width': None, 'trigger': 'Server', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04420', 'idx': 34, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'calculate_tax', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'net_tot_tax_income', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Net Total Taxable Income', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04421', 'idx': 35, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'net_tot_tax_income', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'tax_tot_income', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Tax on Total Income', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04422', 'idx': 36, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'tax_tot_income', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'edu_cess', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Education Cess', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04423', 'idx': 37, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'edu_cess', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'applicable_from', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Applicable from ', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04424', 'idx': 38, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'applicable_from', 'fieldtype': 'Select', 'options': '\nJanuary\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'rem_months', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Remaining month in year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04425', 'idx': 39, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'rem_months', 'fieldtype': 'Select', 'options': '\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Calculate Tax', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04426', 'idx': 40, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Calculate Monthly Tax ', 'width': '', 'trigger': 'Server', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04427', 'idx': 41, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'calc_tax_pm', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'tax_per_month', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Tax per Month', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'IT Checklist', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04428', 'idx': 42, 'default': None, 'colour': None, 'modified': '2010-09-08 17:17:29', 'parenttype': 'DocType', 'fieldname': 'tax_per_month', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/kra_sheet/__init__.py b/payroll/doctype/kra_sheet/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/kra_sheet/__init__.py
diff --git a/payroll/doctype/kra_sheet/kra_sheet.txt b/payroll/doctype/kra_sheet/kra_sheet.txt
new file mode 100644
index 0000000..2de715f
--- /dev/null
+++ b/payroll/doctype/kra_sheet/kra_sheet.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-25 16:43:38', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'KSHEET.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'KRA Sheet', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-25 16:43:38', 'doctype': 'DocField', 'oldfieldname': 'kra', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'KRA', 'width': '200px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Key Performance Area', 'parent': 'KRA Sheet', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06027', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-01 14:13:04', 'parenttype': 'DocType', 'fieldname': 'kra', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-08-25 16:43:38', 'doctype': 'DocField', 'oldfieldname': 'per_weightage', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Weightage (%)', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'KRA Sheet', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06029', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 14:13:04', 'parenttype': 'DocType', 'fieldname': 'per_weightage', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/kra_template/__init__.py b/payroll/doctype/kra_template/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/kra_template/__init__.py
diff --git a/payroll/doctype/kra_template/kra_template.js b/payroll/doctype/kra_template/kra_template.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/kra_template/kra_template.js
diff --git a/payroll/doctype/kra_template/kra_template.txt b/payroll/doctype/kra_template/kra_template.txt
new file mode 100644
index 0000000..e851462
--- /dev/null
+++ b/payroll/doctype/kra_template/kra_template.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-25 16:41:33', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:kra_title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'KRA Template', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01143', 'parent': 'KRA Template', 'read': 1, 'create': 1, 'creation': '2010-08-25 16:41:33', 'modified': '2010-09-20 09:45:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01167', 'parent': 'KRA Template', 'read': 1, 'create': 1, 'creation': '2010-09-07 16:44:19', 'modified': '2010-09-20 09:45:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'sneha@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01168', 'parent': 'KRA Template', 'read': 1, 'create': 1, 'creation': '2010-09-07 16:44:19', 'modified': '2010-09-20 09:45:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'sneha@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01169', 'parent': 'KRA Template', 'read': 1, 'create': 1, 'creation': '2010-09-07 16:44:19', 'modified': '2010-09-20 09:45:51', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'sneha@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-25 16:41:33', 'doctype': 'DocField', 'oldfieldname': 'kra_title', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'KRA Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'KRA Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06024', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:51', 'parenttype': 'DocType', 'fieldname': 'kra_title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-25 16:41:33', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'KRA Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06025', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:51', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-08-25 16:41:33', 'doctype': 'DocField', 'oldfieldname': 'kra_sheet', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'KRA Sheet', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'KRA Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06026', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:51', 'parenttype': 'DocType', 'fieldname': 'kra_sheet', 'fieldtype': 'Table', 'options': 'KRA Sheet', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/leave_allocation/__init__.py b/payroll/doctype/leave_allocation/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_allocation/__init__.py
diff --git a/payroll/doctype/leave_allocation/leave_allocation.comp.js b/payroll/doctype/leave_allocation/leave_allocation.comp.js
new file mode 100755
index 0000000..22b5041
--- /dev/null
+++ b/payroll/doctype/leave_allocation/leave_allocation.comp.js
@@ -0,0 +1,11 @@
+
+cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
+cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
+cur_frm.cscript.leave_type=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
+cur_frm.cscript.fiscal_year=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
+cur_frm.cscript.carry_forward=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
+cur_frm.cscript.carry_forwarded_leaves=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
+cur_frm.cscript.new_leaves_allocated=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
+calculate_total_leaves_allocated=function(doc,dt,dn){if(cint(doc.carry_forward)==1&&doc.leave_type&&doc.fiscal_year&&doc.employee){var callback=function(){refresh_field('carry_forward');}
+get_server_fields('get_carry_forwarded_leaves','','',doc,dt,dn,1,callback);}
+else if(cint(doc.carry_forward)==0){set_multiple(dt,dn,{carry_forwarded_leaves:0,total_leaves_allocated:flt(doc.new_leaves_allocated)});}}
\ No newline at end of file
diff --git a/payroll/doctype/leave_allocation/leave_allocation.js b/payroll/doctype/leave_allocation/leave_allocation.js
new file mode 100755
index 0000000..9b82cf9
--- /dev/null
+++ b/payroll/doctype/leave_allocation/leave_allocation.js
@@ -0,0 +1,64 @@
+// ****************************************** onload ********************************************************
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+}
+
+
+// ************************************** client triggers ***************************************************
+// ---------
+// employee
+// ---------
+cur_frm.add_fetch('employee','employee_name','employee_name');
+
+cur_frm.cscript.employee = function(doc, dt, dn) {
+  calculate_total_leaves_allocated(doc, dt, dn);
+}
+
+// -----------
+// leave type
+// -----------
+cur_frm.cscript.leave_type = function(doc, dt, dn) {
+  calculate_total_leaves_allocated(doc, dt, dn);
+}
+
+// ------------
+// fiscal year
+// ------------
+cur_frm.cscript.fiscal_year = function(doc, dt, dn) {
+  calculate_total_leaves_allocated(doc, dt, dn);
+}
+
+// -------------------------------
+// include previous leave balance
+// -------------------------------
+cur_frm.cscript.carry_forward = function(doc, dt, dn) {
+  calculate_total_leaves_allocated(doc, dt, dn);
+}
+
+// -----------------------
+// previous balance leaves
+// -----------------------
+cur_frm.cscript.carry_forwarded_leaves = function(doc, dt, dn) {
+  set_multiple(dt,dn,{total_leaves_allocated : flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});
+}
+
+// ---------------------
+// new leaves allocated
+// ---------------------
+cur_frm.cscript.new_leaves_allocated = function(doc, dt, dn) {
+  set_multiple(dt,dn,{total_leaves_allocated : flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});
+}
+
+
+// ****************************************** utilities ******************************************************
+// ---------------------------------
+// calculate total leaves allocated
+// ---------------------------------
+calculate_total_leaves_allocated = function(doc, dt, dn) {
+  if(cint(doc.carry_forward) == 1 && doc.leave_type && doc.fiscal_year && doc.employee){
+    get_server_fields('get_carry_forwarded_leaves','','', doc, dt, dn, 1);
+	}
+  else if(cint(doc.carry_forward) == 0){
+    set_multiple(dt,dn,{carry_forwarded_leaves : 0,total_leaves_allocated : flt(doc.new_leaves_allocated)});
+  }
+}
diff --git a/payroll/doctype/leave_allocation/leave_allocation.py b/payroll/doctype/leave_allocation/leave_allocation.py
new file mode 100755
index 0000000..e11a335
--- /dev/null
+++ b/payroll/doctype/leave_allocation/leave_allocation.py
@@ -0,0 +1,121 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+import datetime
+	
+# -----------------------------------------------------------------------------------------
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+
+
+# ************************************************ utilities *************************************************
+  # --------------
+  # get leave bal
+  # --------------
+  def get_leave_bal(self, prev_fyear):
+    # leaves allocates
+    tot_leaves_all = sql("select SUM(total_leaves_allocated) from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1 and name != '%s'" % (self.doc.employee, self.doc.leave_type, prev_fyear, self.doc.name))
+    tot_leaves_all = tot_leaves_all and flt(tot_leaves_all[0][0]) or 0
+
+    # leaves applied
+    tot_leaves_app = sql("select SUM(total_leave_days) from `tabLeave Application` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, prev_fyear))
+    tot_leaves_app = tot_leaves_app and flt(tot_leaves_app[0][0]) or 0
+
+    return tot_leaves_all - tot_leaves_app
+
+ 
+# ******************************************** client triggers ***********************************************
+
+  # ------------------------------------------------------------------
+  # check whether carry forward is allowed or not for this leave type
+  # ------------------------------------------------------------------
+  def allow_carry_forward(self):
+    cf = sql("select is_carry_forward from `tabLeave Type` where name = %s" , self.doc.leave_type)
+    cf = cf and cint(cf[0][0]) or 0
+    if not cf:
+      set(self.doc,'carry_forward',0)
+      msgprint("Sorry ! You cannot carry forward %s" % (self.doc.leave_type))
+      raise Exception
+
+  # ---------------------------
+  # get carry forwarded leaves
+  # ---------------------------
+  def get_carry_forwarded_leaves(self):
+    if self.doc.carry_forward: self.allow_carry_forward()
+    prev_fiscal_year = sql("select name from `tabFiscal Year` where name < '%s' order by name desc limit 1" % (self.doc.fiscal_year))
+    prev_fiscal_year = prev_fiscal_year and prev_fiscal_year[0][0] or ''
+    ret = {}
+    prev_bal = 0
+    if prev_fiscal_year and cint(self.doc.carry_forward) == 1:
+      prev_bal = self.get_leave_bal(prev_fiscal_year)
+    ret = {
+      'carry_forwarded_leaves'  :  prev_bal,
+      'total_leaves_allocated'   :  flt(prev_bal) + flt(self.doc.new_leaves_allocated)
+    }
+    return str(ret)
+
+
+# ********************************************** validate *****************************************************
+
+  # ---------------------------
+  # get total allocated leaves
+  # ---------------------------
+  def get_total_allocated_leaves(self):
+    leave_det = eval(self.get_carry_forwarded_leaves())
+    set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
+    set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
+
+  # ------------------------------------------------------------------------------------
+  # validate leave (i.e. check whether leave for same type is already allocated or not)
+  # ------------------------------------------------------------------------------------
+  def validate_allocated_leave(self):
+    l = sql("select name from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year)) 
+    l = l and l[0][0] or ''
+    if l:
+      msgprint("%s is allocated to Employee: %s for Fiscal Year : %s. Please refer Leave Allocation : %s" % (self.doc.leave_type, self.doc.employee, self.doc.fiscal_year, l))
+      raise Exception
+
+  # ---------
+  # validate
+  # ---------
+  def validate(self):
+    self.validate_allocated_leave()
+
+  # ----------
+  # on update
+  # ----------
+  def on_update(self):
+    self.get_total_allocated_leaves()
+
+
+# ********************************************** cancel ********************************************************
+
+  # -------------------------
+  # check for applied leaves
+  # -------------------------
+  def check_for_leave_application(self):
+    chk = sql("select name from `tabLeave Application` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
+    chk = chk and chk[0][0] or ''
+    if chk:
+      msgprint("Cannot cancel this Leave Allocation as Employee : %s has already applied for %s. Please check Leave Application : %s" % (self.doc.employee, self.doc.leave_type, chk))
+      raise Exception
+
+  # -------
+  # cancel
+  # -------
+  def on_cancel(self):
+    self.check_for_leave_application()
diff --git a/payroll/doctype/leave_allocation/leave_allocation.txt b/payroll/doctype/leave_allocation/leave_allocation.txt
new file mode 100644
index 0000000..ad7d0e6
--- /dev/null
+++ b/payroll/doctype/leave_allocation/leave_allocation.txt
@@ -0,0 +1,637 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'LAL/.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 10:01:22',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Leave Allocation',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'employee,employee_name,leave_type,total_leaves_allocated,fiscal_year',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 1565
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-21 10:01:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': 'owner',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00731',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 10:01:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': 'owner',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00732',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'HR User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-21 10:01:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00733',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-02-21 10:01:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00734',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-15 11:25:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'column_break1',
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04659',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 10:01:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Employee',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04152',
+		'no_copy': None,
+		'oldfieldname': 'employee',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-17 13:33:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Employee Name',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04767',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 10:01:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Leave Type',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04153',
+		'no_copy': None,
+		'oldfieldname': 'leave_type',
+		'oldfieldtype': 'Link',
+		'options': '\nCasual Leave\nCompensatory Off\nLeave Without Pay\nPaternity Leave\nPrivilege Leave\nSick Leave',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 10:01:22',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Posting Date',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04154',
+		'no_copy': 1,
+		'oldfieldname': 'date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 10:01:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04155',
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Data',
+		'options': '\n2010-2011\n2011-2012\n2012-2013',
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': 0,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04156',
+		'no_copy': None,
+		'oldfieldname': 'reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-15 11:25:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'column_break7',
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04660',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'carry_forward',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Carry Forward',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04158',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'carry_forwarded_leaves',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Carry Forwarded Leaves',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04159',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'new_leaves_allocated',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'New Leaves Allocated',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04160',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_leaves_allocated',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Total Leaves Allocated',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04161',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04162',
+		'no_copy': None,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 10:01:23',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-02-17 13:47:13',
+		'modified_by': 'Administrator',
+		'name': 'FL04163',
+		'no_copy': None,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Allocation',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/leave_applicable_detail/__init__.py b/payroll/doctype/leave_applicable_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_applicable_detail/__init__.py
diff --git a/payroll/doctype/leave_applicable_detail/leave_applicable_detail.txt b/payroll/doctype/leave_applicable_detail/leave_applicable_detail.txt
new file mode 100644
index 0000000..7f50842
--- /dev/null
+++ b/payroll/doctype/leave_applicable_detail/leave_applicable_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:45', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Leave Applicable Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'select_record', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Select record', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Leave Applicable Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04429', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:16:03', 'parenttype': 'DocType', 'fieldname': 'select_record', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:45', 'doctype': 'DocField', 'oldfieldname': 'maxdays', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Days', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Leave Applicable Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04430', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:16:03', 'parenttype': 'DocType', 'fieldname': 'maxdays', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/leave_application/__init__.py b/payroll/doctype/leave_application/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_application/__init__.py
diff --git a/payroll/doctype/leave_application/leave_application.comp.js b/payroll/doctype/leave_application/leave_application.comp.js
new file mode 100755
index 0000000..53990c2
--- /dev/null
+++ b/payroll/doctype/leave_application/leave_application.comp.js
@@ -0,0 +1,14 @@
+
+cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
+cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
+cur_frm.cscript.fiscal_year=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
+cur_frm.cscript.leave_type=function(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);}}
+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);}
+cur_frm.cscript.to_date=function(doc,dt,dn){if(cint(doc.half_day)==1&&doc.from_date&&doc.from_date!=doc.to_date){msgprint("To Date should be same as From Date for Half Day leave");return;}
+if(cint(doc.half_day)==1){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);}
+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{get_server_fields('get_total_leave_days','','',doc,dt,dn,1);}}}
\ No newline at end of file
diff --git a/payroll/doctype/leave_application/leave_application.js b/payroll/doctype/leave_application/leave_application.js
new file mode 100755
index 0000000..ba00a31
--- /dev/null
+++ b/payroll/doctype/leave_application/leave_application.js
@@ -0,0 +1,88 @@
+// ****************************************** onload ********************************************************
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+}
+
+
+// ************************************** client triggers ***************************************************
+// ---------
+// employee
+// ---------
+cur_frm.add_fetch('employee','employee_name','employee_name');
+
+cur_frm.cscript.employee = function (doc, dt, dn){
+  get_leave_balance(doc, dt, dn);
+}
+
+// ------------
+// fiscal_year
+// ------------
+cur_frm.cscript.fiscal_year = function (doc, dt, dn){
+  get_leave_balance(doc, dt, dn);
+}
+
+// -----------
+// leave type
+// -----------
+cur_frm.cscript.leave_type = function (doc, dt, dn){
+  get_leave_balance(doc, dt, dn);
+}
+
+// ---------
+// half day
+// ---------
+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);
+  }
+}
+
+// ---------
+// from date
+// ---------
+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);
+}
+
+// --------
+// to date
+// --------
+cur_frm.cscript.to_date = function(doc, dt, dn) {
+  if(cint(doc.half_day) == 1 && doc.from_date && doc.from_date != doc.to_date){
+    msgprint("To Date should be same as From Date for Half Day leave");
+    return;
+  }
+  if(cint(doc.half_day) == 1){
+    set_multiple(dt,dn,{to_date:doc.from_date});
+  }
+  calculate_total_days(doc, dt, dn);
+}
+
+
+// ******************************************* utilities ****************************************************
+
+// ------------------
+// get leave balance
+// ------------------
+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);
+}
+
+// ---------------
+// calculate days
+// ---------------
+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);
+    }
+  }
+}
diff --git a/payroll/doctype/leave_application/leave_application.py b/payroll/doctype/leave_application/leave_application.py
new file mode 100755
index 0000000..5f69c63
--- /dev/null
+++ b/payroll/doctype/leave_application/leave_application.py
@@ -0,0 +1,124 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+import datetime
+	
+# -----------------------------------------------------------------------------------------
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist 
+
+
+# ******************************************** client triggers ***********************************************
+
+  # ------------------
+  # get leave balance
+  # ------------------
+  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 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 str(ret)
+
+
+# ************************************************ utilities *************************************************
+
+  # -------------------
+  # get total holidays
+  # -------------------
+  def get_holidays(self):
+    tot_hol = sql("select count(*) from `tabHoliday List Detail` h1, `tabHoliday List` h2, `tabEmployee` e1 where e1.name = '%s' and h1.parent = h2.name and e1.holiday_list = h2.name and h1.holiday_date between '%s' and '%s'"% (self.doc.employee, self.doc.from_date, self.doc.to_date))
+    if not tot_hol:
+      tot_hol = sql("select count(*) from `tabHoliday List Detail` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between '%s' and '%s' and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s"% (self.doc.from_date, self.doc.to_date, self.doc.fiscal_year))
+    return tot_hol and flt(tot_hol[0][0]) or 0
+
+
+  # ---------------------
+  # get total leave days
+  # ---------------------
+  def get_total_leave_days(self):
+    tot_days = date_diff(self.doc.to_date, self.doc.from_date) + 1
+    holidays = self.get_holidays()
+    ret = {'total_leave_days':flt(tot_days)-flt(holidays)}
+    return str(ret)
+
+
+# ************************************************ validate *************************************************
+
+  # -----------------
+  # validate to date
+  # -----------------
+  def validate_to_date(self):
+    if (getdate(self.doc.to_date) < getdate(self.doc.from_date)):
+      msgprint("To date cannot be before from date")
+      raise Exception
+
+  # --------------------------------
+  # check whether leave type is lwp
+  # --------------------------------
+  def is_lwp(self):
+    lwp = sql("select is_lwp from `tabLeave Type` where name = %s", self.doc.leave_type)
+    return lwp and cint(lwp[0][0]) or 0
+
+  # ------------------------
+  # validate balance leaves
+  # ------------------------
+  def validate_balance_leaves(self):
+    if not self.is_lwp():
+      bal = self.get_leave_balance()
+      tot_leaves = self.get_total_leave_days()
+      bal, tot_leaves = eval(bal), eval(tot_leaves)
+      set(self.doc,'leave_balance',flt(bal['leave_balance']))
+      set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days']))
+      if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']):
+        msgprint("Employee : %s cannot apply for %s of more than %s days" % (self.doc.employee, self.doc.leave_type, flt(bal['leave_balance'])))
+        raise Exception
+
+  #
+  # validate overlapping leaves
+  #
+  def validate_leave_overlap(self):
+    for d in sql("""select name, leave_type, posting_date, from_date, to_date 
+      from `tabLeave Application` 
+      where 
+      (from_date <= %(to_date)s and to_date >= %(from_date)s)
+      and employee = %(employee)s
+      and docstatus = 1 
+      and name != %(name)s""", self.doc.fields, as_dict = 1):
+ 
+      msgprint("Employee : %s has already applied for %s between %s and %s on %s. Please refer Leave Application : %s" % (self.doc.employee, cstr(d['leave_type']), formatdate(d['from_date']), formatdate(d['to_date']), formatdate(d['posting_date']), d['name']), raise_exception = 1)
+
+  # ---------------------------------------------------------------------
+  # validate max days for which leave can be applied for particular type
+  # ---------------------------------------------------------------------
+  def validate_max_days(self):
+    max_days = sql("select max_days_allowed from `tabLeave Type` where name = '%s'" %(self.doc.leave_type))
+    max_days = max_days and flt(max_days[0][0]) or 0
+    if max_days and self.doc.total_leave_days > max_days:
+      msgprint("Sorry ! You cannot apply for %s for more than %s days" % (self.doc.leave_type, max_days))
+      raise Exception
+
+
+  # ---------
+  # validate
+  # ---------
+  def validate(self):
+    self.validate_to_date()
+    self.validate_balance_leaves()
+    self.validate_leave_overlap()
+    self.validate_max_days()
diff --git a/payroll/doctype/leave_application/leave_application.txt b/payroll/doctype/leave_application/leave_application.txt
new file mode 100644
index 0000000..43158a9
--- /dev/null
+++ b/payroll/doctype/leave_application/leave_application.txt
@@ -0,0 +1,782 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'LAP/.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:54',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-17 13:44:37',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Leave Application',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'From %(employee_name)s, %(designation)s',
+		'tag_fields': 'leave_type',
+		'use_template': None,
+		'version': 18
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-21 09:23:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:55',
+		'modified_by': 'Administrator',
+		'name': 'PERM00809',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:55',
+		'modified_by': 'Administrator',
+		'name': 'PERM00810',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00799',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': None,
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00800',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': None,
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': '',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00801',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00802',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': '',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00803',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00804',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04650',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Employee',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04587',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Employee',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Employee Name',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04588',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Leave Type',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04589',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Leave Type',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_balance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Leave Balance',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04590',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:54',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'posting_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Posting Date',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04591',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04592',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04651',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'half_day',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Half Day',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04594',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'From Date',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04595',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'To Date',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04596',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_leave_days',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Total Leave Days',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04597',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04598',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04599',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04600',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Application',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/leave_control_panel/__init__.py b/payroll/doctype/leave_control_panel/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_control_panel/__init__.py
diff --git a/payroll/doctype/leave_control_panel/leave_control_panel.js b/payroll/doctype/leave_control_panel/leave_control_panel.js
new file mode 100644
index 0000000..2e1f695
--- /dev/null
+++ b/payroll/doctype/leave_control_panel/leave_control_panel.js
@@ -0,0 +1,28 @@
+cur_frm.cscript.onload = function(doc,dt,dn){
+  if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+  if(!doc.leave_transaction_type) set_multiple(dt,dn,{leave_transaction_type:'Allocation'});
+
+}
+
+
+// Validation For To Date
+// ================================================================================================
+cur_frm.cscript.to_date = function(doc, cdt, cdn) {
+  $c('runserverobj', args={'method':'to_date_validation','docs':compress_doclist([doc])},
+    function(r, rt) {
+    var doc = locals[cdt][cdn];
+    if (r.message) {
+      alert("To date cannot be before from date");
+      doc.to_date = '';
+      refresh_field('to_date');
+    }
+    }
+  ); 
+}
+
+// Allocation Type
+// ================================================================================================
+cur_frm.cscript.allocation_type = function (doc, cdt, cdn){
+  doc.no_of_days = '';
+  refresh_field('no_of_days');
+}
diff --git a/payroll/doctype/leave_control_panel/leave_control_panel.py b/payroll/doctype/leave_control_panel/leave_control_panel.py
new file mode 100644
index 0000000..164a062
--- /dev/null
+++ b/payroll/doctype/leave_control_panel/leave_control_panel.py
@@ -0,0 +1,73 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist   
+  
+  # Get Employees
+  # ********************************************************************** 
+  def get_employees(self):    
+    lst1 = [[self.doc.employee_type,"employment_type"],[self.doc.branch,"branch"],[self.doc.designation,"designation"],[self.doc.department, "department"],[self.doc.grade,"grade"]]
+    condition = "where "
+    flag = 0
+    for l in lst1:
+      if(l[0]):
+        if flag == 0:
+          condition += l[1] + "= '" + l[0] +"'"
+        else:
+          condition += " and " + l[1]+ "= '" +l[0] +"'"
+        flag = 1
+    emp_query = "select name from `tabEmployee` "
+    if flag == 1:
+      emp_query += condition 
+    e = sql(emp_query)
+    return e
+
+  # ----------------
+  # validate values
+  # ----------------
+  def validate_values(self):
+    val_dict = {self.doc.fiscal_year:'Fiscal Year', self.doc.leave_type:'Leave Type', self.doc.no_of_days:'New Leaves Allocated'}
+    for d in val_dict:
+      if not d:
+        msgprint("Please enter : "+val_dict[d])
+        raise Exception
+
+
+  # Allocation
+  # ********************************************************************** 
+  def allocate_leave(self):
+    self.validate_values()
+    for d in self.get_employees():
+      la = Document('Leave Allocation')
+      la.employee = cstr(d[0])
+      la.employee_name = get_value('Employee',cstr(d[0]),'employee_name')
+      la.leave_type = self.doc.leave_type
+      la.fiscal_year = self.doc.fiscal_year
+      la.posting_date = nowdate()
+      la.carry_forward = cint(self.doc.carry_forward)
+      la.new_leaves_allocated = flt(self.doc.no_of_days)
+      la_obj = get_obj(doc=la)
+      la_obj.doc.docstatus = 1
+      la_obj.validate()
+      la_obj.on_update()
+      la_obj.doc.save(1)
+    msgprint("Leaves Allocated Successfully")
diff --git a/payroll/doctype/leave_control_panel/leave_control_panel.txt b/payroll/doctype/leave_control_panel/leave_control_panel.txt
new file mode 100644
index 0000000..9d01e88
--- /dev/null
+++ b/payroll/doctype/leave_control_panel/leave_control_panel.txt
@@ -0,0 +1,613 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': 0,
+		'hide_toolbar': 0,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Leave Control Panel',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 161
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'PERM00320',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'PERM00321',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'PERM00322',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'PERM00323',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'PERM00324',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'PERM00325',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-06 17:45:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'col_brk4',
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL03972',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': 'Leave blank if considered for all employee types',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Employee Type',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01835',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Employment Type',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': 'Leave blank if considered for all branches',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'branch',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Branch',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01836',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Branch',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': 'Leave blank if considered for all departments',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Department',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01837',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Department',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': 'Leave blank if considered for all designations',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Designation',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01838',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Designation',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': 'Leave blank if considered for all grades',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grade',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Grade',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01839',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Grade',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-10-06 17:45:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'col_brk1',
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL03973',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01841',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Leave Type',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01843',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Leave Type',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-12 14:41:36',
+		'default': None,
+		'depends_on': None,
+		'description': "Please select Carry Forward if you also want to include previous fiscal year's balance leaves to this fiscal year",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'carry_forward',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Carry Forward',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL04509',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'no_of_days',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'New Leaves Allocated (In Days)',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01848',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Allocate',
+		'modified': '2011-02-12 15:42:00',
+		'modified_by': 'Administrator',
+		'name': 'FL01849',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'allocate_leave',
+		'owner': 'Administrator',
+		'parent': 'Leave Control Panel',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Server',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/leave_detail/__init__.py b/payroll/doctype/leave_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_detail/__init__.py
diff --git a/payroll/doctype/leave_detail/leave_detail.txt b/payroll/doctype/leave_detail/leave_detail.txt
new file mode 100644
index 0000000..a773182
--- /dev/null
+++ b/payroll/doctype/leave_detail/leave_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:46', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Leave Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00738', 'parent': 'Leave Detail', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:46', 'modified': '2010-04-01 15:16:45', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'leave_type', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Leave Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Leave Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04449', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:16:45', 'parenttype': 'DocType', 'fieldname': 'leave_type', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'balance', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Balance', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Leave Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04450', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:16:45', 'parenttype': 'DocType', 'fieldname': 'balance', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/leave_type/__init__.py b/payroll/doctype/leave_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_type/__init__.py
diff --git a/payroll/doctype/leave_type/leave_type.js b/payroll/doctype/leave_type/leave_type.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_type/leave_type.js
diff --git a/payroll/doctype/leave_type/leave_type.txt b/payroll/doctype/leave_type/leave_type.txt
new file mode 100644
index 0000000..d108330
--- /dev/null
+++ b/payroll/doctype/leave_type/leave_type.txt
@@ -0,0 +1,334 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:leave_type_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:08',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Leave Type',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 23
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'PERM00333',
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'PERM00334',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Leave Type',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:08',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'PERM00335',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Leave Type',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'FL01875',
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_type_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Leave Type Name',
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'FL01876',
+		'no_copy': None,
+		'oldfieldname': 'leave_type_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'max_days_allowed',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Max Days Leave Allowed',
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'FL01877',
+		'no_copy': None,
+		'oldfieldname': 'max_days_allowed',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_carry_forward',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Is Carry Forward',
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'FL01878',
+		'no_copy': None,
+		'oldfieldname': 'is_carry_forward',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_encash',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Is Encash',
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'FL01879',
+		'no_copy': None,
+		'oldfieldname': 'is_encash',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-10 17:05:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_lwp',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Is LWP',
+		'modified': '2011-02-10 17:05:15',
+		'modified_by': 'Administrator',
+		'name': 'FL04474',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Leave Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/leave_type_detail/__init__.py b/payroll/doctype/leave_type_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/leave_type_detail/__init__.py
diff --git a/payroll/doctype/leave_type_detail/leave_type_detail.txt b/payroll/doctype/leave_type_detail/leave_type_detail.txt
new file mode 100644
index 0000000..c8dbefa
--- /dev/null
+++ b/payroll/doctype/leave_type_detail/leave_type_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:46', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Leave Type Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'days', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Days', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Leave Type Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04477', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:17:46', 'parenttype': 'DocType', 'fieldname': 'days', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'year', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Leave Type Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04478', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:17:46', 'parenttype': 'DocType', 'fieldname': 'year', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/other_income_detail/__init__.py b/payroll/doctype/other_income_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/other_income_detail/__init__.py
diff --git a/payroll/doctype/other_income_detail/other_income_detail.txt b/payroll/doctype/other_income_detail/other_income_detail.txt
new file mode 100644
index 0000000..9e25d69
--- /dev/null
+++ b/payroll/doctype/other_income_detail/other_income_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:46', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Other Income Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00742', 'parent': 'Other Income Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:46', 'modified': '2010-04-01 15:18:08', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00743', 'parent': 'Other Income Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:46', 'modified': '2010-04-01 15:18:08', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'particulars2', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Particulars', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Other Income Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04479', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:18:08', 'parenttype': 'DocType', 'fieldname': 'particulars2', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'under_section2', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Under Section', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Other Income Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04480', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:18:08', 'parenttype': 'DocType', 'fieldname': 'under_section2', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'max_limit2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Max. Limit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Other Income Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04481', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:18:08', 'parenttype': 'DocType', 'fieldname': 'max_limit2', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'actual_amount2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Actual Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Income Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04482', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-01 15:18:08', 'parenttype': 'DocType', 'fieldname': 'actual_amount2', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'eligible_amount2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Eligible Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Other Income Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04483', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-01 15:18:08', 'parenttype': 'DocType', 'fieldname': 'eligible_amount2', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'modified_amount2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Modified Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Income Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04484', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-01 15:18:08', 'parenttype': 'DocType', 'fieldname': 'modified_amount2', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/payroll_rule/__init__.py b/payroll/doctype/payroll_rule/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/payroll_rule/__init__.py
diff --git a/payroll/doctype/payroll_rule/payroll_rule.js b/payroll/doctype/payroll_rule/payroll_rule.js
new file mode 100644
index 0000000..9984ce4
--- /dev/null
+++ b/payroll/doctype/payroll_rule/payroll_rule.js
@@ -0,0 +1,95 @@
+//omload function to set values in select field
+cur_frm.cscript.onload = function(doc, cdt, cdn){
+  var mydoc = doc
+  doc.select_master = 'Salary Structure';
+  refresh_field('select_master');
+
+  var call_back_master2 = function(mydoc){
+    $c('runserverobj', args={'method':'get_masters', 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+    function(r, rt) {
+    var doc = locals[mydoc.doctype][mydoc.name];
+     get_field(doc.doctype, 'select_master2' , doc.name).options = r.message;
+     refresh_field('select_master2');
+   
+    }
+  );
+  }
+  $c('runserverobj', args={'method':'maindoc_field', 'arg':doc.select_master,'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+    function(r, rt) {
+     var doc = locals[mydoc.doctype][mydoc.name];
+     get_field(doc.doctype, 'select_field' , doc.name).options = r.message;
+     refresh_field('select_field');
+     call_back_master2(mydoc);
+    }
+  );
+}
+
+//select_master2 onchanged event function: it will add values to select_field2 based on select_master2 field 
+cur_frm.cscript.select_master2 = function(doc, cdt, cdn){
+  var mydoc = doc
+  doc.select_field2 ='';
+  refresh_field('select_field2');
+  doc.select_value='';
+  refresh_field('select_value');
+  $c('runserverobj', args={'method':'maindoc_field', 'arg':doc.select_master2, 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+    function(r, rt) {
+     var doc = locals[mydoc.doctype][mydoc.name];
+     get_field(doc.doctype, 'select_field2' , doc.name).options = r.message;
+     refresh_field('select_field2');
+     get_field(doc.doctype, 'select_value' , doc.name).options = '';
+     refresh_field('select_value'); 
+        
+    }
+  );
+}
+
+//select_field2 onchanged event function: used to add records values of selected master & their field_name
+cur_frm.cscript.select_field2 = function(doc, cdt, cdn){
+  var mydoc = doc
+  doc.select_value='';
+  refresh_field('select_value');
+  $c('runserverobj', args={'method':'get_values','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+    function(r, rt) {
+     var doc = locals[mydoc.doctype][mydoc.name];
+     get_field(doc.doctype, 'select_value' , doc.name).options = r.message;
+     refresh_field('select_value');
+     
+    }
+  );
+}
+
+//transaction onchanged event function: used to add transaction terms to transaction term field
+cur_frm.cscript.transaction = function(doc, cdt, cdn){
+  var mydoc = doc
+  doc.transaction_term='';
+  refresh_field('transaction_term');
+  if(doc.transaction){
+    $c('runserverobj', args={'method':'add_transaction_terms','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+      function(r, rt) {
+       var doc = locals[mydoc.doctype][mydoc.name];
+       get_field(doc.doctype, 'transaction_term' , doc.name).options = r.message;
+       refresh_field('transaction_term');
+     }
+    );
+  }
+}
+
+
+//right operand of condition :hide or unhide 
+cur_frm.cscript.right_operand = function(doc, cdt, cdn){
+  doc.select_master2 = "";
+  doc.select_field2 = "";
+  doc.select_value = "";
+  if(doc.right_operand =='Automatic'){
+    unhide_field('select_master2');
+    unhide_field('select_field2');
+    unhide_field('select_value');
+  }
+  else {
+   hide_field('select_master2');
+   hide_field('select_field2');
+   hide_field('select_value');
+  
+  }
+}
+
diff --git a/payroll/doctype/payroll_rule/payroll_rule.py b/payroll/doctype/payroll_rule/payroll_rule.py
new file mode 100644
index 0000000..67cbd52
--- /dev/null
+++ b/payroll/doctype/payroll_rule/payroll_rule.py
@@ -0,0 +1,311 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc, self.doclist = doc, doclist  
+  
+  #----------------------------------------------------
+  # list of master whose module is payroll & isnot table
+  def get_masters(self):
+    master1 = sql("select name from `tabDocType` where module = 'Payroll' and (istable = 0 or istable is null)")
+    ret =''
+    if master1:
+      for i in master1:
+        ret += "\n" + i[0]
+    return ret
+    
+
+  #---------------------------------------------------- 
+  #list of all fields for which conditions can be set
+  def maindoc_field(self, select_form):
+    field_list=[]
+    
+    
+    field_info = sql("select label,fieldtype,options,fieldname from `tabDocField` where parent='%s' and fieldtype not in('Section Break','Column Break','Text','Small Text','Text Editor', 'Time', 'Check', 'Button','Code','HTML','Image','Blob','Password')"%select_form)
+    
+    for f in field_info:
+      sl=[]
+      for x in f:
+        sl.append(x)
+      field_list.append(sl)
+    ret = ''
+    
+    #=====================================================  
+    
+    for fi in field_list:
+      if fi[1] !='Select' or fi[1] !='Link' or fi[1] !='Table':
+        ret += "\n" + cstr(select_form) + ':' + fi[0]
+      elif fi[1] =='Select':
+        op = fi[2].split(':')
+        if op[0] != 'link':
+          ret += "\n" + cstr(select_form) + ':' +fi[0]
+        #========  
+        # linked doctype field list
+    
+    #=====================================================  
+    
+    for fi in field_list:    
+      if fi[1] == 'Link':
+        flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Int', 'Select','Currency','Float','Link')"%fi[2])
+        for f in flist:
+          ret += "\n" + fi[0] + ':' +f[0]
+      elif fi[1] == 'Select':
+        op = fi[2].split(':')
+        if op[0] == 'link':
+          flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%op[1])
+          for f in flist:
+            ret += "\n" + fi[0] + ':' +f[0]
+
+    return ret
+
+
+  #----------------------------------------------------  
+  # function for finding fieldname,datatype of mentioned label
+  def field_info(self,label,parent):
+    field_name=sql("select fieldname from tabDocField where parent='%s' and label='%s'" %(parent,label))[0][0]
+    if field_name: 
+      datatype=sql("select fieldtype from `tabDocField` where fieldname='%s' and parent='%s'" %(field_name,parent))[0][0]
+      ret={'fieldnm':field_name,'datatype':datatype}
+    
+    return ret
+  
+  #----------------------------------------------------
+  def compare_string(self,first,second,op):
+
+    if op=='Equals':
+      if first.lower()==second.lower():
+        return 'true'
+      else:
+        return 'false'
+    elif op=='Not Equals':
+      if first.lower()!=second.lower():
+        return 'true'
+      else:
+        return 'false'
+    elif op=='Greater than':
+      if first.lower()>second.lower():
+        return 'true'
+      else:
+        return 'false'
+    elif op=='Greater than or Equals':
+      if first.lower()>=second.lower():
+        return 'true'
+      else:
+        return 'false'
+    elif op=='Less than':
+      if first.lower()<second.lower():
+        return 'true'
+      else:
+        return 'false'
+    elif op=='Less than or Equals':
+      if first.lower()<=second.lower():
+        return 'true'
+      else:
+        return 'false'
+ 
+  
+  #----------------------------------------------------
+  #evalute operator
+  def eval_operator(self,op):
+    op_sign =''
+    if op=='Equals':
+      op_sign='=='
+    elif op=='Not Equals':
+      op_sign='!='
+    elif op=='Greater than':
+      op_sign='>'
+    elif op=='Greater than or Equals':
+      op_sign='>='
+    elif op=='Less than':
+      op_sign='<'
+    elif op=='Less than or Equals':
+      op_sign='<='
+    
+    return op_sign
+  
+  #----------------------------------------------------  
+  #evaluation condition
+  def eval_condition(self,field_dict,form_val,value,operator):
+    if field_dict['datatype']=='Data' or field_dict['datatype']=='Select' or field_dict['datatype'] =='Link':
+      
+      if self.compare_string(cstr(form_val),cstr(value),operator)=='false':
+        cond_hold='No'
+      else:
+        cond_hold='Yes'
+    else:
+      op_sign = self.eval_operator(operator)  
+      chk_cond=str(form_val) + str(op_sign) + str(value)
+      errprint(chk_cond)
+      if eval(chk_cond):
+        cond_hold='Yes'
+      else:
+        cond_hold='No'
+   
+    return cond_hold
+  
+  #----------------------------------------------------
+  # fetching the value from the form
+  def find_value(self,fld_nm,tab_nm,rec_nm,child=0):
+    if child == 0:
+      form_val=sql("select %s from `tab%s` where name='%s'"%(fld_nm,tab_nm,rec_nm))
+    
+    elif child == 1:
+      form_val=sql("select %s from `tab%s` where parent='%s'"%(fld_nm,tab_nm,rec_nm))
+    
+    return form_val and form_val[0][0]
+  
+  #----------------------------------------------------
+  # checking with main doctype  
+  def chk_from_main_dt(self,master,label1,value,operator,form_obj):
+    cond_hold = ''
+    field_dict = self.field_info(label1,master) #getting fieldname info
+    form_val=self.find_value(field_dict['fieldnm'],master,form_obj.doc.name) # find value
+   
+    if form_val :
+      cond_hold = self.eval_condition(field_dict,form_val,value,operator)
+    elif not form_val and field_dict['datatype'] =='Currency' or field_dict['datatype'] =='Float' or field_dict['datatype'] =='Int':
+      
+      form_val = 0.0
+      cond_hold = self.eval_condition(field_dict,form_val,value,operator)
+    return cond_hold
+
+  #----------------------------------------------------  
+  #checking with child doctype
+  def chk_from_child_dt(self,first_label,second_label,value,operator,form_obj):
+    cond_hold = ''
+    field_dict = self.field_info(second_label,first_label)
+    form_val=self.find_value(field_dict['fieldnm'],first_label,form_obj.doc.name,1) #fetching the value in current form from a table
+    if form_val or form_val==0:
+      cond_hold = self.eval_condition(field_dict,form_val,value,operator)
+    
+    return cond_hold
+
+  #----------------------------------------------------
+  # if checking is with any linked doctype means first_label field from the doctype for which rule is given and second_label field from the doctype with which first_label is linked  
+  
+  def chk_from_link_dt(self,master,first_label,second_label,form_obj,value,operator):
+    cond_hold=''
+    field_list=[]
+    field_dict_first = self.field_info(first_label,master)
+    field_info = sql("select label,fieldtype,options,fieldname from `tabDocField` where parent='%s' and fieldtype not in('Section Break','Column Break','Text','Small Text','Text Editor', 'Time', 'Check', 'Button','Code','HTML','Image','Blob','Password')"%master)
+    for f in field_info:
+      sl=[]
+      for x in f:
+        sl.append(x)
+      field_list.append(sl)
+    for x in field_list:
+      if x[3] == field_dict_first['fieldnm']:
+        linked_to = x[2]
+    
+    lt = linked_to.split(':')
+    
+    #=================================================
+    if lt[0] == 'link':
+      field_dict_second = self.field_info(second_label,lt[1])
+      link_val=sql("select %s from `tab%s` where name='%s'"%(field_dict_first['fieldnm'],master,form_obj.doc.name))
+      if link_val and link_val[0][0]:
+        form_val = self.find_value(field_dict_second['fieldnm'],lt[1],link_val[0][0])
+        if form_val :
+          cond_hold = self.eval_condition(field_dict_second,form_val,value,operator)
+      
+    else:
+      field_dict_second = self.field_info(second_label,lt[0])
+      link_val=sql("select %s from `tab%s` where name='%s'"%(field_dict_first['fieldnm'],master,form_obj.doc.name))
+      if link_val and link_val[0][0]:
+        form_val = self.find_value(field_dict_second['fieldnm'],lt[0],link_val[0][0])
+        if form_val :
+          cond_hold = self.eval_condition(field_dict_second,form_val,value,operator)
+    
+    return cond_hold
+
+  #----------------------------------------------------
+  def evalute_rule(self,form_obj):
+    
+    all_cond_hold='Yes'
+    for d in getlist(self.doclist,'condition_details'):
+      master = d.rule_master
+      label = d.rule_field.split(':')  #break up checking condition
+      
+      #findout the value with which condition will be checked
+      if d.value:
+        chk_with_value = d.value
+        
+      
+      # label[0] is doctype name for which rule is given, label[1] field name of that doctype
+      if label[0] == master:
+        cond_hold = self.chk_from_main_dt(master,label[1],chk_with_value,d.operator,form_obj) 
+        if cond_hold =='No':
+          all_cond_hold = 'No'
+          break
+        elif cond_hold =='Yes':
+          all_cond_hold ='Yes'
+          
+      #=====================================================   
+      # if checking is with any linked doctype means label[0] field from the doctype for which rule is given and label[1] field from the doctype with which label[0] is linked
+      else:
+        cond_hold=self.chk_from_link_dt(master,label[0],label[1],form_obj,chk_with_value,d.operator)
+        if cond_hold =='No':
+          if d.exception == 'Yes':
+              msgprint(d.message)
+              raise Exception
+          elif d.exception=='No' or d.exception=='':
+              msgprint(d.message)
+          all_cond_hold = 'No'
+          break
+        elif cond_hold =='Yes':
+          all_cond_hold ='Yes'
+   
+    return all_cond_hold
+  
+  #----------------------------------------------------
+  #list of values of label & fieldname of selected master    
+  def get_values(self):
+    op = self.doc.select_field2.split(':')
+    
+    if op[0] == self.doc.master2:
+      field_info = sql("select label,fieldname from `tabDocField` where parent= '%s' AND label = '%s'" %(self.doc.select_master2,op[1]))
+      
+    else:
+      field_info = sql("select label,fieldname from `tabDocField` where parent= '%s' AND label = '%s'" %(op[0],op[1]))
+      
+    comp = sql("SELECT DISTINCT %s FROM `tab%s`" %(field_info[0][1],op[0]))
+    
+    res = ''
+    for i in comp:
+      res +=  "\n" + str(i[0])
+    
+    return cstr(res)
+
+  #----------------------------------------------------  
+  #add_details function add records in condition detail table     
+  def add_details(self):
+    
+    if((self.doc.select_master)  and (self.doc.select_field)):
+      if((self.doc.right_operand=='Automatic') and (self.doc.select_value=='')):
+        msgprint("Please select value")
+      else:
+        ch = addchild(self.doc,'condition_details','Condition Detail',0, self.doclist)
+        ch.rule_master = self.doc.select_master
+        ch.rule_field = self.doc.select_field
+        ch.operator = 'Equals'
+        ch.value = self.doc.select_value
+        ch.save()
+    else:
+      msgprint("Please select form, select field")
\ No newline at end of file
diff --git a/payroll/doctype/payroll_rule/payroll_rule.txt b/payroll/doctype/payroll_rule/payroll_rule.txt
new file mode 100644
index 0000000..0f6b734
--- /dev/null
+++ b/payroll/doctype/payroll_rule/payroll_rule.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:46', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 167, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:rule_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Payroll Rule', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-11 18:22:26', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00744', 'parent': 'Payroll Rule', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:46', 'modified': '2010-10-11 18:22:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00815', 'parent': 'Payroll Rule', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:58:46', 'modified': '2010-10-11 18:22:26', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00816', 'parent': 'Payroll Rule', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:58:46', 'modified': '2010-10-11 18:22:26', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01117', 'parent': 'Payroll Rule', 'read': 1, 'create': None, 'creation': '2010-08-12 16:33:07', 'modified': '2010-10-11 18:22:26', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01118', 'parent': 'Payroll Rule', 'read': 1, 'create': None, 'creation': '2010-08-12 16:33:07', 'modified': '2010-10-11 18:22:26', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01119', 'parent': 'Payroll Rule', 'read': 1, 'create': None, 'creation': '2010-08-12 16:33:07', 'modified': '2010-10-11 18:22:26', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04856', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-06 14:20:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Payroll Rule', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04635', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:46', 'doctype': 'DocField', 'oldfieldname': 'rule_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Rule Name', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04485', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'rule_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'rule_priority', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Rule Priority', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': '', 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04487', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'rule_priority', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Operand', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04488', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Left Operand', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04489', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'select_master', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Form', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04490', 'idx': 7, 'default': 'Salary Structure', 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'select_master', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'select_field', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Field', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04491', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'select_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'right_operand', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Right Operand', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04492', 'idx': 9, 'default': '', 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'right_operand', 'fieldtype': 'Select', 'options': '\nManual\nAutomatic', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'add_condition', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Add', 'width': None, 'trigger': 'Server', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'first select left operand and/or right operand then press Add Button to add condition in Define Rule.', 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04493', 'idx': 10, 'default': '', 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'add_condition', 'fieldtype': 'Button', 'options': 'add_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'right_operand1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Right Operand', 'width': '50%', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04494', 'idx': 11, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'right_operand1', 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'select_master2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Form', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04495', 'idx': 12, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'select_master2', 'fieldtype': 'Select', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'select_field2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Field', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04496', 'idx': 13, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'select_field2', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'select_value', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Value', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04497', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'select_value', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Define Rule', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04498', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'condition_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Define Rule1', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04499', 'idx': 16, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'condition_details', 'fieldtype': 'Table', 'options': 'Condition Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Action Detail', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04500', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Action html', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04501', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<b>Specify actions to be taken  when conditions hold satisfied</b>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'expression', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Expression', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL04502', 'idx': 19, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': 'expression', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-05 17:10:06', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Help', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04631', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-05 17:00:57', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Help Rule Priority', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04630', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'HTML', 'options': '<pre><h4>Rule Priority Help:</h4>\nLower rule priority number executes first. \nSuppose there are 2 rules:\nFirst rule priority: <b>1</b> and second priority: <b>2</b> \nTheir actions are:\nFor rule priority <b>1</b>\nBasic = 900\nhra = basic*0.5\n \nFor rule priority <b>2</b>\nBasic = 1000\n\nThen <b>1</b> priority action executes first and then <b>2</b> priority.\nAccordingly output will be:\nBasic = 1000 and hra = 450\n</pre>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-05 17:31:28', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Right Operand select help', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04632', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'HTML', 'options': '<hr><br><pre><h4>Right Operand Select Help:</h4>\nIf you select Manual option then you have to write value in define rule\nIf you select Automatic option then right operand will open to select value</pre> <br>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-05 17:00:57', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Expression Help ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Payroll Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04629', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-10-11 18:22:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<hr><br><pre><h4>Expression Help:</h4>\nPlease write all letters in lower case and place underscore in between two words.<br>\n<b>Sample Expression:</b>\nbasic=10000\nhouse_rent_allowance = basic *0.5 \ndearness_allowance = basic*0.2\nprovident_fund = 0.12*basic\ncheck = basic + house_rent_allowance +dearness_allowance\nif check<=3000 and check>0: professional_tax = 0\nif check<=6000 and check>3000: professional_tax = 20\nif check<=9000 and check>6000: professional_tax = 80\nif check<=12000 and check>9000: professional_tax = 150\nelse: professional_tax = 200\nemployees_state_insurance = basic*0.28\n\n<b>Note: Place : (colon) after if condition and after else </b>\n\nif condition:\n  someaction\nelse:\n  otheraction</pre> \n  ', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/previous_experience_detail/__init__.py b/payroll/doctype/previous_experience_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/previous_experience_detail/__init__.py
diff --git a/payroll/doctype/previous_experience_detail/previous_experience_detail.txt b/payroll/doctype/previous_experience_detail/previous_experience_detail.txt
new file mode 100644
index 0000000..73ec5e8
--- /dev/null
+++ b/payroll/doctype/previous_experience_detail/previous_experience_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:47', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Previous Experience Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00745', 'parent': 'Previous Experience Detail', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:47', 'modified': '2010-05-25 15:09:13', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'company_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Previous Experience Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04503', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-25 15:09:13', 'parenttype': 'DocType', 'fieldname': 'company_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'designation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Previous Experience Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04504', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-05-25 15:09:13', 'parenttype': 'DocType', 'fieldname': 'designation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'salary', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Salary', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Previous Experience Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04505', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-05-25 15:09:13', 'parenttype': 'DocType', 'fieldname': 'salary', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-25 15:09:13', 'doctype': 'DocField', 'oldfieldname': 'address', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Address', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Previous Experience Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05051', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-05-25 15:09:13', 'parenttype': 'DocType', 'fieldname': 'address', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'contact', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Contact', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Previous Experience Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04507', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-05-25 15:09:13', 'parenttype': 'DocType', 'fieldname': 'contact', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'total_experience', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Total Experience', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Previous Experience Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04508', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-05-25 15:09:13', 'parenttype': 'DocType', 'fieldname': 'total_experience', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/professional_training_details/__init__.py b/payroll/doctype/professional_training_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/professional_training_details/__init__.py
diff --git a/payroll/doctype/professional_training_details/professional_training_details.txt b/payroll/doctype/professional_training_details/professional_training_details.txt
new file mode 100644
index 0000000..ce61bf3
--- /dev/null
+++ b/payroll/doctype/professional_training_details/professional_training_details.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:47', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Professional Training Details', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-25 15:08:04', 'doctype': 'DocField', 'oldfieldname': 'institute', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Institute / Conducted By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Professional Training Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05050', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-25 15:08:04', 'parenttype': 'DocType', 'fieldname': 'institute', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-25 15:08:04', 'doctype': 'DocField', 'oldfieldname': 'nature_of_training', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Program / Seminar Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Professional Training Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05049', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-05-25 15:08:04', 'parenttype': 'DocType', 'fieldname': 'nature_of_training', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'duration', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Duration', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Professional Training Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04511', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-05-25 15:08:04', 'parenttype': 'DocType', 'fieldname': 'duration', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:47', 'doctype': 'DocField', 'oldfieldname': 'loc', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Location', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Professional Training Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04512', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-05-25 15:08:04', 'parenttype': 'DocType', 'fieldname': 'loc', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-25 15:08:04', 'doctype': 'DocField', 'oldfieldname': 'certificate', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Certificate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Professional Training Details', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05048', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-05-25 15:08:04', 'parenttype': 'DocType', 'fieldname': 'certificate', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/rule_engine/__init__.py b/payroll/doctype/rule_engine/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/rule_engine/__init__.py
diff --git a/payroll/doctype/rule_engine/rule_engine.txt b/payroll/doctype/rule_engine/rule_engine.txt
new file mode 100644
index 0000000..51a3e9f
--- /dev/null
+++ b/payroll/doctype/rule_engine/rule_engine.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:47', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 206, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rule Engine', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00746', 'parent': 'Rule Engine', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:47', 'modified': '2010-04-01 15:19:35', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}]
\ No newline at end of file
diff --git a/payroll/doctype/salary_slip/__init__.py b/payroll/doctype/salary_slip/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/salary_slip/__init__.py
diff --git a/payroll/doctype/salary_slip/salary_slip.js b/payroll/doctype/salary_slip/salary_slip.js
new file mode 100644
index 0000000..f3bc9e4
--- /dev/null
+++ b/payroll/doctype/salary_slip/salary_slip.js
@@ -0,0 +1,118 @@
+// On load
+// -------------------------------------------------------------------
+cur_frm.cscript.onload = function(doc,dt,dn){
+  if((cint(doc.__islocal) == 1) && !doc.amended_from){
+    var today=new Date();
+    month = (today.getMonth()+01).toString();
+    if(month.length>1) doc.month = month;
+    else doc.month = '0'+month;
+		doc.fiscal_year = sys_defaults['fiscal_year'];
+    refresh_many(['month', 'fiscal_year']);
+    cur_frm.cscript.fiscal_year(doc, dt, dn);
+  }
+}
+
+// Get leave details
+//---------------------------------------------------------------------
+cur_frm.cscript.fiscal_year = function(doc,dt,dn){
+    $c_obj(make_doclist(doc.doctype,doc.name), 'get_emp_and_leave_details','',function(r, rt) {
+      var doc = locals[dt][dn];
+      cur_frm.refresh();
+      calculate_all(doc, dt, dn);
+    });
+}
+
+cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
+
+// Calculate total if lwp exists
+// ------------------------------------------------------------------------
+cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
+  doc.payment_days = cint(doc.total_days_in_month) - cint(doc.leave_without_pay);
+  refresh_field('payment_days');
+  calculate_all(doc, dt, dn);
+}
+
+// Calculate all
+// ------------------------------------------------------------------------
+var calculate_all = function(doc, dt, dn) {
+  calculate_earning_total(doc, dt, dn);
+  calculate_ded_total(doc, dt, dn);
+  calculate_net_pay(doc, dt, dn);
+}
+
+// Trigger on earning modified amount and depends on lwp
+// ------------------------------------------------------------------------
+cur_frm.cscript.e_modified_amount = function(doc,dt,dn){
+  calculate_earning_total(doc, dt, dn);
+  calculate_net_pay(doc, dt, dn);
+}
+
+cur_frm.cscript.e_depends_on_lwp = cur_frm.cscript.e_modified_amount;
+
+// Trigger on earning modified amount and depends on lwp
+// ------------------------------------------------------------------------
+cur_frm.cscript.d_modified_amount = function(doc,dt,dn){
+  calculate_ded_total(doc, dt, dn);
+  calculate_net_pay(doc, dt, dn);
+}
+
+cur_frm.cscript.d_depends_on_lwp = cur_frm.cscript.d_modified_amount;
+
+// Calculate earning total
+// ------------------------------------------------------------------------
+var calculate_earning_total = function(doc, dt, dn) {
+  var tbl = getchildren('SS Earning Detail', doc.name, 'earning_details', doc.doctype);
+
+  var total_earn = 0;
+  for(var i = 0; i < tbl.length; i++){
+    if(cint(tbl[i].e_depends_on_lwp) == 1) {
+      tbl[i].e_modified_amount = flt(tbl[i].e_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month));      
+      refresh_field('e_modified_amount', tbl[i].name, 'earning_details');
+    }
+    total_earn += flt(tbl[i].e_modified_amount);
+  }
+  doc.gross_pay = total_earn + flt(doc.arrear_amount) + flt(doc.leave_encashment_amount);
+  refresh_many(['e_modified_amount', 'gross_pay']);
+}
+
+// Calculate deduction total
+// ------------------------------------------------------------------------
+var calculate_ded_total = function(doc, dt, dn) {
+  var tbl = getchildren('SS Deduction Detail', doc.name, 'deduction_details', doc.doctype);
+
+  var total_ded = 0;
+  for(var i = 0; i < tbl.length; i++){
+    if(cint(tbl[i].d_depends_on_lwp) == 1) {
+      tbl[i].d_modified_amount = flt(tbl[i].d_amount)*(flt(doc.payment_days)/cint(doc.total_days_in_month));
+			refresh_field('d_modified_amount', tbl[i].name, 'deduction_details');
+    }
+    total_ded += flt(tbl[i].d_modified_amount);
+  }
+  doc.total_deduction = total_ded;
+  refresh_field('total_deduction');  
+}
+
+// Calculate net payable amount
+// ------------------------------------------------------------------------
+var calculate_net_pay = function(doc, dt, dn) {
+  doc.net_pay = flt(doc.gross_pay) - flt(doc.total_deduction);
+	doc.rounded_total = Math.round(doc.net_pay);
+  refresh_many(['net_pay', 'rounded_total']);
+}
+
+// trigger on arrear
+// ------------------------------------------------------------------------
+cur_frm.cscript.arrear_amount = function(doc,dt,dn){
+  calculate_earning_total(doc, dt, dn);
+  calculate_net_pay(doc, dt, dn);
+}
+
+// trigger on encashed amount
+// ------------------------------------------------------------------------
+cur_frm.cscript.leave_encashment_amount = cur_frm.cscript.arrear_amount;
+
+// validate
+// ------------------------------------------------------------------------
+cur_frm.cscript.validate = function(doc, dt, dn) {
+  calculate_all(doc, dt, dn);
+}
diff --git a/payroll/doctype/salary_slip/salary_slip.py b/payroll/doctype/salary_slip/salary_slip.py
new file mode 100644
index 0000000..e952da2
--- /dev/null
+++ b/payroll/doctype/salary_slip/salary_slip.py
@@ -0,0 +1,226 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    
+    
+  # autoname
+  #=======================================================
+  def autoname(self):
+    self.doc.name = make_autoname('Sal Slip/' +self.doc.employee + '/.#####') 
+
+  # Get employee details
+  #=======================================================
+  def get_emp_and_leave_details(self):
+    # Get payment days
+    if self.doc.fiscal_year and self.doc.month:
+      self.get_leave_details()
+
+    # check sal structure
+    if self.doc.employee:
+      struct = self.check_sal_struct()
+      if struct:
+        self.pull_sal_struct(struct)
+
+
+  # Check sal structure
+  #=======================================================
+  def check_sal_struct(self):
+    struct = sql("select name from `tabSalary Structure` where employee ='%s' and is_active = 'Yes' "%self.doc.employee)
+    if not struct:
+      msgprint("Please create Salary Structure for employee '%s'"%self.doc.employee)
+      self.doc.employee = ''
+    return struct and struct[0][0] or ''
+
+  # Pull struct details
+  #=======================================================
+  def pull_sal_struct(self, struct):
+    self.doc.clear_table(self.doclist, 'earning_details')
+    self.doc.clear_table(self.doclist, 'deduction_details')
+
+    get_obj('DocType Mapper', 'Salary Structure-Salary Slip').dt_map('Salary Structure', 'Salary Slip', struct, self.doc, self.doclist, "[['Salary Structure', 'Salary Slip'],['Earning Detail', 'SS Earning Detail'],['Deduction Detail','SS Deduction Detail']]")
+
+    basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % self.doc.employee)
+    self.doc.bank_name = basic_info[0][0]
+    self.doc.bank_account_no = basic_info[0][1]
+    self.doc.esic_no = basic_info[0][2]
+    self.doc.pf_no = basic_info[0][3]
+
+  # Get leave details
+  #=======================================================
+  def get_leave_details(self):
+    m = self.get_month_details()    
+    lwp = self.calculate_lwp(m)
+    self.doc.total_days_in_month = m[3]
+    self.doc.leave_without_pay = lwp
+    self.doc.payment_days = flt(m[3]) - flt(lwp)
+
+  # Get month details
+  #=======================================================
+  def get_month_details(self):
+    ysd = sql("select year_start_date from `tabFiscal Year` where name ='%s'"%self.doc.fiscal_year)[0][0]
+    if ysd:
+      from dateutil.relativedelta import relativedelta
+      import calendar, datetime
+      mnt = int(self.doc.month)
+      diff_mnt = int(mnt)-int(ysd.month)
+      if diff_mnt<0:
+        diff_mnt = 12-int(ysd.month)+int(mnt)
+      msd = ysd + relativedelta(months=diff_mnt) # month start date
+      month_days = cint(calendar.monthrange(cint(msd.year) ,cint(self.doc.month))[1]) # days in month
+      med = datetime.date(msd.year, cint(self.doc.month), month_days) # month end date
+      return msd.year, msd, med, month_days
+
+  # Calculate LWP
+  #=======================================================
+  def calculate_lwp(self, m):
+    holidays = sql("select t1.holiday_date from `tabHoliday List Detail` t1, tabEmployee t2 where t1.parent = t2.holiday_list and t2.name = '%s' and t1.holiday_date between '%s' and '%s'" % (self.doc.employee, m[1], m[2]))
+    if not holidays:
+      holidays = sql("select t1.holiday_date from `tabHoliday List Detail` t1, `tabHoliday List` t2 where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1 and t2.fiscal_year = '%s'" % self.doc.fiscal_year)
+    holidays = [cstr(i[0]) for i in holidays]
+    lwp = 0
+    for d in range(m[3]):
+      dt = add_days(cstr(m[1]), d)
+      if dt not in holidays:
+        if sql("select t1.name from `tabLeave Application` t1, `tabLeave Type` t2 where t2.name = t1.leave_type and ifnull(t2.is_lwp, 0) = 1 and t1.docstatus = 1 and t1.employee = '%s' and '%s' between from_date and to_date"%(self.doc.employee, dt)):
+          lwp += 1
+    return lwp
+        
+  # Check existing
+  #=======================================================
+  def check_existing(self):
+    ret_exist = sql("select name from `tabSalary Slip` where month = '%s' and fiscal_year = '%s' and docstatus != 2 and employee = '%s' and name !='%s'" % (self.doc.month,self.doc.fiscal_year,self.doc.employee,self.doc.name))
+    if ret_exist:
+      msgprint("Salary Slip of employee '%s' already created for this month" % self.doc.employee)
+      self.doc.employee = ''
+      raise Exception
+
+  # Validate
+  #=======================================================
+  def validate(self):
+    self.check_existing()
+    self.doc.total_in_words  = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
+    
+  # ON SUBMIT
+  #=======================================================
+  def on_submit(self):
+    if(self.doc.email_check == 1):      
+      self.send_mail_funct()
+
+  # Send mail
+  #=======================================================
+  def send_mail_funct(self):   
+    emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee)
+    if emailid_ret:
+      receiver = cstr(emailid_ret[0][0]) 
+      subj = 'Salary Slip ' + cstr(self.doc.month) +' '+cstr(self.doc.year)
+      earn_ret=sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name)
+      ded_ret=sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name)
+     
+      earn_table = ''
+      ded_table = ''
+      if earn_ret:
+      
+        earn_table += "<table cellspacing= '5' cellpadding='5' >"
+        
+        for e in earn_ret:
+          if not e[1]:
+            earn_table +='<tr><td>%s</td><td>0.00</td></tr>'%(cstr(e[0]))
+          else:
+            earn_table +='<tr><td>%s</td><td>%s</td></tr>'%(cstr(e[0]),cstr(e[1]))
+        earn_table += '</table>'
+      
+      if ded_ret:
+      
+        ded_table += "<table cellspacing= '5' cellpadding='5' >"
+        
+        for d in ded_ret:
+          if not d[1]:
+            ded_table +='<tr><td>%s</td><td>0.00</td></tr>'%(cstr(d[0]))
+          else:
+            ded_table +='<tr><td>%s</td><td>%s</td></tr>'%(cstr(d[0]),cstr(d[1]))
+        ded_table += '</table>'
+      
+      letter_head = sql("select value from `tabSingles` where field = 'letter_head' and doctype = 'Control Panel'")
+      
+      if not letter_head:
+        letter_head = ''
+      
+      msg = ''' %s <br>
+      <table cellspacing= "5" cellpadding="5" >
+      <tr>
+        <td colspan = 4><h4>Salary Slip</h4></td>
+      </tr>
+      <tr>
+        <td colspan = 2><b>Employee Code : %s</b></td>
+        <td colspan = 2><b>Employee Name : %s</b></td>
+      </tr>
+      <tr>
+        <td>Month : %s</td>
+        <td>Year : %s</td>
+        <td colspan = 2>Fiscal Year : %s</td>
+      </tr>
+      <tr>
+        <td>Department : %s</td>
+        <td>Branch : %s</td>
+        <td colspan = 2>Designation : %s</td>
+        
+      </tr>
+      <tr>
+        <td>Grade : %s</td>
+        <td>Bank Account No. : %s</td>
+        <td colspan = 2>Bank Name : %s</td>
+        
+      </tr>
+      <tr>
+        <td>PF No. : %s</td>
+        <td>ESIC No. : %s</td>
+        <td colspan = 2>Arrear Amount : <b>%s</b></td>
+      </tr>
+      <tr>
+        <td>Total days in month : %s</td>
+        <td>Leave Without Pay : %s</td>
+        <td colspan = 2>Payment days : %s</td>
+        
+      </tr>
+      <br><br>
+      <tr>
+        <td colspan = 2><b>Earning</b></td>
+        <td colspan = 2><b>Deduction</b></td>
+      </tr>
+      <tr>
+        <td colspan = 2>%s</td>
+        <td colspan = 2>%s</td>
+      </tr>
+      <br>
+      <tr>
+        <td colspan = 2><b>Gross Pay :</b> %s</td>
+        <td colspan = 2><b>Total Deduction :</b> %s</td>
+      </tr>
+      <tr>
+        <td><b>Net Pay : %s</b></td>
+        <td colspan = 3><b>Net Pay (in words) : %s</b></td>
+      </tr>
+      </table>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee),self.doc.employee_name,cstr(self.doc.month),cstr(self.doc.year),cstr(self.doc.fiscal_year),self.doc.department,self.doc.branch,self.doc.designation,self.doc.grade,cstr(self.doc.bank_account_no),self.doc.bank_name,cstr(self.doc.pf_no),cstr(self.doc.esic_no),cstr(self.doc.arrear_amount),cstr(self.doc.total_days_in_month),cstr(self.doc.leave_without_pay),cstr(self.doc.payment_days),earn_table,ded_table,cstr(self.doc.gross_pay),cstr(self.doc.total_deduction),cstr(self.doc.net_pay),cstr(self.doc.net_pay_in_words))
+      sendmail([receiver], sender='automail@webnotestech.com', subject=subj, parts=[['text/plain', msg]])
+    else:
+      msgprint("Company Email ID not found.")
diff --git a/payroll/doctype/salary_slip/salary_slip.txt b/payroll/doctype/salary_slip/salary_slip.txt
new file mode 100644
index 0000000..d144d0e
--- /dev/null
+++ b/payroll/doctype/salary_slip/salary_slip.txt
@@ -0,0 +1,1420 @@
+[
+	{
+		'_last_update': '1303273503',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-18 14:16:13',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Salary Slip',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'For %(employee_name)s, %(designation)s',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 372
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00797',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00798',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:20',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'PERM00455',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:20',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'PERM00456',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:20',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'PERM00457',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:20',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'PERM00458',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04663',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04664',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Employee',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02891',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': '',
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Employee Name',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02893',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Department',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02894',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'department',
+		'oldfieldtype': 'Link',
+		'options': 'Department',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Designation',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02895',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'designation',
+		'oldfieldtype': 'Link',
+		'options': 'Designation',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'branch',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Branch',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02896',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'branch',
+		'oldfieldtype': 'Link',
+		'options': 'Branch',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grade',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Grade',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02897',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grade',
+		'oldfieldtype': 'Link',
+		'options': 'Grade',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pf_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'PF No.',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02898',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'pf_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'esic_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'ESIC No.',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02899',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'esic_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04665',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02884',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Data',
+		'options': 'Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'month',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Month',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02886',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'month',
+		'oldfieldtype': 'Select',
+		'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '37%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_days_in_month',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Total days in month',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02903',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_days_in_month',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_without_pay',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Leave Without Pay',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02904',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'leave_without_pay',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'payment_days',
+		'fieldtype': 'Float',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Payment days',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02907',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'payment_days',
+		'oldfieldtype': 'Float',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bank_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Bank Name',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02905',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bank_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bank_account_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Bank Account No.',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02906',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bank_account_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_check',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Email',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02908',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'email_check',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02901',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02902',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Earning & Deduction',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04666',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Earning',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04667',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'earning_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Earning Details',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02914',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'earning_details',
+		'oldfieldtype': 'Table',
+		'options': 'SS Earning Detail',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Deduction',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04668',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'deduction_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Deduction Details',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02917',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'deduction_details',
+		'oldfieldtype': 'Table',
+		'options': 'SS Deduction Detail',
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04669',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04670',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'arrear_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Arrear Amount',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02909',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'arrear_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'leave_encashment_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Leave Encashment Amount',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04572',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'gross_pay',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Gross Pay',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02920',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'gross_pay',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_deduction',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Total Deduction',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02922',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_deduction',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04671',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:20',
+		'default': None,
+		'depends_on': None,
+		'description': 'Gross Pay + Arrear Amount +Encashment Amount - Total Deduction',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_pay',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Net Pay',
+		'modified': '2010-08-08 17:09:20',
+		'modified_by': 'Administrator',
+		'name': 'FL02924',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'net_pay',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/salary_slip_control_panel/__init__.py b/payroll/doctype/salary_slip_control_panel/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/salary_slip_control_panel/__init__.py
diff --git a/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.js b/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.js
new file mode 100644
index 0000000..5fd80cb
--- /dev/null
+++ b/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.js
@@ -0,0 +1,71 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  alert("Salary Slip Control Panel is currently under re-development. It will take around a week time.");
+  hide_field(['Process Payroll', 'Submit Salary Slip', 'Make Bank Voucher']);
+}
+
+cur_frm.cscript['Process Payroll'] = function(doc,cdt,cdn){
+  $c('runserverobj', args={'method':'process_payroll','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},function(r,rt){
+    
+      if(!pscript.ss_html)
+        pscript.ss_html = $a(cur_frm.fields_dict['Salary Slip HTML'].wrapper,'span','',{border:'1px solid #CCC', backgroundColor:'#DDD'});
+      pscript.ss_html.innerHTML = '';
+      pscript.ss_html.innerHTML = r.message;
+      
+    
+    });
+
+}
+
+cur_frm.cscript['Submit Salary Slip'] = function(doc,cdt,cdn){
+  if(doc.month && doc.fiscal_year && doc.year){
+    var check = confirm("DO you really want to Submit all Salary Slip for month : " + doc.month+" and year : "+doc.year);
+    if(check){
+      $c('runserverobj', args={'method':'submit_sal_slip','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},function(r,rt){
+      
+        if(!pscript.ss_html)
+          pscript.ss_html = $a(cur_frm.fields_dict['Salary Slip HTML'].wrapper,'span','',{border:'1px solid #CCC', backgroundColor:'#DDD'});
+        pscript.ss_html.innerHTML = '';
+        pscript.ss_html.innerHTML = r.message;
+        
+      
+      });
+    }
+  }
+  else
+    alert("Please select month, fiscal year and year");
+}
+
+// Make JV
+// --------
+cur_frm.cscript.make_jv = function(doc, dt, dn) {
+  var call_back = function(r,rt){
+    var jv = LocalDB.create('Journal Voucher');
+    jv = locals['Journal Voucher'][jv];
+    jv.voucher_type = 'Bank Voucher';
+    jv.remark = 'Salary - Bank Voucher';
+    jv.fiscal_year = doc.fiscal_year;
+    jv.company = doc.company;
+    
+    // credit to bank
+    var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+    d1.account = r.message['default_bank_account'];
+
+    // debit to salary account
+    var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+    d1.account = r.message['default_salary_account'];
+    if(!r.message['default_salary_account'] && !r.message['default_bank_account']) alert("To debit salary amount in salary head and credit amount from bank, you need to specify default salary account and default bank account in Global Defaults.\nGo to Setup, click on Company. Select a company.\nSelect Default Salary Account, Default Bank Account from Accounting tab.");
+    else if(!r.message['default_salary_account']) alert("To debit salary amount you need to specify default salary account in Global Defaults.\nGo to Setup, click on Company. Select a company.\nSelect Default Salary Account from Accounting tab.");
+    else if(!r.message['default_bank_account']) alert("To credit salary amount you need to specify default bank account in Global Defaults.\nGo to Setup, click on Company. Select a company.\nSelect Default Bank Account from Accounting tab.");
+    loaddoc('Journal Voucher', jv.name);
+  }
+  $c_obj(make_doclist(dt,dn),'get_acct_dtl','',call_back);
+
+}
+
+
+
+// Make Journal Voucher
+// --------------------
+cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
+  cur_frm.cscript.make_jv(doc,dt,dn);
+}
diff --git a/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.py b/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.py
new file mode 100644
index 0000000..3a4fadf
--- /dev/null
+++ b/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.py
@@ -0,0 +1,137 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist   
+  
+  # Get Employees
+  # ********************************************************************** 
+  def get_employee(self):    
+    e1 = self.emp_fr_memp()  #get employee list from employee where employee is active
+    e2 = self.emp_fr_salstr(e1)  #get employee list from salary structure whose salary structure is created and is active 
+    e3 = self.emp_fr_salslip(e2)  #get employee list from salary slip whose salary slip not yet created for this month and year
+    return e3
+
+  # ********************************************************************** 
+  def emp_fr_memp(self):
+    lst1 = [[self.doc.employee_type,"employment_type"],[self.doc.branch,"branch"],[self.doc.designation,"designation"],[self.doc.department, "department"],[self.doc.grade,"grade"]]
+    
+    condition = ""
+    #flag = 0
+    for l in lst1:
+      
+      if(l[0]):
+        #if flag == 0:
+        #  condition += l[1] + "= '" + l[0] +"'"
+        #else:
+        condition += " and " + l[1]+ "= '" +l[0] +"'"
+        #flag = 1
+
+    emp_query = "select name from `tabEmployee` where status = 'Active'"
+    #if flag == 1:
+    emp_query += condition
+            
+    e = sql(emp_query)
+    return e
+
+  # ********************************************************************** 
+  def emp_fr_salstr(self,e1):
+    lst = []
+    for r in e1:
+      lst.append(r[0])
+    
+    
+    e_lst = "%s"%lst
+    e_lst=e_lst.replace("[","(")
+    e_lst=e_lst.replace("]",")")
+    cond = ''
+
+    if e1:
+      cond = " and employee in %s"%e_lst
+    
+    el=sql("select employee from `tabSalary Structure` where is_active = 'Yes'"+cond)
+
+    return el
+
+  # ********************************************************************** 
+  def emp_fr_salslip(self,e2):
+    e3 = []
+    for i in e2:
+      ret = sql("select name from `tabSalary Slip` where month = '%s' and year = '%s' and employee = '%s' and docstatus !=2 "%(self.doc.month,self.doc.year,i[0]))
+
+      if not ret:
+        e3.append(i[0])
+    return e3
+    
+  # ********************************************************************** 
+  def process_payroll(self):
+    sal_slip_str = ''
+    if self.doc.month and self.doc.fiscal_year and self.doc.year:
+      e = self.get_employee()
+      if e:
+        self.doc.emp_lst=e
+        sal_slip_str += 'Sucessfully created following salary slips:'
+      for i in e:
+      	ss = Document('Salary Slip')
+        ss.fiscal_year = self.doc.fiscal_year
+        ss.employee = i
+        ss.month = self.doc.month
+        ss.year= self.doc.year
+        ss.arrear_amount = self.doc.arrear_amount    
+        ss.email_check = self.doc.email_check
+        ss.save(1)
+        salary_obj=get_obj("Salary Slip",ss.name,with_children=1)   
+        salary_obj.process_payroll_all()
+        sal_slip_str += "<br/>"+ss.name 
+        
+    else:
+    
+      msgprint("For Process Payroll Fiscal Year, Month, Year fields are mandatory.")
+    if not sal_slip_str: 
+     
+      sal_slip_str = "No record found."
+    return cstr(sal_slip_str)
+
+  # ********************************************************************** 
+  def submit_sal_slip(self):
+  
+    sal_slip_str = ''
+    r = sql("select name from `tabSalary Slip` where month='%s' and year = '%s' and fiscal_year = '%s' and docstatus = 0"%(self.doc.month,self.doc.year,self.doc.fiscal_year))
+
+  
+    ret = sql("update `tabSalary Slip` set docstatus = 1 where month='%s' and year = '%s' and fiscal_year = '%s' and docstatus = 0"%(self.doc.month,self.doc.year,self.doc.fiscal_year))
+    if r:
+      sal_slip_str += 'Sucessfully updated following salary slips:'
+    for i in r:
+      
+      salary_obj=get_obj("Salary Slip",i[0],with_children=1)   
+      salary_obj.on_submit()
+      sal_slip_str += "<br/>"+cstr(i[0]) 
+    if not sal_slip_str: 
+     
+      sal_slip_str = "No record found."
+    return cstr(sal_slip_str)
+  
+  # ********************************************************************** 
+  #get default bank account,default salary acount from company.
+  def get_acct_dtl(self):
+    res = sql("select default_bank_account,default_salary_acount from `tabCompany` where name = '%s'"%get_defaults()['company'], as_dict=1)
+    return res[0]
diff --git a/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.txt b/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.txt
new file mode 100644
index 0000000..96f7ce5
--- /dev/null
+++ b/payroll/doctype/salary_slip_control_panel/salary_slip_control_panel.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:48', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 1, 'allow_email': 1, 'dt_template': None, 'hide_heading': 0, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 125, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': 0, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Salary Slip Control Panel', 'idx': None, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-05 11:18:58', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00749', 'parent': 'Salary Slip Control Panel', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:48', 'modified': '2010-10-05 11:18:58', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00787', 'parent': 'Salary Slip Control Panel', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:50:52', 'modified': '2010-10-05 11:18:58', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00788', 'parent': 'Salary Slip Control Panel', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:50:52', 'modified': '2010-10-05 11:18:58', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-05-27 13:24:36', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Salary Slip Control Panel', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05090', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': 'employee_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Employment Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04555', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'employee_type', 'fieldtype': 'Select', 'options': 'link:Employment Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': 'grade', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Grade', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04556', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'grade', 'fieldtype': 'Select', 'options': 'link:Grade', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': 'branch', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Branch', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04557', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'branch', 'fieldtype': 'Select', 'options': 'link:Branch', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': 'department', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Department', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04558', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'department', 'fieldtype': 'Select', 'options': 'link:Department', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': 'designation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04559', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'designation', 'fieldtype': 'Select', 'options': 'link:Designation', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': '', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04560', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:48', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04561', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': 'month', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Month', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04562', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'month', 'fieldtype': 'Select', 'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': 'year', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04563', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'year', 'fieldtype': 'Select', 'options': '\n2009\n2010\n2011\n2012', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': 'week_off', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Week Off', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04564', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'week_off', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': 'arrear_amount', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Arrear Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04565', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'arrear_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': 'email_check', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Email', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04567', 'idx': 13, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': 'email_check', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04566', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-01 14:14:49', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Process Payroll', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04568', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-05-27 14:29:57', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Salary Slip HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05091', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'HTML', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-06-02 13:28:16', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05219', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-05 12:15:40', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Submit Salary Slip', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04626', 'idx': 18, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-04 14:46:03', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Make Bank Voucher', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Salary Slip Control Panel', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06193', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-10-05 11:18:58', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/payroll/doctype/salary_structure/__init__.py b/payroll/doctype/salary_structure/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/salary_structure/__init__.py
diff --git a/payroll/doctype/salary_structure/salary_structure.js b/payroll/doctype/salary_structure/salary_structure.js
new file mode 100644
index 0000000..b21ac7e
--- /dev/null
+++ b/payroll/doctype/salary_structure/salary_structure.js
@@ -0,0 +1,103 @@
+// On load
+//=======================================================================
+cur_frm.cscript.onload = function(doc, dt, dn){
+  e_tbl = getchildren('Earning Detail', doc.name, 'earning_details', doc.doctype);
+  d_tbl = getchildren('Deduction Detail', doc.name, 'deduction_details', doc.doctype);
+  if (e_tbl.length == 0 && d_tbl.length == 0)
+    $c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
+}
+
+// On refresh
+//=======================================================================
+cur_frm.cscript.refresh = function(doc, dt, dn){
+  if((!doc.__islocal) && (doc.is_active == 'Yes')){
+    cur_frm.add_custom_button('Make IT Checklist', cur_frm.cscript['Make IT Checklist']);
+    cur_frm.add_custom_button('Make Salary Slip', cur_frm.cscript['Make Salary Slip']);
+  
+    get_field(doc.doctype, 'employee', doc.name).permlevel = 1;
+    refresh_field('employee');
+  }
+}
+
+// Make IT checklist
+//=======================================================================
+cur_frm.cscript['Make IT Checklist']=function(){
+  var itc = LocalDB.create('IT Checklist');
+  itc = locals['IT Checklist'][itc];
+  itc.employee = cur_frm.doc.employee;
+  itc.fiscal_year = sys_defaults.fiscal_year;
+  itc.is_cheklist_active='Yes';
+  loaddoc('IT Checklist', itc.name);
+}
+
+// Make Salry Slip
+//=======================================================================
+cur_frm.cscript['Make Salary Slip'] = function(){
+  var doc = cur_frm.doc;  
+  var callback = function(r,rt){
+    ret = r.message;
+    n = createLocal("Salary Slip");
+    $c('dt_map', args={
+      'docs':compress_doclist([locals["Salary Slip"][n]]),
+      'from_doctype':'Salary Structure',
+      'to_doctype':'Salary Slip',
+      'from_docname':doc.name,
+      'from_to_list':"[['Salary Structure', 'Salary Slip'], ['Earning Detail', 'SS Earning Detail'], ['Deduction Detail', 'SS Deduction Detail']]"
+      }, 
+      function(r,rt) {
+        n.fiscal_year = sys_defaults.fiscal_year;
+        n.bank_name = ret['bank_name'];
+        n.bank_account_no = ret['bank_ac_no'];
+        n.esic_no=ret['esic_no'];
+        n.pf_no= ret['pf_no'];
+        loaddoc("Salary Slip", n);
+      }
+    );
+  }
+  $c_obj(make_doclist(doc.doctype,doc.name),'get_ss_values',cur_frm.doc.employee, callback); 
+}
+
+
+// get employee details
+//=======================================================================
+cur_frm.cscript.employee = function(doc, dt, dn){
+  if (doc.employee)
+    get_server_fields('get_employee_details','','',doc,dt,dn);
+}
+
+// calculate earning totals 
+//=======================================================================
+cur_frm.cscript.modified_value = function(doc, cdt, cdn){
+  calculate_totals(doc, cdt, cdn);
+}
+
+// calculate deduction totals
+//=======================================================================
+cur_frm.cscript.d_modified_amt = function(doc, cdt, cdn){
+  calculate_totals(doc, cdt, cdn);
+}
+
+// calculate totals
+//=======================================================================
+var calculate_totals = function(doc, cdt, cdn) {
+  var tbl1 = getchildren('Earning Detail', doc.name, 'earning_details', doc.doctype);
+  var tbl2 = getchildren('Deduction Detail', doc.name, 'deduction_details', doc.doctype);
+  
+  var total_earn = 0; var total_ded = 0;
+  for(var i = 0; i < tbl1.length; i++){
+    total_earn += flt(tbl1[i].modified_value);
+  }
+  for(var j = 0; j < tbl2.length; j++){
+    total_ded += flt(tbl2[j].d_modified_amt);
+  }
+  doc.total_earning = total_earn;
+  doc.total_deduction = total_ded;
+  doc.net_pay = flt(total_earn) - flt(total_ded);
+  refresh_many(['total_earning', 'total_deduction', 'net_pay']);
+}
+
+// validate
+//=======================================================================
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+  calculate_totals(doc, cdt, cdn);
+}
diff --git a/payroll/doctype/salary_structure/salary_structure.py b/payroll/doctype/salary_structure/salary_structure.py
new file mode 100644
index 0000000..fd295ea
--- /dev/null
+++ b/payroll/doctype/salary_structure/salary_structure.py
@@ -0,0 +1,104 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  #init function
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+ 
+  #autoname function
+  #---------------------------------------------------------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.employee + '/.SST' + '/.#####')
+  
+  #get employee details
+  #---------------------------------------------------------
+  def get_employee_details(self):
+    ret = {}
+    det = sql("select employee_name, branch, designation, department, grade from `tabEmployee` where name = '%s'" %self.doc.employee)
+    if det:
+      ret = {
+        'employee_name'  : cstr(det[0][0]),
+        'branch'         : cstr(det[0][1]),
+        'designation'    : cstr(det[0][2]),
+        'department'     : cstr(det[0][3]),
+        'grade'          : cstr(det[0][4]),
+        'backup_employee': cstr(self.doc.employee)
+      }
+    return cstr(ret)
+    
+
+  # Set Salary structure field values
+  #---------------------------------------------------------
+  def get_ss_values(self,employee):
+    basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % employee)
+    ret = {'bank_name'   : basic_info and basic_info[0][0] or '',
+            'bank_ac_no'  : basic_info and basic_info[0][1] or '',
+            'esic_no'     : basic_info and basic_info[0][2] or '',
+            'pf_no'       : basic_info and basic_info[0][3] or ''}
+    return cstr(ret)
+   
+  # Make earning and deduction table    
+  #---------------------------------------------------------
+  def make_table(self, doct_name, tab_fname, tab_name):
+    list1 = sql("select name from `tab%s` where docstatus != 2" % doct_name)
+    for li in list1:
+      child = addchild(self.doc, tab_fname, tab_name, 1, self.doclist)
+      if(tab_fname == 'earning_details'):
+        child.e_type = cstr(li[0])
+        child.modified_value = 0
+      elif(tab_fname == 'deduction_details'):
+        child.d_type = cstr(li[0])
+        child.d_modified_amt = 0
+    
+  # add earning & deduction types to table 
+  #---------------------------------------------------------   
+  def make_earn_ded_table(self):           
+    #Earning List
+    self.make_table('Earning Type','earning_details','Earning Detail')
+    
+    #Deduction List
+    self.make_table('Deduction Type','deduction_details', 'Deduction Detail')
+    
+
+  # Check if another active ss exists
+  #---------------------------------------------------------
+  def check_existing(self):
+    ret = sql("select name from `tabSalary Structure` where is_active = 'Yes' and employee = '%s' and name!='%s'" %(self.doc.employee,self.doc.name))
+    if ret and self.doc.is_active=='Yes':
+      msgprint("Another Salary Structure '%s' is active for employee '%s'. Please make its status 'Inactive' to proceed."%(cstr(ret), self.doc.employee))
+      raise Exception
+
+  # Validate net pay
+  #---------------------------------------------------------
+  def validate_net_pay(self):
+    if flt(self.doc.net_pay) < 0:
+      msgprint("Net pay can not be negative")
+      raise Exception
+    elif flt(self.doc.net_pay) > flt(self.doc.ctc):
+      msgprint("Net pay can not be greater than CTC")
+      raise Exception      
+
+  # Validate
+  #---------------------------------------------------------
+  def validate(self):   
+    self.check_existing()
+    self.validate_net_pay()
+
diff --git a/payroll/doctype/salary_structure/salary_structure.txt b/payroll/doctype/salary_structure/salary_structure.txt
new file mode 100644
index 0000000..9ca37ff
--- /dev/null
+++ b/payroll/doctype/salary_structure/salary_structure.txt
@@ -0,0 +1,1083 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:26',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-18 14:17:16',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'Salary Structure',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'For %(employee_name)s',
+		'tag_fields': '',
+		'use_template': None,
+		'version': 585
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00795',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2011-02-21 09:23:54',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': 'owner',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'PERM00796',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': None,
+		'read': 1,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-12-30 13:02:27',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00785',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-12-30 13:02:27',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00786',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-12-30 13:02:27',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00787',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-12-30 13:02:27',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00788',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-12-30 13:02:27',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'PERM00789',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'HR User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04654',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'basic_info',
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04655',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Employee',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04446',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Employee Name',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04447',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'employee_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'branch',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Branch',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04448',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'branch',
+		'oldfieldtype': 'Select',
+		'options': 'link:Branch',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Designation',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04449',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'designation',
+		'oldfieldtype': 'Select',
+		'options': 'link:Designation',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Department',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04450',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'department',
+		'oldfieldtype': 'Select',
+		'options': 'link:Department',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grade',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': '',
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Grade',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04451',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'grade',
+		'oldfieldtype': 'Select',
+		'options': 'link:Grade',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04656',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': 'Yes',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_active',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': 1,
+		'label': 'Is Active',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04453',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_active',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'From Date',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04454',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'from_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'To Date',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04455',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'to_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': 'Cost to Company',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ctc',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'CTC',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04456',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'ctc',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': 'You can create more earning and deduction type from Setup --> HR',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Earning & Deduction',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04657',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'earning_deduction',
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': 0,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Earning',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04658',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'col_brk2',
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'earning_details',
+		'fieldtype': 'Table',
+		'hidden': 0,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Earning1',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04459',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'earning_details',
+		'oldfieldtype': 'Table',
+		'options': 'Earning Detail',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': 0,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Deduction',
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04659',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'col_brk3',
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'deduction_details',
+		'fieldtype': 'Table',
+		'hidden': 0,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Deduction1',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04462',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'deduction_details',
+		'oldfieldtype': 'Table',
+		'options': 'Deduction Detail',
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04660',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04661',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_earning',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Total Earning',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04465',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_earning',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-30 13:02:27',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_deduction',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Total Deduction',
+		'modified': '2010-12-30 13:02:27',
+		'modified_by': 'Administrator',
+		'name': 'FL04468',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'total_deduction',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-02-21 09:23:57',
+		'modified_by': 'Administrator',
+		'name': 'FL04662',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 09:23:54',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_pay',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Net Pay',
+		'modified': '2011-02-21 09:23:54',
+		'modified_by': 'Administrator',
+		'name': 'FL04559',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Salary Structure',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/ss_deduction_detail/__init__.py b/payroll/doctype/ss_deduction_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/ss_deduction_detail/__init__.py
diff --git a/payroll/doctype/ss_deduction_detail/ss_deduction_detail.txt b/payroll/doctype/ss_deduction_detail/ss_deduction_detail.txt
new file mode 100644
index 0000000..67d6a41
--- /dev/null
+++ b/payroll/doctype/ss_deduction_detail/ss_deduction_detail.txt
@@ -0,0 +1,218 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-12 18:24:31',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'SS Deduction Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 17
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:24',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-12 18:24:31',
+		'modified_by': 'Administrator',
+		'name': 'PERM00536',
+		'owner': 'Administrator',
+		'parent': 'SS Deduction Detail',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'd_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Type',
+		'modified': '2011-02-12 18:24:31',
+		'modified_by': 'Administrator',
+		'name': 'FL03360',
+		'no_copy': None,
+		'oldfieldname': 'd_type',
+		'oldfieldtype': 'Data',
+		'options': 'Deduction Type',
+		'owner': 'Administrator',
+		'parent': 'SS Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'd_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-02-12 18:24:31',
+		'modified_by': 'Administrator',
+		'name': 'FL03361',
+		'no_copy': None,
+		'oldfieldname': 'd_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SS Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-10 15:56:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'd_modified_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Modified Amount',
+		'modified': '2011-02-12 18:24:31',
+		'modified_by': 'Administrator',
+		'name': 'FL04467',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SS Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-11 12:50:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'd_depends_on_lwp',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Depends on LWP',
+		'modified': '2011-02-12 18:24:31',
+		'modified_by': 'Administrator',
+		'name': 'FL04469',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SS Deduction Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/doctype/ss_earning_detail/__init__.py b/payroll/doctype/ss_earning_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/doctype/ss_earning_detail/__init__.py
diff --git a/payroll/doctype/ss_earning_detail/ss_earning_detail.txt b/payroll/doctype/ss_earning_detail/ss_earning_detail.txt
new file mode 100644
index 0000000..c126a29
--- /dev/null
+++ b/payroll/doctype/ss_earning_detail/ss_earning_detail.txt
@@ -0,0 +1,218 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-12 18:24:20',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'SS Earning Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 17
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:24',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-12 18:24:20',
+		'modified_by': 'Administrator',
+		'name': 'PERM00537',
+		'owner': 'Administrator',
+		'parent': 'SS Earning Detail',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'e_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Type',
+		'modified': '2011-02-12 18:24:20',
+		'modified_by': 'Administrator',
+		'name': 'FL03362',
+		'no_copy': None,
+		'oldfieldname': 'e_type',
+		'oldfieldtype': 'Data',
+		'options': 'Earning Type',
+		'owner': 'Administrator',
+		'parent': 'SS Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:24',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'e_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Amount',
+		'modified': '2011-02-12 18:24:20',
+		'modified_by': 'Administrator',
+		'name': 'FL03363',
+		'no_copy': None,
+		'oldfieldname': 'e_amount',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SS Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-10 15:55:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'e_modified_amount',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Modified Amount',
+		'modified': '2011-02-12 18:24:20',
+		'modified_by': 'Administrator',
+		'name': 'FL04466',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SS Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-11 12:49:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'e_depends_on_lwp',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Depends on LWP',
+		'modified': '2011-02-12 18:24:20',
+		'modified_by': 'Administrator',
+		'name': 'FL04468',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SS Earning Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/payroll/page/__init__.py b/payroll/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/page/__init__.py
diff --git a/payroll/search_criteria/__init__.py b/payroll/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/__init__.py
diff --git a/payroll/search_criteria/appraisal_custom/__init__.py b/payroll/search_criteria/appraisal_custom/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/appraisal_custom/__init__.py
diff --git a/payroll/search_criteria/appraisal_custom/appraisal_custom.txt b/payroll/search_criteria/appraisal_custom/appraisal_custom.txt
new file mode 100644
index 0000000..ece8522
--- /dev/null
+++ b/payroll/search_criteria/appraisal_custom/appraisal_custom.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Appraisal\x01ID,Appraisal\x01Owner,Appraisal\x01Status,Appraisal\x01Employee,Appraisal\x01Employee Name,Appraisal\x01Fiscal Year,Appraisal\x01Company,Appraisal\x01Start Date,Appraisal\x01End Date',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Appraisal custom',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Appraisal',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Appraisal\x01Saved':1,'Appraisal\x01Submitted':1,'Appraisal\x01Status':'','Appraisal\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-21 11:35:36',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'appraisal_custom',
+		'owner': 'sneha@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabAppraisal`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report/__init__.py b/payroll/search_criteria/datewise_leave_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report/__init__.py
diff --git a/payroll/search_criteria/datewise_leave_report/datewise_leave_report.txt b/payroll/search_criteria/datewise_leave_report/datewise_leave_report.txt
new file mode 100644
index 0000000..5c1a910
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report/datewise_leave_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Leave Transaction\x01Employee',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Datewise Leave Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Leave Transaction',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Leave Transaction\x01Saved':1,'Leave Transaction\x01Submitted':1,'Leave Transaction\x01Fiscal Year':'','Leave Transaction\x01Leave Type':'','Leave Transaction\x01Leave Transaction Type':'','Leave Transaction\x01Allocation Type':'','Leave Transaction\x01Deduction Type':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabLeave Transaction`.employee',
+		'idx': None,
+		'modified': '2010-04-01 14:45:55',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'datewise_leave_report',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report1/__init__.py b/payroll/search_criteria/datewise_leave_report1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report1/__init__.py
diff --git a/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.js b/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.js
new file mode 100644
index 0000000..e5fc72a
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.js
@@ -0,0 +1,8 @@
+report.customize_filters = function() {
+  this.add_filter({fieldname:'from_date', label:'From date', fieldtype:'date', options:'',ignore : 1, parent:'Leave Transaction'});
+  this.add_filter({fieldname:'to_date', label:'To date', fieldtype:'date', options:'',ignore : 1, parent:'Leave Transaction'});
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'From date'].df.in_first_page = 1;
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'To date'].df.in_first_page = 1;
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'From date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'To date'].df['report_default'] = dateutil.obj_to_str(new Date());
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.py b/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.py
new file mode 100644
index 0000000..4acd1eb
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.py
@@ -0,0 +1,45 @@
+leave_type_lst = sql("select name from `tabLeave Type` where is_active = 'Yes'")
+
+li=['Total Opening']
+if leave_type_lst:
+  for lst in leave_type_lst:
+  
+    li.append(lst[0])
+
+li.append('Total Closing')
+
+
+
+for d in li:
+  colnames.append(d)
+  colwidths.append("100px")
+  coltypes.append("Currency")
+  coloptions.append("")
+  col_idx[d] = len(colnames)-1
+  for r in res:
+    
+    r.append("0")
+
+
+for r in res:
+  for d1 in li:
+    d2 = '%s'%d1
+    if d2 == 'Total Opening':
+      ret_all = sql("select sum(total_leave) from `tabLeave Transaction` where leave_transaction_type = 'Allocation' and employee = '%s' and %s <= to_date and docstatus = 1 and fiscal_year = '2010-2011'" %(r[col_idx['Employee']],filter_values['from_date']))
+      
+      #query = "(SUM(CASE WHEN leave_transaction_type = 'Allocation'  THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = 'Deduction' AND leave_type != 'Leave Without Pay' THEN total_leave ELSE 0 END))"
+      #query1 = "select " + query + " from `tabLeave Transaction` where employee = '%s' and %s <= to_date and docstatus = 1"
+      #sum_total_leave = sql(query1%(r[col_idx['Employee']],filter_values['from_date']))
+      #r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
+      
+    elif d2 == 'Total Closing':
+      query = "(SUM(CASE WHEN leave_transaction_type = 'Allocation' AND leave_type != 'Leave Without Pay' AND leave_type != 'Compensatory Off' THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = 'Deduction' AND leave_type != 'Leave Without Pay' THEN total_leave ELSE 0 END))"
+      query1 = "select " + query + " from `tabLeave Transaction` where employee = '%s' and %s <= to_date and docstatus = 1"
+      sum_total_leave = sql(query1%(r[col_idx['Employee']],filter_values['to_date']))
+      r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
+      
+    elif leave_type_lst:
+      query = "SUM(CASE WHEN leave_transaction_type = 'Deduction' THEN total_leave ELSE 0 END)"
+      query1 = "select " + query + " from `tabLeave Transaction` where leave_type = '%s' and employee = '%s' and (from_date <= %s <= to_date or from_date <= %s <= to_date) and docstatus = 1"
+      sum_total_leave = sql(query1%(d1,r[col_idx['Employee']],filter_values['from_date'],filter_values['to_date']))
+      r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.txt b/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.txt
new file mode 100644
index 0000000..b58e4b4
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report1/datewise_leave_report1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Leave Transaction\x01Employee',
+		'creation': '2010-12-14 17:56:47',
+		'criteria_name': 'Datewise Leave Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Leave Transaction',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Leave Transaction\x01Saved':1,'Leave Transaction\x01Submitted':1,'Leave Transaction\x01Fiscal Year':'','Leave Transaction\x01Leave Type':'','Leave Transaction\x01Leave Transaction Type':'','Leave Transaction\x01Allocation Type':'','Leave Transaction\x01Deduction Type':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabLeave Transaction`.employee',
+		'idx': None,
+		'modified': '2010-04-01 14:45:55',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'datewise_leave_report1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report2/__init__.py b/payroll/search_criteria/datewise_leave_report2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report2/__init__.py
diff --git a/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.js b/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.js
new file mode 100644
index 0000000..e5fc72a
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.js
@@ -0,0 +1,8 @@
+report.customize_filters = function() {
+  this.add_filter({fieldname:'from_date', label:'From date', fieldtype:'date', options:'',ignore : 1, parent:'Leave Transaction'});
+  this.add_filter({fieldname:'to_date', label:'To date', fieldtype:'date', options:'',ignore : 1, parent:'Leave Transaction'});
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'From date'].df.in_first_page = 1;
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'To date'].df.in_first_page = 1;
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'From date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'To date'].df['report_default'] = dateutil.obj_to_str(new Date());
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.py b/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.py
new file mode 100644
index 0000000..4acd1eb
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.py
@@ -0,0 +1,45 @@
+leave_type_lst = sql("select name from `tabLeave Type` where is_active = 'Yes'")
+
+li=['Total Opening']
+if leave_type_lst:
+  for lst in leave_type_lst:
+  
+    li.append(lst[0])
+
+li.append('Total Closing')
+
+
+
+for d in li:
+  colnames.append(d)
+  colwidths.append("100px")
+  coltypes.append("Currency")
+  coloptions.append("")
+  col_idx[d] = len(colnames)-1
+  for r in res:
+    
+    r.append("0")
+
+
+for r in res:
+  for d1 in li:
+    d2 = '%s'%d1
+    if d2 == 'Total Opening':
+      ret_all = sql("select sum(total_leave) from `tabLeave Transaction` where leave_transaction_type = 'Allocation' and employee = '%s' and %s <= to_date and docstatus = 1 and fiscal_year = '2010-2011'" %(r[col_idx['Employee']],filter_values['from_date']))
+      
+      #query = "(SUM(CASE WHEN leave_transaction_type = 'Allocation'  THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = 'Deduction' AND leave_type != 'Leave Without Pay' THEN total_leave ELSE 0 END))"
+      #query1 = "select " + query + " from `tabLeave Transaction` where employee = '%s' and %s <= to_date and docstatus = 1"
+      #sum_total_leave = sql(query1%(r[col_idx['Employee']],filter_values['from_date']))
+      #r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
+      
+    elif d2 == 'Total Closing':
+      query = "(SUM(CASE WHEN leave_transaction_type = 'Allocation' AND leave_type != 'Leave Without Pay' AND leave_type != 'Compensatory Off' THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = 'Deduction' AND leave_type != 'Leave Without Pay' THEN total_leave ELSE 0 END))"
+      query1 = "select " + query + " from `tabLeave Transaction` where employee = '%s' and %s <= to_date and docstatus = 1"
+      sum_total_leave = sql(query1%(r[col_idx['Employee']],filter_values['to_date']))
+      r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
+      
+    elif leave_type_lst:
+      query = "SUM(CASE WHEN leave_transaction_type = 'Deduction' THEN total_leave ELSE 0 END)"
+      query1 = "select " + query + " from `tabLeave Transaction` where leave_type = '%s' and employee = '%s' and (from_date <= %s <= to_date or from_date <= %s <= to_date) and docstatus = 1"
+      sum_total_leave = sql(query1%(d1,r[col_idx['Employee']],filter_values['from_date'],filter_values['to_date']))
+      r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
\ No newline at end of file
diff --git a/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.txt b/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.txt
new file mode 100644
index 0000000..e571ce8
--- /dev/null
+++ b/payroll/search_criteria/datewise_leave_report2/datewise_leave_report2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Leave Transaction\x01Employee',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Datewise Leave Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Leave Transaction',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Leave Transaction\x01Saved':1,'Leave Transaction\x01Submitted':1,'Leave Transaction\x01Fiscal Year':'','Leave Transaction\x01Leave Type':'','Leave Transaction\x01Leave Transaction Type':'','Leave Transaction\x01Allocation Type':'','Leave Transaction\x01Deduction Type':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabLeave Transaction`.employee',
+		'idx': None,
+		'modified': '2010-04-01 14:45:55',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'datewise_leave_report2',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_appraisals/__init__.py b/payroll/search_criteria/employee_appraisals/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_appraisals/__init__.py
diff --git a/payroll/search_criteria/employee_appraisals/employee_appraisals.txt b/payroll/search_criteria/employee_appraisals/employee_appraisals.txt
new file mode 100644
index 0000000..fc1d3e1
--- /dev/null
+++ b/payroll/search_criteria/employee_appraisals/employee_appraisals.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Appraisal\x01ID,Appraisal\x01Status,Appraisal\x01Employee,Appraisal\x01Employee Name,Appraisal\x01Start Date,Appraisal\x01End Date,Appraisal\x01Approver,Appraisal\x01Total Score',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Employee Appraisals',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Appraisal',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Appraisal\x01Saved':1,'Appraisal\x01Submitted':1,'Appraisal\x01Status':'','Appraisal\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-01 14:18:42',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_appraisals',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabAppraisal`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_details/__init__.py b/payroll/search_criteria/employee_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_details/__init__.py
diff --git a/payroll/search_criteria/employee_details/employee_details.txt b/payroll/search_criteria/employee_details/employee_details.txt
new file mode 100644
index 0000000..08d785b
--- /dev/null
+++ b/payroll/search_criteria/employee_details/employee_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Code,Employee\x01Employee Number,Employee\x01Gender,Employee\x01Employment Type,Employee\x01Date of Joining,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Company Email,Employee\x01Relieving Date',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Employee Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-01 14:27:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_details1/__init__.py b/payroll/search_criteria/employee_details1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_details1/__init__.py
diff --git a/payroll/search_criteria/employee_details1/employee_details1.js b/payroll/search_criteria/employee_details1/employee_details1.js
new file mode 100644
index 0000000..5e4b42e
--- /dev/null
+++ b/payroll/search_criteria/employee_details1/employee_details1.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Department'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'ID'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_details1/employee_details1.py b/payroll/search_criteria/employee_details1/employee_details1.py
new file mode 100644
index 0000000..084eb91
--- /dev/null
+++ b/payroll/search_criteria/employee_details1/employee_details1.py
@@ -0,0 +1,13 @@
+colwidths[col_idx['ID']]='120px'
+colwidths[col_idx['Employee Name']]='150px' 
+colwidths[col_idx['Department']] = '150px'
+colwidths[col_idx['Designation']]='120px' 
+colwidths[col_idx['Branch']] ='120px'
+colwidths[col_idx['Company Email']]='170px' 
+colwidths[col_idx['Relieving Date']]='120px' 
+colwidths[col_idx['Employment Type']]='120px' 
+colwidths[col_idx['Date of Joining']]='120px'
+colwidths[col_idx['Scheduled Confirmation Date']]='150px' 
+colwidths[col_idx['Contract End Date']]='120px'
+colwidths[col_idx['Employee Code']]='120px' 
+colwidths[col_idx['Employee Number']]='120px'
diff --git a/payroll/search_criteria/employee_details1/employee_details1.txt b/payroll/search_criteria/employee_details1/employee_details1.txt
new file mode 100644
index 0000000..20e384c
--- /dev/null
+++ b/payroll/search_criteria/employee_details1/employee_details1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Code,Employee\x01Employee Number,Employee\x01Gender,Employee\x01Employment Type,Employee\x01Date of Joining,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Company Email,Employee\x01Relieving Date',
+		'creation': '2010-12-14 17:56:47',
+		'criteria_name': 'Employee Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-01 14:27:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_details1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_details2/__init__.py b/payroll/search_criteria/employee_details2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_details2/__init__.py
diff --git a/payroll/search_criteria/employee_details2/employee_details2.js b/payroll/search_criteria/employee_details2/employee_details2.js
new file mode 100644
index 0000000..5e4b42e
--- /dev/null
+++ b/payroll/search_criteria/employee_details2/employee_details2.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Department'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'ID'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_details2/employee_details2.py b/payroll/search_criteria/employee_details2/employee_details2.py
new file mode 100644
index 0000000..084eb91
--- /dev/null
+++ b/payroll/search_criteria/employee_details2/employee_details2.py
@@ -0,0 +1,13 @@
+colwidths[col_idx['ID']]='120px'
+colwidths[col_idx['Employee Name']]='150px' 
+colwidths[col_idx['Department']] = '150px'
+colwidths[col_idx['Designation']]='120px' 
+colwidths[col_idx['Branch']] ='120px'
+colwidths[col_idx['Company Email']]='170px' 
+colwidths[col_idx['Relieving Date']]='120px' 
+colwidths[col_idx['Employment Type']]='120px' 
+colwidths[col_idx['Date of Joining']]='120px'
+colwidths[col_idx['Scheduled Confirmation Date']]='150px' 
+colwidths[col_idx['Contract End Date']]='120px'
+colwidths[col_idx['Employee Code']]='120px' 
+colwidths[col_idx['Employee Number']]='120px'
diff --git a/payroll/search_criteria/employee_details2/employee_details2.txt b/payroll/search_criteria/employee_details2/employee_details2.txt
new file mode 100644
index 0000000..ec62c91
--- /dev/null
+++ b/payroll/search_criteria/employee_details2/employee_details2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Code,Employee\x01Employee Number,Employee\x01Gender,Employee\x01Employment Type,Employee\x01Date of Joining,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Company Email,Employee\x01Relieving Date',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Employee Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-01 14:27:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_details2',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_in_company_experience/__init__.py b/payroll/search_criteria/employee_in_company_experience/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_in_company_experience/__init__.py
diff --git a/payroll/search_criteria/employee_in_company_experience/employee_in_company_experience.txt b/payroll/search_criteria/employee_in_company_experience/employee_in_company_experience.txt
new file mode 100644
index 0000000..f3e1b48
--- /dev/null
+++ b/payroll/search_criteria/employee_in_company_experience/employee_in_company_experience.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee Profile\x01Employee,Experience In Company Detail\x01Branch,Experience In Company Detail\x01Department,Experience In Company Detail\x01Designation,Experience In Company Detail\x01Grade,Experience In Company Detail\x01From Date,Experience In Company Detail\x01To Date',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Employee In Company Experience',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Experience In Company Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': '{}',
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-01 14:27:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_in_company_experience',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Employee Profile',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': '',
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_in_company_experience1/__init__.py b/payroll/search_criteria/employee_in_company_experience1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_in_company_experience1/__init__.py
diff --git a/payroll/search_criteria/employee_in_company_experience1/employee_in_company_experience1.txt b/payroll/search_criteria/employee_in_company_experience1/employee_in_company_experience1.txt
new file mode 100644
index 0000000..76f6cd6
--- /dev/null
+++ b/payroll/search_criteria/employee_in_company_experience1/employee_in_company_experience1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee Profile\x01Employee,Experience In Company Detail\x01Branch,Experience In Company Detail\x01Department,Experience In Company Detail\x01Designation,Experience In Company Detail\x01Grade,Experience In Company Detail\x01From Date,Experience In Company Detail\x01To Date',
+		'creation': '2010-12-14 17:56:47',
+		'criteria_name': 'Employee In Company Experience',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Experience In Company Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': '{}',
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-01 14:27:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_in_company_experience1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Employee Profile',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': '',
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_in_company_experience2/__init__.py b/payroll/search_criteria/employee_in_company_experience2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_in_company_experience2/__init__.py
diff --git a/payroll/search_criteria/employee_in_company_experience2/employee_in_company_experience2.txt b/payroll/search_criteria/employee_in_company_experience2/employee_in_company_experience2.txt
new file mode 100644
index 0000000..69ad92d
--- /dev/null
+++ b/payroll/search_criteria/employee_in_company_experience2/employee_in_company_experience2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee Profile\x01Employee,Experience In Company Detail\x01Branch,Experience In Company Detail\x01Department,Experience In Company Detail\x01Designation,Experience In Company Detail\x01Grade,Experience In Company Detail\x01From Date,Experience In Company Detail\x01To Date',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Employee In Company Experience',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 1,
+		'doc_type': 'Experience In Company Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': '{}',
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-01 14:27:15',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_in_company_experience2',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Employee Profile',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_information/__init__.py b/payroll/search_criteria/employee_information/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employee_information/__init__.py
diff --git a/payroll/search_criteria/employee_information/employee_information.py b/payroll/search_criteria/employee_information/employee_information.py
new file mode 100644
index 0000000..74f8282
--- /dev/null
+++ b/payroll/search_criteria/employee_information/employee_information.py
@@ -0,0 +1,6 @@
+for c in range(0,len(colnames)):
+  l = (len(colnames[c])*9) 
+  if l < 150 : col_width = '150px'
+  else:  col_width = '%spx'%(l)
+
+  colwidths[c] = col_width
\ No newline at end of file
diff --git a/payroll/search_criteria/employee_information/employee_information.txt b/payroll/search_criteria/employee_information/employee_information.txt
new file mode 100644
index 0000000..5a96aed
--- /dev/null
+++ b/payroll/search_criteria/employee_information/employee_information.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Number,Employee\x01Date of Joining,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Employment Type,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Reports to,Employee\x01Email (By company),Employee\x01Bank Name,Employee\x01Relieving Date',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Employee Information',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-26 12:03:08',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employee_information',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabEmployee`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employees_birthday/__init__.py b/payroll/search_criteria/employees_birthday/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employees_birthday/__init__.py
diff --git a/payroll/search_criteria/employees_birthday/employees_birthday.txt b/payroll/search_criteria/employees_birthday/employees_birthday.txt
new file mode 100644
index 0000000..30932b9
--- /dev/null
+++ b/payroll/search_criteria/employees_birthday/employees_birthday.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Department,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Month of Birth',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': "Employee's Birthday",
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Saved':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'May','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-04 13:15:28',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employees_birthday',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabEmployee`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employees_birthday1/__init__.py b/payroll/search_criteria/employees_birthday1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employees_birthday1/__init__.py
diff --git a/payroll/search_criteria/employees_birthday1/employees_birthday1.js b/payroll/search_criteria/employees_birthday1/employees_birthday1.js
new file mode 100644
index 0000000..87e77c1
--- /dev/null
+++ b/payroll/search_criteria/employees_birthday1/employees_birthday1.js
@@ -0,0 +1,6 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Employee'+FILTER_SEP +'From Date of Birth'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'To Date of Birth'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Month of Birth'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Department'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/employees_birthday1/employees_birthday1.py b/payroll/search_criteria/employees_birthday1/employees_birthday1.py
new file mode 100644
index 0000000..8886a7e
--- /dev/null
+++ b/payroll/search_criteria/employees_birthday1/employees_birthday1.py
@@ -0,0 +1,7 @@
+colwidths[col_idx['ID']]='120px'
+colwidths[col_idx['Employee Name']]='150px' 
+colwidths[col_idx['Department']] = '150px'
+#colwidths[col_idx['Employee Code']]='120px' 
+#colwidths[col_idx['Employee Number']] ='120px'
+colwidths[col_idx['Date of Birth']]='110px' 
+colwidths[col_idx['Month of Birth']]='120px' 
\ No newline at end of file
diff --git a/payroll/search_criteria/employees_birthday1/employees_birthday1.txt b/payroll/search_criteria/employees_birthday1/employees_birthday1.txt
new file mode 100644
index 0000000..ded40e2
--- /dev/null
+++ b/payroll/search_criteria/employees_birthday1/employees_birthday1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Department,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Month of Birth',
+		'creation': '2010-12-14 17:56:47',
+		'criteria_name': "Employee's Birthday",
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Saved':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'May','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-04 13:15:28',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employees_birthday1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabEmployee`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employeewise_balance_leave_report/__init__.py b/payroll/search_criteria/employeewise_balance_leave_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employeewise_balance_leave_report/__init__.py
diff --git a/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js b/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js
new file mode 100644
index 0000000..2439ffa
--- /dev/null
+++ b/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js
@@ -0,0 +1,3 @@
+this.mytabs.items['Select Columns'].hide();
+
+this.mytabs.tabs['More Filters'].hide();
\ No newline at end of file
diff --git a/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py b/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py
new file mode 100644
index 0000000..c258d15
--- /dev/null
+++ b/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py
@@ -0,0 +1,20 @@
+leave_types = sql("select name from `tabLeave Type` where docstatus != 2 and name not in ('Compensatory Off','Leave Without Pay')")
+msgprint(leave_types)
+col=[]
+  
+for e in leave_types:
+  l = (len(e)*9) 
+  if l < 150 : col_width = '150px'
+  else:  col_width = '%spx'%(l)
+  
+  col.append([e,'Currency',col_width,''])
+
+
+col.append(['Total Balance','Currency','150px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)
diff --git a/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt b/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt
new file mode 100644
index 0000000..4f8d503
--- /dev/null
+++ b/payroll/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Employeewise Balance Leave Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':'Active'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-12-01 10:39:56',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employeewise_balance_leave_report',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 100,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabEmployee`.`name`',
+		'sort_order': 'ASC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/employeewise_leave_transaction_details/__init__.py b/payroll/search_criteria/employeewise_leave_transaction_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/employeewise_leave_transaction_details/__init__.py
diff --git a/payroll/search_criteria/employeewise_leave_transaction_details/employeewise_leave_transaction_details.txt b/payroll/search_criteria/employeewise_leave_transaction_details/employeewise_leave_transaction_details.txt
new file mode 100644
index 0000000..67672d6
--- /dev/null
+++ b/payroll/search_criteria/employeewise_leave_transaction_details/employeewise_leave_transaction_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Leave Transaction\x01ID,Leave Transaction\x01Fiscal Year,Leave Transaction\x01Employee,Leave Transaction\x01Leave Type,Leave Transaction\x01Previous Balance,Leave Transaction\x01Leave Transaction Type,Leave Transaction\x01Allocation Type,Leave Transaction\x01Deduction Type,Leave Transaction\x01Half Day,Leave Transaction\x01From Date,Leave Transaction\x01To Date,Leave Transaction\x01Encashment Date,Leave Transaction\x01Total Leave Days,Leave Transaction\x01Status',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Employeewise Leave Transaction Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Leave Transaction',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Leave Transaction\x01Saved':1,'Leave Transaction\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-04 08:56:43',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'employeewise_leave_transaction_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabLeave Transaction`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/expense_vouchers/__init__.py b/payroll/search_criteria/expense_vouchers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/expense_vouchers/__init__.py
diff --git a/payroll/search_criteria/expense_vouchers/expense_vouchers.txt b/payroll/search_criteria/expense_vouchers/expense_vouchers.txt
new file mode 100644
index 0000000..ffc57cb
--- /dev/null
+++ b/payroll/search_criteria/expense_vouchers/expense_vouchers.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Expense Voucher\x01ID,Expense Voucher\x01Approval Status,Expense Voucher\x01From Employee,Expense Voucher\x01Employee Name,Expense Voucher\x01Approver,Expense Voucher\x01Posting Date,Expense Voucher\x01Total Claimed Amount,Expense Voucher\x01Total Sanctioned Amount',
+		'creation': '2010-09-03 16:45:06',
+		'criteria_name': 'Expense Vouchers',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Expense Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Expense Voucher\x01Saved':1,'Expense Voucher\x01Submitted':1,'Expense Voucher\x01Approval Status':'','Expense Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-02 11:05:37',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'expense_vouchers',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabExpense Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/installed_items/__init__.py b/payroll/search_criteria/installed_items/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/installed_items/__init__.py
diff --git a/payroll/search_criteria/installed_items/installed_items.js b/payroll/search_criteria/installed_items/installed_items.js
new file mode 100644
index 0000000..b6f838e
--- /dev/null
+++ b/payroll/search_criteria/installed_items/installed_items.js
@@ -0,0 +1,5 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'ID'].df.in_first_page = 1;
+  this.filter_fields_dict['Serial No'+FILTER_SEP +'Status'].df.filter_hide = 1;
+}
+this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/payroll/search_criteria/installed_items/installed_items.txt b/payroll/search_criteria/installed_items/installed_items.txt
new file mode 100644
index 0000000..1ee04e5
--- /dev/null
+++ b/payroll/search_criteria/installed_items/installed_items.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "`tabSerial No`.status = 'Installed'",
+		'add_tab': None,
+		'columns': 'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Item Group,Serial No\x01Warranty Period (Days),Serial No\x01Warranty Expiry Date,Serial No\x01AMC Expiry Date,Serial No\x01Maintenance Status,Serial No\x01Delivery Note No,Serial No\x01Customer Name',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Installed Items',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Serial No',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'','Serial No\x01Maintenance Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-01 14:19:22',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'installed_items',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSerial No`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_attendance_details/__init__.py b/payroll/search_criteria/monthly_attendance_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/monthly_attendance_details/__init__.py
diff --git a/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.js b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.js
new file mode 100644
index 0000000..bb74506
--- /dev/null
+++ b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.js
@@ -0,0 +1,29 @@
+var get_month = function(){
+
+  var dict = {0:'Jan', 1:'Feb',2:'Mar',3:'Apr',4:'May',5:'June',6:'July',7:'Aug',8:'Sept',9:'Oct',10:'Nov',11:'Dec'}
+  var d = new Date();
+  return dict[d.getMonth()]
+
+}
+
+report.customize_filters = function() {
+  this.hide_all_filters();
+  this.add_filter({fieldname:'month', label:'Month', fieldtype:'Select', options:'Jan'+NEWLINE+'Feb'+NEWLINE+'Mar'+NEWLINE+'Apr'+NEWLINE+'May'+NEWLINE+'June'+NEWLINE+'July'+NEWLINE+'Aug'+NEWLINE+'Sept'+NEWLINE+'Oct'+NEWLINE+'Nov'+NEWLINE+'Dec',ignore : 1,parent:'Attendance', single_select:1});
+  
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Employee'].df.filter_hide = 0;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df.filter_hide = 0;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Employee'].df.in_first_page = 1;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df.in_first_page = 1;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df.in_first_page = 1;
+  
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df['report_default'] = get_month();
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+  this.get_filter('Attendance', 'Fiscal Year').set_as_single();
+}
+this.mytabs.items['More Filters'].hide();
+this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.py b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.py
new file mode 100644
index 0000000..55fdef0
--- /dev/null
+++ b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.py
@@ -0,0 +1,76 @@
+#add column employee, employee name
+#--------------------------------------------------------------------------------------
+col =[['Employee','Link','155px','Employee'],['Employee Name','Data','150px','']]
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  
+  col_idx[c[0]] = len(colnames)-1
+
+
+#get feb months last day
+#--------------------------------------------------------------------------------------
+fy = filter_values.get('fiscal_year')
+month = filter_values.get('month')
+mdict = {'Jan':'01', 'Feb':'02','Mar':'03','Apr':'04','May':'05','June':'06','July':'07','Aug':'08','Sept':'09','Oct':'10','Nov':'11','Dec':'12'}
+
+import webnotes.utils
+from dateutil.relativedelta import relativedelta
+
+ysd = sql("select year_start_date from `tabFiscal Year` where name = '%s' and docstatus !=2"%fy)[0][0]
+
+last_date = webnotes.utils.get_last_day(ysd + relativedelta(months = (cint(ysd.strftime('%m'))>cint(mdict[month]) and (12-cint(ysd.strftime('%m'))+cint(mdict[month])) or (cint(mdict[month]) - cint(ysd.strftime('%m'))))))
+feb = last_date.strftime('%d')
+
+
+
+#get last day and add columns
+#--------------------------------------------------------------------------------------
+dict = {'Jan': 31,'Feb':cint(feb), 'Mar':31,'Apr':30,'May':31,'June':30,'July':31,'Aug':31,'Sept':30,'Oct':31,'Nov':30,'Dec':31}
+
+for i in range(0,dict[month]):
+  colnames.append(i+1)
+  coltypes.append('Data')
+  colwidths.append('25px')
+  
+  col_idx[c[0]] = len(colnames)-1
+  
+#add total present, absent days  
+#--------------------------------------------------------------------------------------
+tot_col =[['Total Present Days','Data','120px'],['Total Absent Days','Data','120px']]
+
+for c in tot_col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+
+  col_idx[c[0]] = len(colnames)-1  
+  
+#get data
+#--------------------------------------------------------------------------------------  
+
+
+year = last_date.strftime('%Y')
+out = []
+for r in res:
+  p_cnt = a_cnt = 0
+  
+  for i in range(0,dict[month]):
+    new_date = str(year)+'-'+mdict[month]+'-'+((i>=9) and str(i+1) or ('0'+str(i+1)))
+    
+    chk = sql("select status from `tabAttendance` where employee='%s' and att_date = '%s' and docstatus=1"%(r[0],new_date))
+    chk = chk and chk[0][0][0] or '-'
+    if chk=='P':
+      p_cnt +=1
+    elif chk=='A':
+      a_cnt +=1
+    r.append(chk)
+
+  r.append(p_cnt)
+  r.append(a_cnt)
+
+  if p_cnt or a_cnt:
+    out.append(r)
diff --git a/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.sql b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.sql
new file mode 100644
index 0000000..7487fb4
--- /dev/null
+++ b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.sql
@@ -0,0 +1 @@
+SELECT DISTINCT `tabAttendance`.employee, `tabAttendance`.employee_name FROM `tabAttendance` WHERE `tabAttendance`.fiscal_year like '%(fiscal_year)s%%' AND `tabAttendance`.`company` like '%(company)s%%' AND `tabAttendance`.`employee` like '%(employee)s%%'
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.txt b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
new file mode 100644
index 0000000..5817aa9
--- /dev/null
+++ b/payroll/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Attendance\x01Employee',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Monthly Attendance Details',
+		'custom_query': None,
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Attendance',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Attendance\x01Status':'','Attendance\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-30 18:03:56',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'monthly_attendance_details',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabAttendance`.`employee`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register/__init__.py b/payroll/search_criteria/monthly_salary_register/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register/__init__.py
diff --git a/payroll/search_criteria/monthly_salary_register/monthly_salary_register.txt b/payroll/search_criteria/monthly_salary_register/monthly_salary_register.txt
new file mode 100644
index 0000000..7aa5420
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register/monthly_salary_register.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Leave Without Pay,Salary Slip\x01Arrear Amount',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Monthly Salary Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Slip',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Slip\x01Month':'','Salary Slip\x01Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-05 14:43:08',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'monthly_salary_register',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register1/__init__.py b/payroll/search_criteria/monthly_salary_register1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register1/__init__.py
diff --git a/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.js b/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.js
new file mode 100644
index 0000000..3da56bb
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Salary Slip'+FILTER_SEP +'Month'].df.in_first_page = 1;
+  this.filter_fields_dict['Salary Slip'+FILTER_SEP +'Year'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.py b/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.py
new file mode 100644
index 0000000..bbbe86f
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.py
@@ -0,0 +1,98 @@
+colwidths[col_idx['Employee Name']]="120px" 
+colwidths[col_idx['Leave Without Pay']] = '120px'
+
+sum_net = total_earning = total_deduction = total_lwp = total_arr = 0
+total = ['Total Net Pay','','']
+
+
+earn_type_lst = sql("select name from `tabEarning Type`")
+
+ded_type_lst = sql("select name from `tabDeduction Type`")
+li=[]
+for lst in earn_type_lst:
+  
+  li.append(lst[0])
+  
+  
+
+li.append('Total Earning')
+for lst in ded_type_lst:
+  
+  li.append(lst[0])
+  
+
+li.append('Total Deduction')
+li.append('Net Pay')
+
+
+
+for d in li:
+  colnames.append(d)
+  colwidths.append("150px")
+  coltypes.append("Currency")
+  coloptions.append("")
+  col_idx[d] = len(colnames)-1
+  for r in res:
+    r.append("0")
+
+for r in res:
+  
+  total_lwp += r[col_idx['Leave Without Pay']]
+  total_arr += r[col_idx['Arrear Amount']]
+  
+  for d1 in li:
+    d2 = '%s'%d1
+    
+    earn_ret=convert_to_lists(sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%r[col_idx['ID']]))
+    ded_ret=convert_to_lists(sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%r[col_idx['ID']]))
+    
+
+    for e in earn_ret:
+      e0 = '%s'%e[0]
+      r[col_idx[e0]]=flt(e[1]) or 0.00
+     
+    
+    for d in ded_ret:
+      d0 = '%s'%d[0]
+      r[col_idx[d0]]=flt(d[1]) or 0.00
+      
+        
+    tot_earn_ded_net_ret = sql("select gross_pay, total_deduction,net_pay from `tabSalary Slip` where name = '%s'"%r[col_idx['ID']])
+    if d2 == 'Total Earning':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][0]) or 0
+      total_earning += flt(tot_earn_ded_net_ret[0][0]) or 0
+    elif d2 == 'Total Deduction':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][1]) or 0
+      total_deduction += flt(tot_earn_ded_net_ret[0][1]) or 0
+    elif d2 == 'Net Pay':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][2]) or 0
+      sum_net += flt(tot_earn_ded_net_ret[0][2]) or 0
+ 
+ 
+total.append(total_lwp)
+total.append(total_arr)
+
+for lst in earn_type_lst:
+  
+  total_ear = 0
+  for r in res:
+   
+    lst0 = '%s'%lst[0]
+    total_ear += r[col_idx[lst0]]
+    
+  total.append(total_ear) 
+  
+total.append(total_earning)
+for lst in ded_type_lst:
+  total_ded = 0
+  for r in res:
+    lst0 = '%s'%lst[0]
+    total_ded += r[col_idx[lst0]]
+    
+  total.append(total_ded) 
+
+
+total.append(total_deduction)
+total.append(sum_net)
+
+res.append(total)
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.txt b/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.txt
new file mode 100644
index 0000000..8453b4e
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register1/monthly_salary_register1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Leave Without Pay,Salary Slip\x01Arrear Amount',
+		'creation': '2010-12-14 17:56:47',
+		'criteria_name': 'Monthly Salary Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Slip',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Slip\x01Month':'','Salary Slip\x01Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-05 14:43:08',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'monthly_salary_register1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register2/__init__.py b/payroll/search_criteria/monthly_salary_register2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register2/__init__.py
diff --git a/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.js b/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.js
new file mode 100644
index 0000000..3da56bb
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Salary Slip'+FILTER_SEP +'Month'].df.in_first_page = 1;
+  this.filter_fields_dict['Salary Slip'+FILTER_SEP +'Year'].df.in_first_page = 1;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.py b/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.py
new file mode 100644
index 0000000..bbbe86f
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.py
@@ -0,0 +1,98 @@
+colwidths[col_idx['Employee Name']]="120px" 
+colwidths[col_idx['Leave Without Pay']] = '120px'
+
+sum_net = total_earning = total_deduction = total_lwp = total_arr = 0
+total = ['Total Net Pay','','']
+
+
+earn_type_lst = sql("select name from `tabEarning Type`")
+
+ded_type_lst = sql("select name from `tabDeduction Type`")
+li=[]
+for lst in earn_type_lst:
+  
+  li.append(lst[0])
+  
+  
+
+li.append('Total Earning')
+for lst in ded_type_lst:
+  
+  li.append(lst[0])
+  
+
+li.append('Total Deduction')
+li.append('Net Pay')
+
+
+
+for d in li:
+  colnames.append(d)
+  colwidths.append("150px")
+  coltypes.append("Currency")
+  coloptions.append("")
+  col_idx[d] = len(colnames)-1
+  for r in res:
+    r.append("0")
+
+for r in res:
+  
+  total_lwp += r[col_idx['Leave Without Pay']]
+  total_arr += r[col_idx['Arrear Amount']]
+  
+  for d1 in li:
+    d2 = '%s'%d1
+    
+    earn_ret=convert_to_lists(sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%r[col_idx['ID']]))
+    ded_ret=convert_to_lists(sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%r[col_idx['ID']]))
+    
+
+    for e in earn_ret:
+      e0 = '%s'%e[0]
+      r[col_idx[e0]]=flt(e[1]) or 0.00
+     
+    
+    for d in ded_ret:
+      d0 = '%s'%d[0]
+      r[col_idx[d0]]=flt(d[1]) or 0.00
+      
+        
+    tot_earn_ded_net_ret = sql("select gross_pay, total_deduction,net_pay from `tabSalary Slip` where name = '%s'"%r[col_idx['ID']])
+    if d2 == 'Total Earning':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][0]) or 0
+      total_earning += flt(tot_earn_ded_net_ret[0][0]) or 0
+    elif d2 == 'Total Deduction':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][1]) or 0
+      total_deduction += flt(tot_earn_ded_net_ret[0][1]) or 0
+    elif d2 == 'Net Pay':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][2]) or 0
+      sum_net += flt(tot_earn_ded_net_ret[0][2]) or 0
+ 
+ 
+total.append(total_lwp)
+total.append(total_arr)
+
+for lst in earn_type_lst:
+  
+  total_ear = 0
+  for r in res:
+   
+    lst0 = '%s'%lst[0]
+    total_ear += r[col_idx[lst0]]
+    
+  total.append(total_ear) 
+  
+total.append(total_earning)
+for lst in ded_type_lst:
+  total_ded = 0
+  for r in res:
+    lst0 = '%s'%lst[0]
+    total_ded += r[col_idx[lst0]]
+    
+  total.append(total_ded) 
+
+
+total.append(total_deduction)
+total.append(sum_net)
+
+res.append(total)
\ No newline at end of file
diff --git a/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.txt b/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.txt
new file mode 100644
index 0000000..60fb286
--- /dev/null
+++ b/payroll/search_criteria/monthly_salary_register2/monthly_salary_register2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Leave Without Pay,Salary Slip\x01Arrear Amount',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Monthly Salary Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Slip',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Slip\x01Month':'','Salary Slip\x01Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-04-05 14:43:08',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'monthly_salary_register2',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': 'ID',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/new_or_left_employees_for_a_month/__init__.py b/payroll/search_criteria/new_or_left_employees_for_a_month/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/new_or_left_employees_for_a_month/__init__.py
diff --git a/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.js b/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.js
new file mode 100644
index 0000000..ee61977
--- /dev/null
+++ b/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.js
@@ -0,0 +1,50 @@
+report.customize_filters = function() {
+  var d = new Date();
+  
+  var month=["January","February","March","April","May","June","July","August","September","October","November","December"]
+  
+  this.add_filter({fieldname:'month', label:'Month',fieldtype:'Select', options:"January"+NEWLINE+"February"+NEWLINE+"March"+NEWLINE+"April"+NEWLINE+"May"+NEWLINE+"June"+NEWLINE+"July"+NEWLINE+"August"+NEWLINE+"September"+NEWLINE+"October"+NEWLINE+"November"+NEWLINE+"December",report_default : month[d.getMonth()],ignore : 1, parent:'Employee'});
+  
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Month'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Status'].df.in_first_page = 1;
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Status'].df.report_default = 'Active';
+  
+  this.add_filter({fieldname:'year', label:'Year',fieldtype:'Select', options:"2000"+NEWLINE+"2001"+NEWLINE+"2002"+NEWLINE+"2003"+NEWLINE+"2004"+NEWLINE+"2005"+NEWLINE+"2006"+NEWLINE+"2007"+NEWLINE+"2008"+NEWLINE+"2009"+NEWLINE+"2010"+NEWLINE+"2011",report_default : d.getFullYear(),ignore : 1, parent:'Employee'});
+  
+  this.filter_fields_dict['Employee'+FILTER_SEP +'Year'].df.in_first_page = 1;
+}
+
+report.get_query = function() {
+
+  emp_month = this.filter_fields_dict['Employee'+FILTER_SEP+'Month'].get_value();
+  emp_year = this.filter_fields_dict['Employee'+FILTER_SEP+'Year'].get_value();
+  emp_status = this.filter_fields_dict['Employee'+FILTER_SEP+'Status'].get_value();
+
+  // month and year mandatory
+  if ((emp_month == '') || (emp_year == '')) {
+    alert("Please enter Month and Year");
+    return;
+  }
+
+  month={"January":"1", "February":"2", "March":"3", "April":"4","May":"5", "June":"6", "July":"7","August":"8", "September":"9", "October":"10", "November":"11", "December":"12"}
+  
+  mnt = ''
+  for(m=0; m<emp_month.length;m++){
+    if(mnt== '') mnt = "("+month[emp_month[m]];
+    else mnt +=", "+month[emp_month[m]]; 
+  }
+  mnt +=")"
+  c1 = '(MONTH(t1.date_of_joining) in '+mnt+' AND YEAR(t1.date_of_joining) = "'+emp_year+'")';
+  c2 = '(MONTH(t1.relieving_date) in '+mnt+' AND YEAR(t1.relieving_date) = "'+emp_year+'")';
+
+  if(emp_status == 'Active')
+    cond = c1;  
+  else if (emp_status == 'Left')
+    cond = c2;
+  else
+    cond = c1 + ' OR '+c2;
+  
+  var q = 'SELECT t1.name AS "ID", t1.employee_name AS "Employee Name", t1.employee_number AS "Employee Number" FROM `tabEmployee` t1 WHERE '+cond;
+
+  return q;
+}
diff --git a/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py b/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py
new file mode 100644
index 0000000..aae4db1
--- /dev/null
+++ b/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py
@@ -0,0 +1,43 @@
+status = filter_values.get('status')
+month = filter_values.get('month')
+
+
+if status == 'Active' and not status == 'Left':
+  col = [['Employee', 'Link', 'Employee'], ['Employee Name', 'Data', ''], ['Employee Number', 'Data', ''], ['Employment Type','Link','Employment Type'],['Scheduled Confirmation Date','Data',''],['Final Confirmation Date','Data',''],['Contract End Date','Data',''],['Branch','Link','Branch'],['Department','Link','Department'],['Designation','Link','Designation'],['Reports to','Link','Employee'],['Grade','Link','Grade']]
+
+elif status == 'Left' and not status == 'Active':
+  col = [['Employee', 'Link', 'Employee'], ['Employee Name', 'Data', ''], ['Employee Number', 'Data', ''], ['Resignation Letter Date','Data',''],['Relieving Date','Data',''],['Notice - Number of Days','Data',''],['Reason for Leaving','Data',''],['Leave Encashed?','Data',''],['Encashment Date','Data',''],['Reason for Resignation','Data','']]
+
+else:
+  col = [['Employee', 'Link', 'Employee'], ['Employee Name', 'Data', ''], ['Employee Number', 'Data', ''], ['Employment Type','Link','Employment Type'],['Scheduled Confirmation Date','Data',''],['Final Confirmation Date','Data',''],['Contract End Date','Data',''],['Branch','Link','Branch'],['Department','Link','Department'],['Designation','Link','Designation'],['Reports to','Link','Employee'],['Grade','Link','Grade'],['Resignation Letter Date','Data',''],['Relieving Date','Data',''],['Notice - Number of Days','Data',''],['Reason for Leaving','Data',''],['Leave Encashed?','Data',''],['Encashment Date','Data',''],['Reason for Resignation','Data','']]
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append('150px')
+  coloptions.append(c[2])
+  
+  col_idx[c[0]] = len(colnames)-1
+
+
+for c in range(0,len(colnames)):
+  l = (len(colnames[c])*9) 
+  if l < 150 : col_width = '150px'
+  else:  col_width = '%spx'%(l)
+
+  colwidths[c] = col_width
+
+for r in res:
+
+  if status == 'Active':
+    ret = sql("select employment_type,scheduled_confirmation_date,final_confirmation_date,contract_end_date,branch,department,designation,reports_to,grade from `tabEmployee` where name = %s",r[0])
+
+  elif status == 'Left':
+    ret = sql("select resignation_letter_date,relieving_date,notice_number_of_days,reason_for_leaving,leave_encashed,encashment_date,reason_for_resignation from `tabEmployee` where name =%s",r[0])
+
+  else:
+    ret = sql("select employment_type,scheduled_confirmation_date,final_confirmation_date,contract_end_date,branch,department,designation,reports_to,grade,resignation_letter_date,relieving_date,notice_number_of_days,reason_for_leaving,leave_encashed,encashment_date,reason_for_resignation from `tabEmployee` where name = %s",r[0])
+
+  ret = ret and ret[0] or []
+  for t in ret:
+    r.append(cstr(t))
diff --git a/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt b/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
new file mode 100644
index 0000000..6074220
--- /dev/null
+++ b/payroll/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Employee\x01ID',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'New or left employees for a month',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Employee',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-12-01 09:54:34',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'new_or_left_employees_for_a_month',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabEmployee`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/pending_appraisals/__init__.py b/payroll/search_criteria/pending_appraisals/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/pending_appraisals/__init__.py
diff --git a/payroll/search_criteria/pending_appraisals/pending_appraisals.js b/payroll/search_criteria/pending_appraisals/pending_appraisals.js
new file mode 100644
index 0000000..4b5adec
--- /dev/null
+++ b/payroll/search_criteria/pending_appraisals/pending_appraisals.js
@@ -0,0 +1,41 @@
+report.customize_filters = function() {
+  this.hide_all_filters();  
+  
+  this.add_filter({fieldname:'approver', label:'Approver', fieldtype:'Link', options:'Profile', ignore : 1, parent:'Appraisal'});  
+  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Approver'].df.in_first_page = 1;
+  
+  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Employee'].df.filter_hide = 0;
+  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Employee Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Appraisal'+FILTER_SEP +'From Start Date'].df.filter_hide = 0;
+  //this.filter_fields_dict['Appraisal'+FILTER_SEP +'To Start Date'].df.filter_hide = 0;
+  //this.filter_fields_dict['Appraisal'+FILTER_SEP +'From End Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Appraisal'+FILTER_SEP +'To End Date'].df.filter_hide = 0;
+}
+this.mytabs.items['Select Columns'].hide();
+
+report.get_query = function(){
+  //get filter values
+  emp = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Employee'].get_value(); 
+  emp_nm = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Employee Name'].get_value(); 
+  frm_start_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'From Start Date'].get_value(); 
+  //to_start_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'To Start Date'].get_value(); 
+  //frm_end_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'From End Date'].get_value(); 
+  to_end_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'To End Date'].get_value(); 
+  fiscal_year = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Fiscal Year'].get_value();
+  approver = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Approver'].get_value();
+  
+  var cond = '';
+  if(emp) cond += ' AND `tabAppraisal`.employee = "'+emp+'"';
+  if(emp_nm) cond += ' AND `tabAppraisal`.employee_name = "'+emp_nm+'"';
+  if(frm_start_date) cond += ' AND `tabAppraisal`.start_date >= "'+frm_start_date+'"';
+  //if(to_start_date) cond += ' AND `tabAppraisal`.start_date <= "'+to_start_date+'"';
+  //if(frm_end_date) cond += ' AND `tabAppraisal`.end_date >= "'+frm_end_date+'"';
+  if(to_end_date) cond += ' AND `tabAppraisal`.end_date <= "'+to_end_date+'"';
+  if(fiscal_year !='') cond += ' AND `tabAppraisal`.fiscal_year = "'+fiscal_year+'"';
+  if(approver) cond += ' AND `tabAppraisal`.kra_approver = "'+approver+'"';
+
+  //var q = 'SELECT DISTINCT `tabAppraisal`.name, `tabAppraisal`.status, `tabAppraisal`.employee, `tabAppraisal`.employee_name, `tabAppraisal`.start_date,`tabAppraisal`.end_date,`tabAppraisal`.kra_approver, `tabAppraisal`.total_score FROM `tabAppraisal` WHERE `tabAppraisal`.status= "Submitted" AND `tabAppraisal`.kra_approver = "'+ user+'"'+cond;  
+  var q = 'SELECT DISTINCT `tabAppraisal`.name, `tabAppraisal`.employee, `tabAppraisal`.employee_name, `tabAppraisal`.start_date,`tabAppraisal`.end_date,`tabAppraisal`.kra_approver, `tabAppraisal`.total_score FROM `tabAppraisal` WHERE `tabAppraisal`.status= "Submitted"'+cond;  
+  return q;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/pending_appraisals/pending_appraisals.txt b/payroll/search_criteria/pending_appraisals/pending_appraisals.txt
new file mode 100644
index 0000000..f732974
--- /dev/null
+++ b/payroll/search_criteria/pending_appraisals/pending_appraisals.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '',
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Pending Appraisals',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': 0,
+		'doc_type': 'Appraisal',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Appraisal\x01Submitted':1,'Appraisal\x01Status':'Submitted','Appraisal\x01Fiscal Year':'','Appraisal\x01Approver':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-01 14:19:02',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'pending_appraisals',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabAppraisal`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/pending_expense_vouchers/__init__.py b/payroll/search_criteria/pending_expense_vouchers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/pending_expense_vouchers/__init__.py
diff --git a/payroll/search_criteria/pending_expense_vouchers/pending_expense_vouchers.js b/payroll/search_criteria/pending_expense_vouchers/pending_expense_vouchers.js
new file mode 100644
index 0000000..d4c0398
--- /dev/null
+++ b/payroll/search_criteria/pending_expense_vouchers/pending_expense_vouchers.js
@@ -0,0 +1,37 @@
+report.customize_filters = function() {
+  this.hide_all_filters();  
+  
+  this.add_filter({fieldname:'approver', label:'Approver', fieldtype:'Link', options:'Profile', ignore : 1, parent:'Expense Voucher'});  
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Approver'].df.in_first_page = 1;
+  
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'From Employee'].df.filter_hide = 0;
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Employee Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+}
+this.mytabs.items['Select Columns'].hide();
+
+report.get_query = function(){
+  //get filter values
+  emp = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'From Employee'].get_value(); 
+  emp_nm = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Employee Name'].get_value(); 
+  frm_start_date = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'From Posting Date'].get_value(); 
+  to_end_date = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'To Posting Date'].get_value(); 
+  fiscal_year = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Fiscal Year'].get_value();
+  approver = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Approver'].get_value();
+  company = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Company'].get_value();
+  
+  var cond = '';
+  if(emp) cond += ' AND `tabExpense Voucher`.employee = "'+emp+'"';
+  if(emp_nm) cond += ' AND `tabExpense Voucher`.employee_name = "'+emp_nm+'"';
+  if(frm_start_date) cond += ' AND `tabExpense Voucher`.posting_date >= "'+frm_start_date+'"';
+  if(to_end_date) cond += ' AND `tabExpense Voucher`.posting_date <= "'+to_end_date+'"';
+  if(fiscal_year !='') cond += ' AND `tabExpense Voucher`.fiscal_year = "'+fiscal_year+'"';
+  if(approver) cond += ' AND `tabExpense Voucher`.exp_approver = "'+approver+'"';
+  if(company) cond += ' AND `tabExpense Voucher`.company = "'+company+'"';
+
+  var q = 'SELECT DISTINCT `tabExpense Voucher`.name, `tabExpense Voucher`.employee, `tabExpense Voucher`.employee_name, `tabExpense Voucher`.posting_date,`tabExpense Voucher`.exp_approver, `tabExpense Voucher`.total_claimed_amount, `tabExpense Voucher`.total_sanctioned_amount FROM `tabExpense Voucher` WHERE `tabExpense Voucher`.approval_status= "Submitted"'+cond;  
+  return q;
+}
\ No newline at end of file
diff --git a/payroll/search_criteria/pending_expense_vouchers/pending_expense_vouchers.txt b/payroll/search_criteria/pending_expense_vouchers/pending_expense_vouchers.txt
new file mode 100644
index 0000000..2a4c809
--- /dev/null
+++ b/payroll/search_criteria/pending_expense_vouchers/pending_expense_vouchers.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-09-03 16:45:06',
+		'criteria_name': 'Pending Expense Vouchers',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Expense Voucher',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Expense Voucher\x01Approval Status':'','Expense Voucher\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-09-02 11:04:41',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'pending_expense_vouchers',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_register/__init__.py b/payroll/search_criteria/salary_register/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/salary_register/__init__.py
diff --git a/payroll/search_criteria/salary_register/salary_register.js b/payroll/search_criteria/salary_register/salary_register.js
new file mode 100644
index 0000000..4119944
--- /dev/null
+++ b/payroll/search_criteria/salary_register/salary_register.js
@@ -0,0 +1,9 @@
+report.customize_filters = function() {
+  fld_lst = ['ID','Employee']
+
+  for(var i = 0; i<fld_lst.length; i++){
+    this.filter_fields_dict['Salary Slip'+FILTER_SEP +fld_lst[i]].df.in_first_page = 1;
+  }
+  
+}
+this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_register/salary_register.py b/payroll/search_criteria/salary_register/salary_register.py
new file mode 100644
index 0000000..049708a
--- /dev/null
+++ b/payroll/search_criteria/salary_register/salary_register.py
@@ -0,0 +1,62 @@
+sal_slips_ids = ''
+for r in res:
+  if not sal_slips_ids == '': sal_slips_ids +=","
+  sal_slips_ids+="'%s'"%r[col_idx['ID']]
+
+earn_heads =[i[0] for i in sql("select distinct e_type from `tabSS Earning Detail` where parent in (%s)"%sal_slips_ids)]
+ded_heads =[i[0] for i in sql("select distinct d_type from `tabSS Deduction Detail` where parent in (%s)"%sal_slips_ids)]
+
+col=[]
+
+for e in earn_heads:
+  l = (len(e)*9) 
+  if l < 150 :
+    col_width = '150px'
+  else:
+    col_width = '%spx'%(l)
+  col.append([e,'Currency',col_width,''])
+
+col.append(['Arrear Amount','Currency','150px',''])
+col.append(['Encashment Amount','Currency','170px',''])
+col.append(['Gross Pay','Currency','150px',''])
+
+for d in ded_heads:
+  l = (len(d)*9) 
+  if l < 150 : col_width = '150px'
+  else:  col_width = '%spx'%(l)
+  col.append([d,'Currency',col_width,''])
+
+col.append(['Total Deduction','Currency','150px',''])
+col.append(['Net Pay','Currency','150px',''])
+
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)
+
+grand_tot = 0
+for r in res:
+
+  for i in range(6,len(colnames)):
+    if colnames[i] not in ('Arrear Amount','Encashment Amount','Net Pay','Gross Pay','Total Deduction'):
+      amt = sql("select e_modified_amount from `tabSS Earning Detail` where e_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
+      if not amt:
+        amt = sql("select d_modified_amount from `tabSS Deduction Detail` where d_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
+      amt = amt and amt[0][0] or 0
+      r.append(flt(amt))
+      
+    else:
+      fld_nm = cstr(colnames[i]).lower().replace(' ','_')
+      errprint(fld_nm)
+      tot = sql("select %s from `tabSalary Slip` where name ='%s'"%(fld_nm,r[0]))
+      tot = tot and flt(tot[0][0]) or 0
+      if colnames[i] == 'Net Pay':
+        grand_tot += tot
+      r.append(tot)
+    
+gt_row = ['' for i in range(len(colnames))]
+gt_row[col_idx['Employee Name']] = '<b>Grand Totals</b>'
+gt_row[col_idx['Net Pay']-1] = fmt_money(grand_tot)
+res.append(gt_row)
diff --git a/payroll/search_criteria/salary_register/salary_register.txt b/payroll/search_criteria/salary_register/salary_register.txt
new file mode 100644
index 0000000..87a3752
--- /dev/null
+++ b/payroll/search_criteria/salary_register/salary_register.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Year,Salary Slip\x01Month,Salary Slip\x01Total days in month,Salary Slip\x01Payment days',
+		'creation': '2010-12-29 12:30:57',
+		'criteria_name': 'Salary Register',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Slip',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Slip\x01Submitted':1,'Salary Slip\x01Month':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-12-29 12:11:18',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'salary_register',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSalary Slip`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_slips/__init__.py b/payroll/search_criteria/salary_slips/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/salary_slips/__init__.py
diff --git a/payroll/search_criteria/salary_slips/salary_slips.txt b/payroll/search_criteria/salary_slips/salary_slips.txt
new file mode 100644
index 0000000..533cfe5
--- /dev/null
+++ b/payroll/search_criteria/salary_slips/salary_slips.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Slip\x01ID,Salary Slip\x01Fiscal Year,Salary Slip\x01Month,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Department,Salary Slip\x01Designation,Salary Slip\x01Branch,Salary Slip\x01Grade,Salary Slip\x01PF No.,Salary Slip\x01ESIC No.,Salary Slip\x01Leave Without Pay,Salary Slip\x01Bank Name,Salary Slip\x01Bank Account No.,Salary Slip\x01Payment days,Salary Slip\x01Arrear Amount,Salary Slip\x01Encashment Amount,Salary Slip\x01Gross Pay,Salary Slip\x01Total Deduction,Salary Slip\x01Net Pay',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Salary Slips',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Slip',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Slip\x01Saved':1,'Salary Slip\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-04 13:07:29',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'salary_slips',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': '',
+		'sort_by': '`tabSalary Slip`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_slips1/__init__.py b/payroll/search_criteria/salary_slips1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/salary_slips1/__init__.py
diff --git a/payroll/search_criteria/salary_slips1/salary_slips1.txt b/payroll/search_criteria/salary_slips1/salary_slips1.txt
new file mode 100644
index 0000000..1e1ba00
--- /dev/null
+++ b/payroll/search_criteria/salary_slips1/salary_slips1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Slip\x01ID,Salary Slip\x01Fiscal Year,Salary Slip\x01Month,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Department,Salary Slip\x01Designation,Salary Slip\x01Branch,Salary Slip\x01Grade,Salary Slip\x01PF No.,Salary Slip\x01ESIC No.,Salary Slip\x01Leave Without Pay,Salary Slip\x01Bank Name,Salary Slip\x01Bank Account No.,Salary Slip\x01Payment days,Salary Slip\x01Arrear Amount,Salary Slip\x01Encashment Amount,Salary Slip\x01Gross Pay,Salary Slip\x01Total Deduction,Salary Slip\x01Net Pay',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Salary Slips1',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Slip',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Slip\x01Saved':1,'Salary Slip\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:18:14',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'salary_slips1',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSalary Slip`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_structure_details/__init__.py b/payroll/search_criteria/salary_structure_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/salary_structure_details/__init__.py
diff --git a/payroll/search_criteria/salary_structure_details/salary_structure_details.txt b/payroll/search_criteria/salary_structure_details/salary_structure_details.txt
new file mode 100644
index 0000000..58bc406
--- /dev/null
+++ b/payroll/search_criteria/salary_structure_details/salary_structure_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Structure\x01ID,Salary Structure\x01Employee,Salary Structure\x01From Date,Salary Structure\x01To Date,Salary Structure\x01Fiscal Year,Salary Structure\x01Branch,Salary Structure\x01Designation,Salary Structure\x01Department,Salary Structure\x01Grade,Salary Structure\x01Is Active,Salary Structure\x01Total Earning,Salary Structure\x01Total Deduction,Salary Structure\x01CTC,Salary Structure\x01Total',
+		'creation': '2010-12-14 17:56:47',
+		'criteria_name': 'Salary Structure Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Structure',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Structure\x01Branch':'','Salary Structure\x01Designation':'','Salary Structure\x01Department':'','Salary Structure\x01Grade':'','Salary Structure\x01Is Active':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-04 09:19:01',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'salary_structure_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': '',
+		'sort_by': '`tabSalary Structure`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_structure_details3/__init__.py b/payroll/search_criteria/salary_structure_details3/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/salary_structure_details3/__init__.py
diff --git a/payroll/search_criteria/salary_structure_details3/salary_structure_details3.txt b/payroll/search_criteria/salary_structure_details3/salary_structure_details3.txt
new file mode 100644
index 0000000..54b064c
--- /dev/null
+++ b/payroll/search_criteria/salary_structure_details3/salary_structure_details3.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Structure\x01ID,Salary Structure\x01Employee,Salary Structure\x01From Date,Salary Structure\x01To Date,Salary Structure\x01Fiscal Year,Salary Structure\x01Branch,Salary Structure\x01Designation,Salary Structure\x01Department,Salary Structure\x01Grade,Salary Structure\x01Is Active,Salary Structure\x01Total Earning,Salary Structure\x01Total Deduction,Salary Structure\x01CTC,Salary Structure\x01Total',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Salary Structure Details3',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Structure',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Structure\x01Branch':'','Salary Structure\x01Designation':'','Salary Structure\x01Department':'','Salary Structure\x01Grade':'','Salary Structure\x01Is Active':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:17:56',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'salary_structure_details3',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSalary Structure`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/payroll/search_criteria/salary_structure_details4/__init__.py b/payroll/search_criteria/salary_structure_details4/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/payroll/search_criteria/salary_structure_details4/__init__.py
diff --git a/payroll/search_criteria/salary_structure_details4/salary_structure_details4.txt b/payroll/search_criteria/salary_structure_details4/salary_structure_details4.txt
new file mode 100644
index 0000000..17b3636
--- /dev/null
+++ b/payroll/search_criteria/salary_structure_details4/salary_structure_details4.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Salary Structure\x01ID,Salary Structure\x01Employee,Salary Structure\x01Employee Name,Salary Structure\x01Fiscal Year,Salary Structure\x01From Date,Salary Structure\x01To Date,Salary Structure\x01Branch,Salary Structure\x01Designation,Salary Structure\x01Department,Salary Structure\x01Grade,Salary Structure\x01Is Active,Salary Structure\x01CTC,Salary Structure\x01Total Earning,Salary Structure\x01Total Deduction,Salary Structure\x01Total',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Salary Structure Details4',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Salary Structure',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Salary Structure\x01Branch':'','Salary Structure\x01Designation':'','Salary Structure\x01Department':'','Salary Structure\x01Grade':'','Salary Structure\x01Is Active':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:17:49',
+		'modified_by': 'Administrator',
+		'module': 'Payroll',
+		'name': 'salary_structure_details4',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSalary Structure`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/production/Module Def/Production/Production.txt b/production/Module Def/Production/Production.txt
new file mode 100644
index 0000000..169acf5
--- /dev/null
+++ b/production/Module Def/Production/Production.txt
@@ -0,0 +1,519 @@
+[
+	{
+		'_last_update': '1300959287',
+		'creation': '2010-11-30 22:42:49',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': 'support.gif,FileData/00214',
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'module_desc': '<p>Production Documents</p>',
+		'module_icon': 'process.png',
+		'module_label': 'Production',
+		'module_name': 'Production',
+		'module_page': None,
+		'module_seq': 7,
+		'name': 'Production',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Bill of material master containing raw materials, operation and costs',
+		'display_name': 'Bill Of Materials',
+		'doc_name': 'Bill Of Materials',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\nitem\ndescription\noperating_cost\nmaintained_by',
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00209',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Machinery in warehouse where operations are performed on raw materials',
+		'display_name': 'Workstation',
+		'doc_name': 'Workstation',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\nworkstation_name\nwarehouse\ndescription',
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00210',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Explode Bill of Materials in a tree and calculate the cost',
+		'display_name': 'Bill of Materials (Tree)',
+		'doc_name': 'Bill of Materials',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00211',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Update confirmed delivery dates in Sales Orders included in Production Plan',
+		'display_name': 'Update Delivery Dates',
+		'doc_name': 'Update Delivery Date',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00212',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Plan your production by including relevant Sales Orders in your plan',
+		'display_name': 'Production Planning Tool',
+		'doc_name': 'Production Planning Tool',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00213',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Change raw materials used in a Bill of Material through BOM replace utility',
+		'display_name': 'BOM Replace Utility',
+		'doc_name': 'BOM Replace Utility',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00214',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Raise your Production Orders Manually',
+		'display_name': 'Production Order',
+		'doc_name': 'Production Order',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00215',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Reports',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003093',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Delivery Plan',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003094',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Itemwise Production Report',
+		'doc_name': 'Stock Entry Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003095',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Production Orders In Process',
+		'doc_name': 'Production Order',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003096',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Bill of material master containing raw materials, operation and costs',
+		'display_name': 'Bill Of Materials',
+		'doc_name': 'Bill Of Materials',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\nitem\ndescription\noperating_cost\nmaintained_by',
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00209',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Machinery in warehouse where operations are performed on raw materials',
+		'display_name': 'Workstation',
+		'doc_name': 'Workstation',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\nworkstation_name\nwarehouse\ndescription',
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00210',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Explode Bill of Materials in a tree and calculate the cost',
+		'display_name': 'Bill of Materials (Tree)',
+		'doc_name': 'Bill of Materials',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00211',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Update confirmed delivery dates in Sales Orders included in Production Plan',
+		'display_name': 'Update Delivery Dates',
+		'doc_name': 'Update Delivery Date',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00212',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Plan your production by including relevant Sales Orders in your plan',
+		'display_name': 'Production Planning Tool',
+		'doc_name': 'Production Planning Tool',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00213',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Change raw materials used in a Bill of Material through BOM replace utility',
+		'display_name': 'BOM Replace Utility',
+		'doc_name': 'BOM Replace Utility',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00214',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:49',
+		'description': 'Raise your Production Orders Manually',
+		'display_name': 'Production Order',
+		'doc_name': 'Production Order',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDI00215',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Reports',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003093',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Delivery Plan',
+		'doc_name': 'Sales Order Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003094',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Itemwise Production Report',
+		'doc_name': 'Stock Entry Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003095',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Production Orders In Process',
+		'doc_name': 'Production Order',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 11,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': '000003096',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Production',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 22:42:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDR00040',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Production User'
+	},
+	{
+		'creation': '2010-11-30 22:42:49',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2011-03-24 15:29:36',
+		'modified_by': 'Administrator',
+		'name': 'MDR00041',
+		'owner': 'Administrator',
+		'parent': 'Production',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Production Manager'
+	}
+]
\ No newline at end of file
diff --git a/production/__init__.py b/production/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/__init__.py
diff --git a/production/doctype/__init__.py b/production/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/__init__.py
diff --git a/production/doctype/bill_of_materials/__init__.py b/production/doctype/bill_of_materials/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bill_of_materials/__init__.py
diff --git a/production/doctype/bill_of_materials/bill_of_materials.js b/production/doctype/bill_of_materials/bill_of_materials.js
new file mode 100644
index 0000000..1235f4c
--- /dev/null
+++ b/production/doctype/bill_of_materials/bill_of_materials.js
@@ -0,0 +1,103 @@
+$import(Production Tips Common)
+
+// ONLOAD
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+// On REFRESH
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+
+  // Hide - Un Hide Buttons
+  if (!doc.is_default && doc.__islocal!=1) unhide_field('Set as Default BOM');
+  else hide_field('Set as Default BOM');
+  
+  if(doc.__islocal!=1){
+    set_field_permlevel('item',1);
+  }
+  if (flt(doc.docstatus) == 1){
+    if (doc.is_active == 'Yes') { unhide_field('Inactivate BOM'); hide_field('Activate BOM');}
+    else { hide_field('Inactivate BOM'); unhide_field('Activate BOM');}
+  }
+}
+
+cur_frm.fields_dict['item'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+// ---------------------- Get project name --------------------------
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
+  return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc) {
+   var d = locals[this.doctype][this.docname];
+   return 'SELECT DISTINCT `tabBill Of Materials`.`name`, `tabBill Of Materials`.`remarks` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
+}
+
+cur_frm.cscript.item = function(doc, cdt, cdn) {
+  if (doc.item) {
+    get_server_fields('get_item_detail',doc.item,'',doc,cdt,cdn,1);
+  }
+}
+
+cur_frm.cscript.workstation = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.workstation) {
+    get_server_fields('get_workstation_details',d.workstation,'bom_operations',doc,cdt,cdn,1);
+  }
+}
+
+cur_frm.cscript.item_code =function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    arg = "{'item_code' : '" + d.item_code + "', 'bom_no' : ''}";
+    get_server_fields('get_bom_material_detail',arg,'bom_materials',doc,cdt,cdn,1);
+  }
+}
+
+cur_frm.cscript.bom_no = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code && d.bom_no) {
+    arg = "{'item_code' : '" + d.item_code + "', 'bom_no' : '" + d.bom_no + "'}";
+    get_server_fields('get_bom_material_detail',arg,'bom_materials',doc,cdt,cdn,1);
+  }
+}
+
+cur_frm.cscript['Set as Default BOM'] = function(doc,cdt,cdn) {
+  var check = confirm("Do you Really want to Set BOM " + doc.name + " as default for Item " + doc.item);
+  if (check) {
+    $c('runserverobj', args={'method':'set_as_default_bom', 'docs': compress_doclist([doc])}, function(r,rt) {
+    refresh_field('is_default');
+    hide_field('Set as Default BOM');
+    refresh_field('Set as Default BOM');
+    });	
+  }
+}
+
+cur_frm.cscript['Activate BOM'] = function(doc,cdt,cdn) {
+  var check = confirm("DO YOU REALLY WANT TO ACTIVATE BOM : " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'activate_inactivate_bom', 'arg': 'Activate', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+  }
+}
+
+cur_frm.cscript['Inactivate BOM'] = function(doc,cdt,cdn) {
+  var check = confirm("DO YOU REALLY WANT TO INACTIVATE BOM : " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'activate_inactivate_bom', 'arg': 'Inactivate', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+  }
+}
\ No newline at end of file
diff --git a/production/doctype/bill_of_materials/bill_of_materials.py b/production/doctype/bill_of_materials/bill_of_materials.py
new file mode 100644
index 0000000..f8f8e30
--- /dev/null
+++ b/production/doctype/bill_of_materials/bill_of_materials.py
@@ -0,0 +1,541 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    
+  def autoname(self):
+    last_name = sql("select max(name) from `tabBill Of Materials` where name like 'BOM/%s/%%'" % self.doc.item)
+    if last_name:
+      idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
+    else:
+      idx = 1
+    self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx) 
+
+  #----------- Client Trigger function ----------
+  def get_item_detail(self, item_code):
+    item = sql("select description from `tabItem` where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now()) and name = %s",item_code , as_dict =1)
+    ret={
+      'description'   : item and item[0]['description'] or ''
+    }
+    return cstr(ret)
+
+  def get_workstation_details(self,workstation):
+    ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1)
+    ret = {
+      'hour_rate'            : ws and flt(ws[0]['hour_rate']) or '',
+      'workstation_capacity' : ws and flt(ws[0]['capacity']) or ''
+    }
+    return cstr(ret)
+
+  def get_bom_material_detail(self, arg):
+    arg = eval(arg)
+    if arg['item_code'] and arg['item_code'] == self.doc.item:
+      msgprint(" Item_code: "+arg['item_code']+" in materials tab cannot be same as main Item in BOM := " +cstr(self.doc.name))
+      raise Exception
+    if arg['item_code']:
+      item = sql("select is_asset_item, is_purchase_item, docstatus, is_sub_contracted_item, description, stock_uom, default_bom from `tabItem` where item_code = %s", (arg['item_code']), as_dict = 1)
+      
+      # Check for Asset Item
+      if item and item[0]['is_asset_item'] == 'Yes':
+        msgprint("Sorry!!! Item " + arg['item_code'] + " is an Asset of the company. Entered in BOM := " + cstr(self.doc.name))
+        raise Exception
+        
+      if item and item[0]['docstatus'] == 2:
+        msgprint("Item %s does not exist in system" % cstr(args['item_code']))
+ 
+      ret_item = {
+                 'description' : item and item[0]['description'] or '',
+                 'stock_uom'   : item and item[0]['stock_uom'] or '',
+                 'bom_no'      : item and item[0]['default_bom'] or ''
+      }
+
+      # Check for Purchase Item
+      if item and (item[0]['is_purchase_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes'):
+        ret_item['moving_avg_rate'], ret_item['last_purchase_rate'], ret_item['standard_rate']  = self.get_mar_lpr_sr(arg['item_code'], mar = 1, lpr = 1, sr = 1)
+        ret_item['operating_cost'], ret_item['dir_mat_as_per_mar'], ret_item['dir_mat_as_per_lpr'], ret_item['dir_mat_as_per_sr'] = 0, 0, 0, 0
+        ret_item['value_as_per_mar'], ret_item['value_as_per_lpr'], ret_item['value_as_per_sr'] = 0, 0, 0
+        ret_item['amount_as_per_mar'], ret_item['amount_as_per_lpr'], ret_item['amount_as_per_sr'] = 0, 0, 0
+
+    if arg['bom_no'] or not ret_item['bom_no'] =='':
+      if arg['bom_no']:
+        bom = sql("select name, dir_mat_as_per_mar,dir_mat_as_per_lpr,dir_mat_as_per_sr, operating_cost, quantity from `tabBill Of Materials` where is_active = 'Yes' and name = %s", (arg['bom_no']), as_dict=1)
+      else:      
+        # get recent direct material cost, operating_cost, cost from Default BOM of Item 
+        bom = sql("select name, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, operating_cost, quantity from `tabBill Of Materials` where is_active = 'Yes' and name = %s", (ret_item['bom_no']), as_dict=1)
+      
+      # get recent direct material cost, operating_cost, cost from Entered BOM of Item 
+      ret_item['bom_no'] = bom and bom[0]['name'] or ''
+
+      if bom and bom[0]['name']:
+        ret_bom = { 
+        'dir_mat_as_per_mar' : flt(bom[0]['dir_mat_as_per_mar']) / flt(bom[0]['quantity']) or 0.00,
+        'dir_mat_as_per_lpr' : flt(bom[0]['dir_mat_as_per_lpr']) / flt(bom[0]['quantity']) or 0.00,
+        'dir_mat_as_per_sr'  : flt(bom[0]['dir_mat_as_per_sr']) / flt(bom[0]['quantity']) or 0.00,
+        'operating_cost'     : flt(bom[0]['operating_cost']) / flt(bom[0]['quantity']) or 0.00,
+        'value_as_per_mar'   : ((flt(bom[0]['dir_mat_as_per_mar']) + flt(bom[0]['operating_cost'])) / flt(bom[0]['quantity'])) or 0.00,
+        'value_as_per_lpr'   : ((flt(bom[0]['dir_mat_as_per_lpr']) + flt(bom[0]['operating_cost'])) / flt(bom[0]['quantity'])) or 0.00,
+        'value_as_per_sr'    : ((flt(bom[0]['dir_mat_as_per_sr'])  + flt(bom[0]['operating_cost'])) / flt(bom[0]['quantity'])) or 0.00,
+        'amount_as_per_mar'  : 0,
+        'amount_as_per_lpr'  : 0,
+        'amount_as_per_sr'   : 0
+        }
+        ret_item.update(ret_bom)
+        if item and item[0]['is_sub_contracted_item'] != 'Yes':
+          ret_bom_rates = {
+            'moving_avg_rate'    : 0,
+            'last_purchase_rate' : 0,
+            'standard_rate'      : 0
+            }
+          ret_item.update(ret_bom_rates)
+    return cstr(ret_item)
+  
+  def set_as_default_bom(self):
+    # set Is Default as 1
+    set(self.doc,'is_default', flt(1))
+
+    # get previous default bom from Item Master
+    prev_def_bom = sql("select default_bom from `tabItem` where name = %s", self.doc.item,as_dict = 1)
+    
+    if prev_def_bom[0]['default_bom'] and prev_def_bom[0]['default_bom'] != self.doc.name:
+      # update Is Default as 0 in Previous Default BOM
+      msgprint(cstr(prev_def_bom[0]['default_bom']) + "is no longer Default BOM for item" + cstr(self.doc.item))
+      sql("update `tabBill Of Materials` set is_default = 0 where name = '%s'" % (prev_def_bom[0]['default_bom']))
+
+    # update current BOM as default bom in Item Master
+    sql("update `tabItem` set default_bom = '%s' where name = '%s'" % (self.doc.name,self.doc.item))
+    msgprint(cstr(self.doc.name) + "has been set as Default BOM for Item "+cstr(self.doc.item))
+
+  def check_active_parent_boms(self):
+    act_pbom = sql("select distinct t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 where t1.bom_no ='%s' and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
+    if act_pbom and act_pbom[0][0]:
+      msgprint("Sorry cannot Inactivate as BOM %s is child of one or many other active parent BOMs" % self.doc.name)
+      raise Exception
+      
+  def activate_inactivate_bom(self, action):
+    if cstr(action) == 'Activate':
+      self.validate()
+      set(self.doc, 'is_active', 'Yes')
+    elif cstr(action) == 'Inactivate':
+      self.check_active_parent_boms()
+      set(self.doc, 'is_active', 'No')
+
+  #------ On Validation Of Document ----------
+  def validate_main_item(self):
+    item = sql("select is_manufactured_item, is_sub_contracted_item from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now())", self.doc.item, as_dict = 1)
+    
+    if not item:
+      msgprint("Item %s do not exists in the system. Entered in BOM := %s" % (cstr(self.doc.item), cstr(self.doc.name)))
+      raise Exception
+      
+    elif not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item'] == 'Yes':
+      msgprint("Sorry cannot make Bill Of Materials for Item %s. As it is not a manufactured / sub-contracted item. Entered in BOM := %s " % (cstr(self.doc.item), cstr(self.doc.name)))
+      raise Exception
+
+  # validate operations
+  #------------------------------------------------------
+  def validate_operations(self,o,validate = "0"):
+    if not o.operation_no:
+      msgprint("Please Enter Operation No at Row " + cstr(o.idx)+" in BOM := " +cstr(self.doc.name))
+      raise Exception
+      
+    if not o.workstation:
+      msgprint("Please Enter Workstation for Operation No. " + cstr(o.operation_no) + " in BOM NO. " + self.doc.name)
+      raise Exception
+
+    if not o.time_in_mins:
+      msgprint("Please Enter Operation Time of Operation No. " + cstr(o.operation_no)  + " in BOM NO. " + self.doc.name)
+      raise Exception
+
+    # Operation No should not repeat.
+    if o.operation_no in self.op:
+      msgprint("Operation No " + cstr(o.operation_no) + "is repeated in Operations Table of BOM NO. " + self.doc.name)
+      raise Exception
+
+      # add operation in op list
+    self.op.append(cstr(o.operation_no))
+ 
+  # Validate materials
+  #-------------------------------------------------
+
+  def validate_materials(self,m):
+
+    # check for operation no
+    if not self.op:
+      msgprint("Please Enter Operations in operation table of BOM NO. " + self.doc.name)
+      raise Exception
+
+    # check if operation no not in op list
+    if m.operation_no not in self.op:
+      msgprint("Operation no "+ cstr(m.operation_no) + " for item code " + cstr(m.item_code) +" is not present in BOM Operations of BOM NO. " + self.doc.name)
+      raise Exception
+
+    if not m.item_code:
+      msgprint("Please Enter Item Code at Row " + cstr(m.idx) + "of BOM Material in BOM NO. " + self.doc.name)
+      raise Exception
+
+    item = sql("select is_manufactured_item, is_sub_contracted_item from`tabItem` where item_code = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now())", m.item_code, as_dict = 1)
+    if not item:
+      msgprint("Item %s is not present in Item Master." % m.item_code)
+      raise Exception
+      
+    if item[0]['is_manufactured_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes':
+      bom = sql("select name, is_active, docstatus from `tabBill Of Materials` where item = %s", m.item_code, as_dict =1)
+      if bom and bom[0]['name']:
+        if not m.bom_no:
+          msgprint("Please Enter BOM No for Item " + cstr(m.item_code) + " in Materials at Row No. " + cstr(m.idx)  + " in BOM NO. " + self.doc.name)
+          raise Exception
+        else:
+          match = 0
+          for b in bom:
+            if cstr(m.bom_no) == cstr(b['name']):
+              if b['is_active'] != 'Yes':
+                msgprint("BOM %s NOT ACTIVE BOM. Entered in BOM := %s at row no := %s" % (cstr(m.bom_no), cstr(self.doc.name), m.idx))
+                raise Exception  
+              
+              #if flt(b['docstatus']) != 1:
+              #  msgprint("BOM %s is NOT SUBMITTED."% cstr(m.bom_no))
+              #  raise Exception
+              
+              match = 1
+          if not match:
+            msgprint("Item %s does not belongs to Bill Of Material %s or Bill Of Material %s is NOT ACTIVE BOM. Entered in BOM := %s at row no := %s" % (cstr(m.item_code),cstr(m.bom_no), cstr(m.bom_no), self.doc.name, m.idx))
+            raise Exception
+    
+    if not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item']== 'Yes':
+      if m.bom_no:
+        msgprint("As in Item Master of Item %s Is Manufactured Item / Is Sub-Contracted Item  is not 'Yes' hence there should be no BOM.In BOm := %s at row no := %s" % (m.item_code, cstr(self.doc.name), m.idx))
+        raise Exception
+
+    if not m.qty or m.qty <= 0:
+      msgprint("Please Enter Qty value greater than 0(Zero) at Row " + cstr(m.idx) + " in BOM NO. " + self.doc.name)
+      raise Exception
+
+    if m.scrap and m.scrap < 0:
+      msgprint("Please Enter Scrap value Greater than 0(Zero) at Row " + cstr(m.idx)  + " in BOM NO. " + self.doc.name)
+      raise Exception
+
+  # Calculate Cost
+  #-----------------------------------------------
+    
+  def calculate_cost(self, validate = 0):
+    self.op, op_cost, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, count_mat = [], 0.0, 0.0,0.0,0.0, 0
+    # --------  Calculate Cost Of BOM  -------------
+    # --- calculate operating cost from BOM Operations ----
+    for o in getlist(self.doclist, 'bom_operations'):
+      # --- Validation for enteries in BOM Operations ---- 
+      if validate:
+        self.validate_operations(o)
+        
+      o.operating_cost = flt(flt(o.time_in_mins)/60) * flt(o.hour_rate)
+      if validate != 1:
+        o.save()
+
+      op_cost = flt(op_cost) + flt(o.operating_cost)
+    
+    # --- calculate operating cost and direct material cost from BOM Material ---
+    for m in getlist(self.doclist, 'bom_materials'):
+      # --- Validation for enteries in BOM Material --- '''
+      count_mat = count_mat + 1
+      if validate:
+        self.validate_materials(m)
+
+      if m.bom_no:
+        # add operating cost of child boms 
+        op_cost += flt(m.operating_cost)
+        
+        # update dir_mat, op_cost, value from child bom
+        self.update_childs_dir_op_value(m, child_bom_cost = 1)
+        
+        # check for is_sub_contracted_item
+        item = sql("select is_sub_contracted_item from `tabItem` where name = '%s'" % m.item_code, as_dict =1)
+        if item and item[0]['is_sub_contracted_item'] == 'Yes':
+          # update recent mar,lpr,sr
+          self.update_mar_lpr_sr(m, mar =1, lpr =1, sr =1)
+          # calculate amount for sub contracted item
+          self.calculate_amount( m, has_bom = 1, is_sub_cont = 1)
+          # calculate Direct Material
+          dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr = self.calculate_dir_mat(m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom = 1, is_sub_cont =1)
+        else:
+          # update mar,lpr,sr as 0 
+          self.update_mar_lpr_sr( m, mar = 0, lpr = 0, sr = 0)
+          # calculate amount
+          self.calculate_amount( m, has_bom = 1, is_sub_cont = 0)
+          # calculate Direct Material
+          dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr = self.calculate_dir_mat(m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom = 1, is_sub_cont =0)
+   
+      else :
+        # update dir_mat,op_cost, value as 0
+        self.update_childs_dir_op_value(m, child_bom_cost = 0)
+        # update recent mar,lpr,sr
+        self.update_mar_lpr_sr(m, mar =1, lpr =1, sr =1)
+        # calculate amount
+        self.calculate_amount(m, has_bom = 0, is_sub_cont = 0)
+        # calculate Direct Material
+        dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr = self.calculate_dir_mat(m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom =0, is_sub_cont =0)
+        
+      # update qty_consumed_per_unit
+      m.qty_consumed_per_unit = flt(m.qty) / flt(self.doc.quantity)
+      m.save()
+      #msgprint("dir_mat_as_per_mar < ==> " + cstr(dir_mat_as_per_mar) + "***" + "dir_mat_as_per_lpr < ==> " + cstr(dir_mat_as_per_lpr) + "***" + "dir_mat_as_per_sr < ==> " + cstr(dir_mat_as_per_sr) + "***")
+    if not count_mat:
+      msgprint("There should at least one Item in BOM Material. In BOM := " +cstr(self.doc.name))
+      raise Exception
+
+    set(self.doc, 'operating_cost' ,op_cost)
+    set(self.doc, 'cost_as_on' ,now())
+    # update dir_mat
+    set(self.doc, 'dir_mat_as_per_mar' ,dir_mat_as_per_mar)
+    set(self.doc, 'dir_mat_as_per_lpr' ,dir_mat_as_per_lpr)
+    set(self.doc, 'dir_mat_as_per_sr'  ,dir_mat_as_per_sr)
+    # update cost
+    set(self.doc, 'cost_as_per_mar' ,flt(dir_mat_as_per_mar + op_cost))
+    set(self.doc, 'cost_as_per_lpr' ,flt(dir_mat_as_per_lpr + op_cost))
+    set(self.doc, 'cost_as_per_sr' ,flt(dir_mat_as_per_sr + op_cost))
+
+  def update_childs_dir_op_value(self, m, child_bom_cost = 0):
+    #msgprint("IN UPDATE CHILDS DIR OP VALUE")
+    if child_bom_cost:
+      # get recent direct material cost, operating cost, cost from child bom 
+      child_bom_cost = sql("select dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, operating_cost, cost_as_per_mar, cost_as_per_lpr, cost_as_per_sr, quantity from `tabBill Of Materials` where  name = %s", m.bom_no, as_dict = 1)
+    
+    # operating_cost
+    m.operating_cost = child_bom_cost and flt(child_bom_cost[0]['operating_cost']) / flt(child_bom_cost[0]['quantity']) or 0.00
+    
+    val_dir_dict = {'value_as_per_mar': 'cost_as_per_mar', 'dir_mat_as_per_mar': 'dir_mat_as_per_mar',
+                    'value_as_per_lpr': 'cost_as_per_lpr', 'dir_mat_as_per_lpr': 'dir_mat_as_per_lpr',
+                    'value_as_per_sr' : 'cost_as_per_sr' , 'dir_mat_as_per_sr' : 'dir_mat_as_per_sr'  }
+    for d in val_dir_dict:
+      # Set Value and Dir MAt
+      m.fields[d] = child_bom_cost and flt(child_bom_cost[0][val_dir_dict[d]])/flt(child_bom_cost[0]['quantity']) or 0.00
+
+  def update_mar_lpr_sr(self, m, mar = 0, lpr = 0, sr = 0):
+    m.moving_avg_rate, m.last_purchase_rate, m.standard_rate = self.get_mar_lpr_sr(cstr(m.item_code), mar, lpr, sr, m.qty)
+
+  def calculate_amount(self, m, has_bom = 0, is_sub_cont = 0):
+    #msgprint("IN CALCULATE AMOUNT")
+    if has_bom :
+      m.amount_as_per_mar = flt(m.qty) * (is_sub_cont and flt(m.moving_avg_rate)  or flt(m.value_as_per_mar)) * flt(1.00 + (flt(m.scrap)/100)) or 0
+      m.amount_as_per_lpr = flt(m.qty) * (is_sub_cont and (flt(m.value_as_per_lpr) + flt(m.last_purchase_rate)) or flt(m.value_as_per_lpr)) * flt(1.00 + (flt(m.scrap)/100)) or 0
+      m.amount_as_per_sr  = flt(m.qty) * (is_sub_cont and (flt(m.value_as_per_sr)  + flt(m.standard_rate))      or flt(m.value_as_per_mar)) * flt(1.00 + (flt(m.scrap)/100)) or 0
+
+    else:
+      m.amount_as_per_mar = flt(m.qty) * flt(m.moving_avg_rate)    * flt(1.00 + (flt(m.scrap)/100)) or 0
+      m.amount_as_per_lpr = flt(m.qty) * flt(m.last_purchase_rate) * flt(1.00 + (flt(m.scrap)/100)) or 0
+      m.amount_as_per_sr = flt(m.qty)  * flt(m.standard_rate)      * flt(1.00 + (flt(m.scrap)/100)) or 0
+    #msgprint(cstr(m.item_code))
+    #msgprint("amount_as_per_mar < ==> " + cstr(m.amount_as_per_mar) + "***" + "amount_as_per_lpr < ==> " + cstr(m.amount_as_per_lpr) + "***" + "amount_as_per_sr < ==> " + cstr(m.amount_as_per_sr) + "***")
+  def calculate_dir_mat(self, m, dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr, has_bom = 0, is_sub_cont =0):
+    #msgprint("IN CALCULATE DIR MAT")
+    if has_bom:
+      dir_mat_as_per_mar +=  flt(m.qty) * (is_sub_cont and   flt(m.moving_avg_rate) or flt(m.dir_mat_as_per_mar)) * flt(1.00 + (flt(m.scrap)/100)) or 0
+      dir_mat_as_per_lpr +=  flt(m.qty) * (is_sub_cont and ( flt(m.dir_mat_as_per_lpr)+ flt(m.last_purchase_rate)) or flt(m.dir_mat_as_per_lpr)) * flt(1.00 + (flt(m.scrap)/100)) or 0
+      dir_mat_as_per_sr  +=  flt(m.qty) * (is_sub_cont and ( flt(m.dir_mat_as_per_sr)+ flt(m.standard_rate)     ) or flt(m.dir_mat_as_per_sr)) * flt(1.00 + (flt(m.scrap)/100)) or 0
+    else:
+      dir_mat_as_per_mar += flt(m.amount_as_per_mar)
+      dir_mat_as_per_lpr += flt(m.amount_as_per_lpr)
+      dir_mat_as_per_sr  += flt(m.amount_as_per_sr)
+    #msgprint(cstr(m.item_code))  
+    #msgprint("dir_mat_as_per_mar < ==> " + cstr(dir_mat_as_per_mar) + "***" + "dir_mat_as_per_lpr < ==> " + cstr(dir_mat_as_per_lpr) + "***" + "dir_mat_as_per_sr < ==> " + cstr(dir_mat_as_per_sr) + "***")
+    return dir_mat_as_per_mar, dir_mat_as_per_lpr, dir_mat_as_per_sr
+
+
+  # Get FIFO Rate from Stack
+  # -------------------------
+  def get_fifo_rate(self, fcfs_bal, qty):
+    if qty:
+      fcfs_val = 0
+      withdraw = flt(qty)
+      while withdraw:
+        if not fcfs_bal:
+          break # nothing in store
+           
+        batch = fcfs_bal[0]
+          
+        if batch[0] < withdraw:
+          # not enough in current batch, clear batch
+          withdraw -= batch[0]
+          fcfs_val += (flt(batch[0]) * flt(batch[1]))
+          fcfs_bal.pop(0)
+        else:
+          # all from current batch
+          fcfs_val += (flt(withdraw) * flt(batch[1]))
+          batch[0] -= withdraw
+          withdraw = 0
+      fcfs_rate = flt(fcfs_val) / flt(qty)
+      return fcfs_rate
+    else:
+      return fcfs_bal and fcfs_bal[0][1] or 0
+
+
+  # Get valuation rate
+  # --------------------
+  def get_valuation_rate(self, item_code, qty):
+    # get default warehouse
+    warehouse = sql("select default_warehouse from tabItem where name = %s", item_code)
+    warehouse = warehouse and warehouse[0][0] or ''
+    in_rate = 0
+
+    # get default valuation method
+    val_method = sql("select valuation_method from tabItem where name = %s", item_code)
+    val_method = val_method and val_method[0][0] or ''
+    if not val_method: val_method = get_defaults().has_key('valuation_method') and get_defaults()['valuation_method'] or 'FIFO'
+
+    if val_method == 'FIFO':
+      if warehouse:
+        bin_obj = get_obj('Warehouse',warehouse).get_bin(item_code)
+        prev_sle = bin_obj.get_prev_sle('',nowdate(), (now().split(' ')[1])[:-3])
+        fcfs_stack = prev_sle and (prev_sle[0][3] and eval(prev_sle[0][3]) or []) or []
+      else:
+        prev_sle = sql("select fcfs_stack from `tabStock Ledger Entry` where item_code = '%s' and posting_date <= '%s' order by posting_date DESC, posting_time DESC, name DESC limit 1" % (item_code, nowdate()))
+        fcfs_stack = prev_sle and (prev_sle[0][0] and eval(prev_sle[0][0]) or []) or []
+      in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0
+    elif val_method == 'Moving Average':
+      in_rate = sql("select ifnull(sum(valuation_rate), 0)/ ifnull(count(*),1) from `tabBin` where item_code = '%s' and ifnull(ma_rate, 0) > 0" % cstr(item_code))
+      in_rate = in_rate and flt(in_rate[0][0]) or 0
+    return in_rate
+
+
+  # Get valuation, Last Purchase and Standard Rate
+  # ------------------------------------------------
+  def get_mar_lpr_sr(self, item_code, mar = 0, lpr = 0, sr = 0, qty = 1.00):
+    # get list of warehouse having
+    ma_rate, lpr_rate, sr_rate = 0,0,0
+    if mar:
+      # get recent moving average rate
+      #ma_rate = sql("select ifnull(sum(ma_rate), 0)/ ifnull(count(*),1) from `tabBin` where item_code = '%s' and ifnull(ma_rate, 0) > 0" % cstr(item_code))
+      #ma_rate = flt(ma_rate and ma_rate[0][0]) or 0
+      ma_rate = self.get_valuation_rate(item_code, qty)
+      
+    # get recent last purchase rate 
+    lpr_rate = lpr and flt(sql("select last_purchase_rate from `tabItem` where name = '%s'" % item_code)[0][0]) or 0.00
+    # get recent standard rate
+    sr_rate = sr and flt(sql("select standard_rate from `tabItem` where name = '%s'" % item_code)[0][0]) or 0.00
+    return ma_rate, lpr_rate, sr_rate
+
+  #checking for duplicate items i.e items that may be entered twice
+  def validate_duplicate_items(self):
+    check_list = []
+    for d in getlist(self.doclist, 'bom_materials'):
+      if cstr(d.item_code) in check_list:
+        msgprint("Item %s has been entered twice. In BOM %s" % (d.item_code, self.doc.name))
+        raise Exception
+      else:
+        check_list.append(cstr(d.item_code))
+  
+  #----- Document on Save function------  
+  def validate(self):
+    self.validate_main_item()
+    self.validate_duplicate_items()
+    self.calculate_cost(validate = 1)
+   
+  def check_recursion(self):
+    check_list = [['parent', 'bom_no', 'parent'], ['bom_no', 'parent', 'child']]
+    for d in check_list:
+      bom_list, count = [self.doc.name], 0
+      while ( len(bom_list) > count ):
+        boms = sql(" select %s from `tabBOM Material` where %s = '%s' " % ( d[0], d[1], cstr(bom_list[count])))
+        count = count + 1
+        for b in boms:
+          if b[0] == self.doc.name:
+            msgprint("Recursion Occured:=>  '%s' cannot be '%s' of '%s'." % ( cstr(b), cstr(d[2]), cstr(self.doc.name)))
+            raise Exception
+          if b[0]:
+            bom_list.append(b[0])
+
+  def on_update(self):
+    if self.doc.item != cstr(self.doc.name.split('/')[1]):
+      msgprint("Cannot change Item once the Bill Of Material is created.")
+      raise Exception
+    self.check_recursion()
+    
+
+# ********************************************** Submit *************************************************************
+  
+  # Add Flat BOM Details
+  # -----------------------
+  def add_to_flat_bom_detail(self, is_submit = 0):
+    self.doc.clear_table(self.doclist, 'flat_bom_details', 1)
+    fb_lbl = {'item_code': 0, 'description': 1, 'qty': 2, 'stock_uom': 3, 'moving_avg_rate': 4,'amount_as_per_mar': 5, 'last_purchase_rate': 6, 'amount_as_per_lpr':7,'standard_rate':8,'amount_as_per_sr':9,'qty_consumed_per_unit': 10, 'parent_bom': 11, 'bom_mat_no': 12, 'is_pro_applicable': 13}
+    for d in self.cur_flat_bom_items:
+      fb_child = addchild(self.doc, 'flat_bom_details', 'Flat BOM Detail', 1, self.doclist)
+      for i in fb_lbl:
+        fb_child.fields[i] = d[fb_lbl[i]]
+      fb_child.docstatus = is_submit
+      fb_child.save(1)
+    self.doc.save()
+
+
+  #Get Child Flat BOM Items
+  #----------------------------------------
+  def get_child_flat_bom_items(self, item, d):   
+    child_flat_bom_items=[]
+    if item and (item[0]['is_sub_contracted_item'] == 'Yes' or item[0]['is_pro_applicable'] == 'Yes'):
+      child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, '%s' as parent_bom, bom_mat_no, 'No' as is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus = 1" % ( d.bom_no, cstr(d.bom_no)))
+      self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), (item[0]['is_sub_contracted_item'] == 'Yes') and d.parent or d.bom_no, d.name, (item[0]['is_sub_contracted_item'] == 'Yes') and 'No' or 'Yes'])
+
+    else:
+      child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, if(parent_bom = '%s', '%s', parent_bom) as parent_bom, bom_mat_no, is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and docstatus = 1" % ( d.bom_no, d.parent, cstr(d.bom_no)))
+
+    if not child_flat_bom_items:
+      msgprint("Please Submit Child BOM := %s first." % cstr(d.bom_no))
+      raise Exception
+    else:
+      return child_flat_bom_items
+  
+  
+  # Get Current Flat BOM Items
+  # -----------------------------
+  def get_current_flat_bom_items(self):
+    self.cur_flat_bom_items = []
+    
+    cfb_lbl = {'item_code': 0, 'description': 1, 'qty_consumed_per_unit': 2, 'stock_uom': 3, 'moving_avg_rate': 4, 'last_purchase_rate': 5, 'standard_rate': 6, 'parent_bom': 7, 'bom_mat_no': 8, 'is_pro_applicable': 9}
+    
+    for d in getlist(self.doclist, 'bom_materials'):  
+      if d.bom_no:
+        item = sql("select is_sub_contracted_item, is_pro_applicable from `tabItem` where name = '%s'" % d.item_code, as_dict = 1)
+        child_flat_bom_items = self.get_child_flat_bom_items(item,d)
+        
+        for c in child_flat_bom_items:
+          self.cur_flat_bom_items.append([c[cfb_lbl['item_code']], c[cfb_lbl['description']], flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]), c[cfb_lbl['stock_uom']], flt(c[cfb_lbl['moving_avg_rate']]), flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]) * flt(c[cfb_lbl['moving_avg_rate']]) ,flt(c[cfb_lbl['last_purchase_rate']]), flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]) * flt(c[cfb_lbl['last_purchase_rate']]), flt(c[cfb_lbl['standard_rate']]), flt(d.qty) * flt(c[cfb_lbl['qty_consumed_per_unit']]) * flt(c[cfb_lbl['standard_rate']]), flt(d.qty_consumed_per_unit) * flt(c[cfb_lbl['qty_consumed_per_unit']]), c[cfb_lbl['parent_bom']], c[cfb_lbl['bom_mat_no']], c[cfb_lbl['is_pro_applicable']]])
+      else:
+        # add purchase_items from bom material to the child_flat_bom_items
+        self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), d.parent, d.name, 'No' ])
+
+  # Update Flat BOM Engine
+  # ------------------------  
+  def update_flat_bom_engine(self, is_submit = 0):
+    # following will be correct data
+    # get correct / updated flat bom data    
+    self.get_current_flat_bom_items()
+    # insert to curr flat bom data
+    self.add_to_flat_bom_detail(is_submit)
+
+
+  # On Submit
+  # -----------
+  def on_submit(self):
+    self.update_flat_bom_engine()
+
+        
+  def get_parent_bom_list(self, bom_no):
+    p_bom = sql("select parent from `tabBOM Material` where bom_no = '%s'" % bom_no)
+    return p_bom and [i[0] for i in p_bom] or []
diff --git a/production/doctype/bill_of_materials/bill_of_materials.txt b/production/doctype/bill_of_materials/bill_of_materials.txt
new file mode 100644
index 0000000..dd2c90c
--- /dev/null
+++ b/production/doctype/bill_of_materials/bill_of_materials.txt
@@ -0,0 +1,1348 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': 0,
+		'allow_copy': 0,
+		'allow_email': 0,
+		'allow_print': 0,
+		'allow_rename': 0,
+		'allow_trash': 1,
+		'autoname': '',
+		'change_log': None,
+		'client_script': '',
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': 0,
+		'hide_toolbar': 0,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 0,
+		'istable': 0,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-11-23 14:09:29',
+		'modified_by': 'Administrator',
+		'module': 'Production',
+		'name': 'Bill Of Materials',
+		'name_case': '',
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': '',
+		'read_only': 0,
+		'read_only_onload': None,
+		'search_fields': 'item',
+		'section_style': 'Tabbed',
+		'server_code': '',
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': '',
+		'subject': '%(item_code)s',
+		'tag_fields': '',
+		'use_template': None,
+		'version': 170
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:52',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'PERM00059',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:52',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'PERM00060',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:52',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'PERM00061',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Production Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:52',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'PERM00062',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Production Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:52',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'PERM00063',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Production User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:08:52',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'PERM00064',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Production User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00523',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '',
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'TreeView1',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00524',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<div style=\'border: 1px solid #CCF; padding: 8px;margin-bottom: 8px;\'><div class=\'link_type\' onclick=\'loadpage("Bill of Materials"); \'>Go To BOM Tree View</div></div>',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00525',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': '',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '',
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Set as Default BOM',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00526',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': '',
+		'oldfieldtype': 'Button',
+		'options': '',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00527',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Activate BOM',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00528',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 1,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Inactivate BOM',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00529',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '',
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Details',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00530',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': '',
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the item code for which Bill of Material is being created',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': 1,
+		'label': 'Item',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00531',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'item',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00532',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': 'Total quantity of items for which raw materials required and operations done will be defined',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'quantity',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Quantity',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00533',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'quantity',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_active',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Is Active',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00534',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'is_active',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_default',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Is Default',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00535',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'is_default',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:55',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select name of the project if Bill Of Materials need to be created against any project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2010-09-01 15:47:55',
+		'modified_by': 'Administrator',
+		'name': 'FL03820',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '',
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Operations',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00536',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': '',
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': 'Specify the operations performed and give a unique Operation no to your operations. Select the workstation which is nothing but machinery where this operation would be performed on raw materials. Hour rate will be fetched from the Workstation master. Operation time will be entered manually. Operating cost will be calculated once the Bill of Material is saved.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bom_operations',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'BOM Operations',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00537',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bom_operations',
+		'oldfieldtype': 'Table',
+		'options': 'BOM Operation',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Materials',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00538',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter the raw materials required to manufacture the BOM item. Specify the operation no as entered in the previous tab which will be performed on the raw materials entered.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bom_materials',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'BOM Material',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00539',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'bom_materials',
+		'oldfieldtype': 'Table',
+		'options': 'BOM Material',
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Costing',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00540',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00541',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_as_per_mar',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Cost As Per Valuation Rate',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00542',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cost_as_per_mar',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_as_per_lpr',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Cost As Per LPR',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00543',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cost_as_per_lpr',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_as_per_sr',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Cost As Per SR',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00544',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cost_as_per_sr',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cost_as_on',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Cost as on',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00545',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'cost_as_on',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'dir_mat_as_per_mar',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Direct Material As Per Valuation',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00546',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'dir_mat_as_per_mar',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'dir_mat_as_per_lpr',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Direct Material As Per LPR',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00547',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'dir_mat_as_per_lpr',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'dir_mat_as_per_sr',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Direct Material As Per SR',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00548',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'dir_mat_as_per_sr',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'operating_cost',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Operating Cost',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00549',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'operating_cost',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'maintained_by',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Maintained By',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00550',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'maintained_by',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '',
+		'fieldtype': 'Section Break',
+		'hidden': 1,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'BOM Report',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00551',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': '',
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': 0,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Flat BOM',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00552',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:52',
+		'default': 'No Toolbar',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'flat_bom_details',
+		'fieldtype': 'Table',
+		'hidden': 0,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Flat BOM Detail',
+		'modified': '2010-08-08 17:08:52',
+		'modified_by': 'Administrator',
+		'name': 'FL00553',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'flat_bom_details',
+		'oldfieldtype': 'Table',
+		'options': 'Flat BOM Detail',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Bill Of Materials',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/production/doctype/bom_control/__init__.py b/production/doctype/bom_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bom_control/__init__.py
diff --git a/production/doctype/bom_control/bom_control.py b/production/doctype/bom_control/bom_control.py
new file mode 100644
index 0000000..02b61e3
--- /dev/null
+++ b/production/doctype/bom_control/bom_control.py
@@ -0,0 +1,101 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+
+  def get_item_group(self):
+    ret = sql("select name from `tabItem Group` ")
+    item_group = []
+    for r in ret:
+      item =sql("select t1.name from `tabItem` t1, `tabBill Of Materials` t2 where t2.item = t1.name and t1.item_group = '%s' " % (r[0]))
+      if item and item[0][0]:
+        item_group.append(r[0])
+    return '~~~'.join([r for r in item_group])
+
+  def get_item_code(self,item_group):
+    # here Bill Of Materials docstatus = 1 and is_active ='yes' condition is not given because some bom is under construction 
+    # that is it is still in saved mode and they want see till where they have reach.
+    ret = sql("select distinct t1.name from `tabItem` t1, `tabBill Of Materials` t2 where t2.item = t1.name and t1.item_group = '%s' " % (item_group))
+    return '~~~'.join([r[0] for r in ret])
+
+  def get_bom_no(self,item_code):
+    ret = sql("select name from `tabBill Of Materials` where item = '%s' " % (item_code))
+    return '~~~'.join([r[0] for r in ret])
+
+  def get_operations(self,bom_no):
+    # reply = [ 'Operation',operation_no, opn_description,BOM NO     , workstation, hour_rate,  time_in_minutes,  Total Direct Material, Total Operating Cost, Cost]
+    # reply = [ 0           ,  1         ,    2          ,3          , 4          ,  5        ,  6             ,         7            ,   8                 ,9                     , 10                  , 11  ]
+    
+    ret = sql("select operation_no,opn_description,workstation,hour_rate,time_in_mins from `tabBOM Operation` where parent = %s", bom_no, as_dict = 1)
+    cost = sql("select dir_mat_as_per_mar , operating_cost , cost_as_per_mar from `tabBill Of Materials` where name = %s", bom_no, as_dict = 1)
+    # Validate the BOM ENTRIES
+    #check = get_obj('Bill Of Materials', bom_no, with_children =1).validate()
+    reply = []
+    for r in ret:
+      reply.append(['operation',cint(r['operation_no']), r['opn_description'] or '','%s'% bom_no,r['workstation'],flt(r['hour_rate']),flt(r['time_in_mins']),0,0,0])
+    reply[0][7]= flt(cost[0]['dir_mat_as_per_mar'])
+    reply[0][8]=flt(cost[0]['operating_cost']) 
+    reply[0][9]=flt(cost[0]['cost_as_per_mar'])
+    #msgprint(bom_no)
+    return reply
+
+  def get_item_bom(self,data):
+    # reply = ['item_bom',item_code,description,  BOM NO , qty, uom , scrap  ,m_avg_r  or value, 1 or 0]
+    # reply = [ 0        ,  1      ,       2   ,   3     , 4  , 5   ,  6     ,   7             ,   8   ]
+    data = eval(data)
+    reply = []
+    ret = sql("select item_code,description,bom_no,qty,scrap,stock_uom,value_as_per_mar,moving_avg_rate from `tabBOM Material` where parent = '%s' and operation_no = '%s'" % (data['bom_no'],data['op_no']), as_dict =1 )
+    
+    for r in ret:
+      item = sql("select is_manufactured_item, is_sub_contracted_item from `tabItem` where name = '%s'" % r['item_code'], as_dict=1)
+      if not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item'] =='Yes':
+        #msgprint("IS_PURCHASE")
+        #if item is not manufactured or it is not sub-contracted
+        reply.append([ 'item_bom', r['item_code'] or '', r['description'] or '', r['bom_no'] or '', flt(r['qty']) or 0, r['stock_uom'] or '', flt(r['scrap']) or 0, flt(r['moving_avg_rate']) or 0, 1])
+      else:
+        #msgprint("IS_NOT_PURCHASE")
+        # if it is manufactured or sub_contracted this will be considered(here item can be purchase item)
+        reply.append([ 'item_bom', r['item_code'] or '', r['description'] or '', r['bom_no'] or '', flt(r['qty']) or 0, r['stock_uom'] or '', flt(r['scrap']) or 0, flt(r['value_as_per_mar']) or 0, 0])
+    return reply
+
+
+
+  #------------- Wrapper Code --------------  
+  # BOM TREE   
+  def calculate_cost( self, bom_no):
+    main_bom_list = get_obj(dt = 'Production Control').traverse_bom_tree( bom_no = bom_no, qty = 1, calculate_cost = 1)
+    main_bom_list.reverse()
+    for bom in main_bom_list:
+      bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
+      bom_obj.calculate_cost(validate = 0)
+      bom_obj.doc.save()
+    return 'calculated'
+      
+
+  def get_bom_tree_list(self,args):
+    arg = eval(args)
+    i =[]
+    for a in sql("select t1.name from `tabBill Of Materials` t1, `tabItem` t2 where t2.item_group like '%s' and t1.item like '%s'"%(arg['item_group'] +'%',arg['item_code'] + '%')):
+      if a[0] not in i:
+        i.append(a[0]) 
+    return i
+#    return [s[0] for s in sql("select t1.name from `tabBill Of Materials` t1, `tabItem` t2 where t2.item_group like '%s'  and t1.item like '%s' " %(arg['item_group']+'%',arg['item_code'+'%'])]
\ No newline at end of file
diff --git a/production/doctype/bom_control/bom_control.txt b/production/doctype/bom_control/bom_control.txt
new file mode 100644
index 0000000..c126874
--- /dev/null
+++ b/production/doctype/bom_control/bom_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:30', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 108, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'BOM Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/production/doctype/bom_material/__init__.py b/production/doctype/bom_material/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bom_material/__init__.py
diff --git a/production/doctype/bom_material/bom_material.txt b/production/doctype/bom_material/bom_material.txt
new file mode 100644
index 0000000..ea978b3
--- /dev/null
+++ b/production/doctype/bom_material/bom_material.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:24', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 23, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'BOM Material', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00380', 'parent': 'BOM Material', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:24', 'modified': '2010-09-01 14:31:24', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00381', 'parent': 'BOM Material', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:24', 'modified': '2010-09-01 14:31:24', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'operation_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Operation No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02760', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'operation_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Material', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02761', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'bom_no', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'BOM No', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Material', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02762', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'bom_no', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Description', 'width': '250px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02763', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-12-03 17:38:07', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Qty', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03468', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-12-03 17:38:07', 'doctype': 'DocField', 'oldfieldname': 'scrap', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Scrap %', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03469', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'scrap', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02766', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:03:17', 'doctype': 'DocField', 'oldfieldname': 'dir_mat_as_per_mar', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Direct Material As Per Valuation Rate', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03615', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'dir_mat_as_per_mar', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:03:17', 'doctype': 'DocField', 'oldfieldname': 'dir_mat_as_per_lpr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Direct Material As Per LPR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03616', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'dir_mat_as_per_lpr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:03:17', 'doctype': 'DocField', 'oldfieldname': 'dir_mat_as_per_sr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Direct Material As Per SR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03617', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'dir_mat_as_per_sr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'operating_cost', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Operating Cost', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02768', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'operating_cost', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:03:17', 'doctype': 'DocField', 'oldfieldname': 'value_as_per_mar', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Value As Per Valuation Rate', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03618', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'value_as_per_mar', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:03:17', 'doctype': 'DocField', 'oldfieldname': 'value_as_per_lpr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Value As Per LPR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03619', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'value_as_per_lpr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:03:17', 'doctype': 'DocField', 'oldfieldname': 'value_as_per_sr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Value As Per SR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03620', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'value_as_per_sr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:24', 'doctype': 'DocField', 'oldfieldname': 'moving_avg_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Valuation Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02772', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'moving_avg_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 10:26:04', 'doctype': 'DocField', 'oldfieldname': 'amount_as_per_mar', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount As Per Valuation Rate', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03621', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'amount_as_per_mar', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-12-07 12:34:09', 'doctype': 'DocField', 'oldfieldname': 'last_purchase_rate', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Last Purchase Rate', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03479', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'last_purchase_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 09:36:59', 'doctype': 'DocField', 'oldfieldname': 'amount_as_per_lpr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount As Per LPR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03612', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'amount_as_per_lpr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 09:36:59', 'doctype': 'DocField', 'oldfieldname': 'standard_rate', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Standard Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03613', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'standard_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 09:36:59', 'doctype': 'DocField', 'oldfieldname': 'amount_as_per_sr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount As Per SR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03614', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'amount_as_per_sr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-17 16:45:50', 'doctype': 'DocField', 'oldfieldname': 'qty_consumed_per_unit', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Qty Consumed Per Unit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Material', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03611', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-09-01 14:31:24', 'parenttype': 'DocType', 'fieldname': 'qty_consumed_per_unit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/bom_operation/__init__.py b/production/doctype/bom_operation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bom_operation/__init__.py
diff --git a/production/doctype/bom_operation/bom_operation.txt b/production/doctype/bom_operation/bom_operation.txt
new file mode 100644
index 0000000..3281811
--- /dev/null
+++ b/production/doctype/bom_operation/bom_operation.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:21', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'BOM Operation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM00378', 'parent': 'BOM Operation', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:21', 'modified': '2010-07-13 12:46:20', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM00379', 'parent': 'BOM Operation', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:21', 'modified': '2010-07-13 12:46:20', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'operation_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Operation No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02750', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'operation_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'opn_description', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Opn Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02752', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'opn_description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02753', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'details', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'workstation', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Workstation', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02754', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'workstation', 'fieldtype': 'Link', 'options': 'Workstation', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'hour_rate', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Hour Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02755', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'hour_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'workstation_capacity', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Workstation Capacity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02756', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'workstation_capacity', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'time_in_mins', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Operation Time (mins)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02758', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'time_in_mins', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:21', 'doctype': 'DocField', 'oldfieldname': 'operating_cost', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Operating Cost', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Operation', 'search_index': None, 'allow_on_submit': 0, 'icon': None, 'name': 'FL02759', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-07-13 12:46:20', 'parenttype': 'DocType', 'fieldname': 'operating_cost', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/bom_replace_utility/__init__.py b/production/doctype/bom_replace_utility/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bom_replace_utility/__init__.py
diff --git a/production/doctype/bom_replace_utility/bom_replace_utility.js b/production/doctype/bom_replace_utility/bom_replace_utility.js
new file mode 100644
index 0000000..f01fdfd
--- /dev/null
+++ b/production/doctype/bom_replace_utility/bom_replace_utility.js
@@ -0,0 +1,20 @@
+
+// Get Query functions 
+cur_frm.fields_dict['s_bom'].get_query = function(doc) {
+  return 'SELECT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`docstatus` = 1 AND `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` DESC LIMIT 50';
+}
+
+cur_frm.fields_dict['r_bom'].get_query = function(doc) {
+  return 'SELECT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`docstatus` = 1 and `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` DESC LIMIT 50';
+}
+
+cur_frm.fields_dict['s_item'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabItem`.name FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND (`tabItem`.is_purchase_item = "Yes" OR`tabItem`.is_sub_contracted_item = "Yes") AND tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.item_code LIMIT 50';
+}
+
+cur_frm.fields_dict['r_item'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabItem`.name FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND (`tabItem`.is_purchase_item = "Yes" OR`tabItem`.is_sub_contracted_item = "Yes") AND tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.item_code LIMIT 50';
+}
+
+// Client Triggers
+
diff --git a/production/doctype/bom_replace_utility/bom_replace_utility.py b/production/doctype/bom_replace_utility/bom_replace_utility.py
new file mode 100644
index 0000000..9b64b77
--- /dev/null
+++ b/production/doctype/bom_replace_utility/bom_replace_utility.py
@@ -0,0 +1,127 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    
+  def search_parent_bom_of_bom(self):
+    pbom = sql("select parent from `tabBOM Material` where bom_no = '%s' and docstatus = 1 " % self.doc.s_bom )
+    self.doc.clear_table(self.doclist,'replace_bom_details', 1)
+    self.add_to_replace_bom_utility_detail(pbom, 'replace_bom_details')
+  
+  def search_parent_bom_of_item(self):
+    pbom = sql("select parent from `tabBOM Material` where item_code = '%s' and (bom_no is NULL or bom_no = '') and docstatus =1" % self.doc.s_item )
+    self.doc.clear_table(self.doclist,'replace_item_details', 1)
+    self.add_to_replace_bom_utility_detail(pbom, 'replace_item_details')
+    
+  def add_to_replace_bom_utility_detail(self, pbom, t_fname):
+    for d in pbom:
+      br_child = addchild( self.doc, t_fname, 'BOM Replace Utility Detail', 0,self.doclist)
+      br_child.parent_bom = d[0]
+      br_child.save()
+    self.doc.save()  
+    
+  def replace_bom(self):
+    # validate r_bom
+    bom = sql("select name, is_active, docstatus from `tabBill Of Materials` where name = %s",self.doc.r_bom, as_dict =1)
+    if not bom:
+      msgprint("Please Enter Valid BOM to replace with.")
+      raise Exception
+    if bom and bom[0]['is_active'] != 'Yes':
+      msgprint("BOM '%s' is not Active BOM." % cstr(self.doc.r_bom))
+      raise Exception
+    if bom and flt(bom[0]['docstatus']) != 1:
+      msgprint("BOM '%s' is not Submitted BOM." % cstr(self.doc.r_bom))
+      raise Exception
+    
+    # get item code of r_bom
+    item_code = cstr(sql("select item from `tabBill Of Materials` where name = '%s' " % self.doc.r_bom)[0][0])
+    # call replace bom engine
+    self.replace_bom_engine('replace_bom_details', 'bom_no', self.doc.s_bom, self.doc.r_bom, item_code)
+  
+  def replace_item(self):
+    item = sql("select name, is_active from `tabItem` where name = %s", self.doc.r_item, as_dict = 1)
+    if not item:
+      msgprint("Please enter Valid Item Code to replace with.")
+      raise Exception
+    if item and item[0]['is_active'] != 'Yes':
+      msgprint("Item Code '%s' is not Active Item." % cstr(self.doc.r_item))
+      raise Exception
+    self.replace_bom_engine('replace_item_details', 'item_code', self.doc.s_item, self.doc.r_item)
+    
+  def replace_data_in_bom_materials(self, dl, fname, s_data, r_data, item_code =''):
+    for d in getlist(dl, 'bom_materials'):
+      if d.fields[fname] == s_data:
+        d.fields[fname] = r_data
+        if fname == 'bom_no':
+          d.item_code = item_code
+        d.save()
+
+  def replace_bom_engine(self, t_fname, fname, s_data, r_data, item_code = ''):
+    if not r_data:
+      msgprint("Please Enter '%s' and then click on '%s'." % ((t_fname == 'replace_bom_details') and 'BOM to Replace' or 'Item to Replace',(t_fname == 'replace_bom_details') and 'Replace BOM' or 'Replace Item' ))
+      raise Exception
+      
+    for d in getlist(self.doclist, t_fname):
+      if d.bom_created:
+        msgprint("Please click on '%s' and then on '%s'." % ((t_fname == 'replace_bom_details') and 'Search BOM' or 'Search Item',(t_fname == 'replace_bom_details') and 'Replace BOM' or 'Replace Item' ))
+        raise Exception
+        
+      if d.replace:
+        # copy_doclist is the framework funcn which create duplicate document and returns doclist of new document
+        # Reinder := 
+        # make copy
+        if self.doc.create_new_bom:
+          import webnotes.model.doc
+          new_bom_dl = copy_doclist(webnotes.model.doc.get('Bill Of Materials', d.parent_bom), no_copy = ['is_active', 'is_default', 'is_sub_assembly', 'remarks', 'flat_bom_details'])
+        
+          new_bom_dl[0].docstatus = 0
+          new_bom_dl[0].save()
+        else:
+          new_bom_dl = get_obj('Bill Of Materials', d.parent_bom, with_children = 1).doclist
+
+        # replace s_data with r_data in Bom Material Detail Table
+        self.replace_data_in_bom_materials(new_bom_dl, fname, s_data, r_data, item_code)
+       
+        d.bom_created = new_bom_dl[0].name
+        d.save()
+
+  def update_docstatus(self):
+    sql("update `tabBill Of Materials` set docstatus = 0 where  name = '%s' limit 1" % self.doc.bom)
+    msgprint("Updated")
+
+  def update_bom(self):
+    self.check_bom_list = []
+    main_bom_list = get_obj('Production Control').traverse_bom_tree(self.doc.fg_bom_no, 1)
+    main_bom_list.reverse()
+    # run calculate cost and get
+    #msgprint(main_bom_list)
+    for bom in main_bom_list:
+      if bom and bom not in self.check_bom_list:
+        bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
+        #print(bom_obj.doc.fields)
+        bom_obj.validate()
+        bom_obj.doc.docstatus = 1
+        bom_obj.check_recursion()
+        bom_obj.update_flat_bom_engine(is_submit = 1)
+        bom_obj.doc.docstatus = 1
+        bom_obj.doc.save()
+        self.check_bom_list.append(bom)
diff --git a/production/doctype/bom_replace_utility/bom_replace_utility.txt b/production/doctype/bom_replace_utility/bom_replace_utility.txt
new file mode 100644
index 0000000..5d466b7
--- /dev/null
+++ b/production/doctype/bom_replace_utility/bom_replace_utility.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-01-14 12:07:32', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 1, 'max_attachments': None, 'version': 57, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'BOM Replace Utility', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00591', 'parent': 'BOM Replace Utility', 'read': 1, 'create': 1, 'creation': '2010-01-14 12:11:48', 'modified': '2010-09-08 14:37:04', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00702', 'parent': 'BOM Replace Utility', 'read': 1, 'create': None, 'creation': '2010-03-15 13:27:30', 'modified': '2010-09-08 14:37:04', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00700', 'parent': 'BOM Replace Utility', 'read': 1, 'create': 1, 'creation': '2010-03-15 13:26:46', 'modified': '2010-09-08 14:37:04', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00703', 'parent': 'BOM Replace Utility', 'read': 1, 'create': None, 'creation': '2010-03-15 13:27:30', 'modified': '2010-09-08 14:37:04', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00701', 'parent': 'BOM Replace Utility', 'read': 1, 'create': 1, 'creation': '2010-03-15 13:26:46', 'modified': '2010-09-08 14:37:04', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Production Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00704', 'parent': 'BOM Replace Utility', 'read': 1, 'create': None, 'creation': '2010-03-15 13:27:30', 'modified': '2010-09-08 14:37:04', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'Production Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-09 09:11:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Create New BOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05553', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'create_new_bom', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:11:19', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'BOM Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03585', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:11:19', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Select BOM', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select the relevant BOM to be replaced which is actually a raw material used for a parent BOM.', 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03586', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 's_bom', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 14:39:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Note 1', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05800', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': 'Click on the button "Search BOM" to fetch in the table below all the parent BOMs in which the above selected BOM is used as a raw material.', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 16:57:21', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03601', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:11:19', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Search BOM', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03588', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'search_parent_bom_of_bom', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 14:27:23', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05799', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:11:19', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Replace Bom with', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select the BOM by which you want the above sected BOM to be replaced.', 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03587', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'r_bom', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 14:58:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Note 2', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05801', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': 'Click on the button "Replace BOM" after checking under the column Replace against relevant Parent BOMs', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 14:27:23', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05798', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:11:19', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Replace BOM', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03589', 'idx': 11, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'replace_bom', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 16:57:21', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03602', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:26:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Replace BOM Detail', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03598', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'replace_bom_details', 'fieldtype': 'Table', 'options': 'BOM Replace Utility Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:13:54', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Item Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03590', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:13:54', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Select Item', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select the relevant item to be replaced which is actually a raw material used for a parent BOM.', 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03591', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 's_item', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 15:26:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Note 3', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05804', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'HTML', 'options': 'Click on the button "Search Item" to fetch in the table below all the parent BOMs in which the above selected item is used as a raw material.', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 16:57:21', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03600', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:21:03', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Search Item', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03596', 'idx': 18, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'search_parent_bom_of_item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 15:01:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05802', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:13:54', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Replace Item with', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select the item by which you want the above sected item to be replaced.', 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03592', 'idx': 20, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'r_item', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 15:26:45', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Note 4', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05805', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': 'Click on the button "Replace Item" after checking under the column Replace against relevant Parent BOMs', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-03 15:01:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05803', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:21:03', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Replace Item', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03597', 'idx': 23, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'replace_item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 16:57:21', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03603', 'idx': 24, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-14 12:26:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Replace Item Detail', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03599', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'replace_item_details', 'fieldtype': 'Table', 'options': 'BOM Replace Utility Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-13 15:09:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update BOM Tree', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05607', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-13 15:09:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'FG BOM No', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select the root Bill of Materials in which raw materials are replaced and click on the button below to update costs.', 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05608', 'idx': 27, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'fg_bom_no', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-13 15:09:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05609', 'idx': 28, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_bom', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-13 15:09:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update BOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05610', 'idx': 29, 'default': None, 'colour': None, 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-13 15:09:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'BOM', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': '', 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05611', 'idx': 30, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': 'bom', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-13 15:09:10', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update Docstatus', 'width': '', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05612', 'idx': 31, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-08 14:37:04', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_docstatus', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/bom_replace_utility_detail/__init__.py b/production/doctype/bom_replace_utility_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bom_replace_utility_detail/__init__.py
diff --git a/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt b/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
new file mode 100644
index 0000000..1bc8650
--- /dev/null
+++ b/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-14 12:17:12', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'BRUD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'BOM Replace Utility Detail', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM00985', 'parent': 'BOM Replace Utility Detail', 'read': 1, 'create': 0, 'creation': '2010-04-29 10:17:25', 'modified': '2010-04-29 10:17:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-14 12:19:28', 'doctype': 'DocField', 'oldfieldname': 'parent_bom', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Parent BOM', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Replace Utility Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03593', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-29 10:17:25', 'parenttype': 'DocType', 'fieldname': 'parent_bom', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2010-01-14 12:19:28', 'doctype': 'DocField', 'oldfieldname': 'replace', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Replace', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Replace Utility Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03594', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-29 10:17:25', 'parenttype': 'DocType', 'fieldname': 'replace', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-14 12:19:28', 'doctype': 'DocField', 'oldfieldname': 'bom_created', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'BOM Created', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Replace Utility Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03595', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-29 10:17:25', 'parenttype': 'DocType', 'fieldname': 'bom_created', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/bom_report_detail/__init__.py b/production/doctype/bom_report_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/bom_report_detail/__init__.py
diff --git a/production/doctype/bom_report_detail/bom_report_detail.txt b/production/doctype/bom_report_detail/bom_report_detail.txt
new file mode 100644
index 0000000..f030490
--- /dev/null
+++ b/production/doctype/bom_report_detail/bom_report_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:33', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'wasim@webnotestech.com', 'document_type': None, 'name': 'BOM Report Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'wasim@webnotestech.com', 'name': 'PERM00382', 'parent': 'BOM Report Detail', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:33', 'modified': '2009-12-04 12:04:07', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'wasim@webnotestech.com', 'name': 'PERM00383', 'parent': 'BOM Report Detail', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:33', 'modified': '2009-12-04 12:04:07', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:33', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'BOM Report Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02776', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:33', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Description', 'width': '250px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Report Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02777', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:33', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Qty', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Report Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02778', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:33', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Report Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02779', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:33', 'doctype': 'DocField', 'oldfieldname': 'moving_avg_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Moving Avg Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Report Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02780', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'moving_avg_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:33', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Report Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02781', 'idx': 6, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-12-03 18:06:08', 'doctype': 'DocField', 'oldfieldname': 'last_purchase_rate', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Last Purchase Rate', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'BOM Report Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03471', 'idx': 7, 'default': None, 'colour': None, 'modified': '2009-12-04 12:04:07', 'parenttype': 'DocType', 'fieldname': 'last_purchase_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/flat_bom_detail/__init__.py b/production/doctype/flat_bom_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/flat_bom_detail/__init__.py
diff --git a/production/doctype/flat_bom_detail/flat_bom_detail.txt b/production/doctype/flat_bom_detail/flat_bom_detail.txt
new file mode 100644
index 0000000..3fc184e
--- /dev/null
+++ b/production/doctype/flat_bom_detail/flat_bom_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-11 17:57:57', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'FBD/.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Flat BOM Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03556', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03557', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03558', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03559', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'moving_avg_rate', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Valuation Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03560', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'moving_avg_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'amount_as_per_mar', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Amount As Per Valuation Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03561', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'amount_as_per_mar', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'last_purchase_rate', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Last Purchase Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03562', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'last_purchase_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 15:23:27', 'doctype': 'DocField', 'oldfieldname': 'amount_as_per_lpr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Amount As Per LPR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03636', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'amount_as_per_lpr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 15:21:42', 'doctype': 'DocField', 'oldfieldname': 'standard_rate', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Standard Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03635', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'standard_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-19 15:23:27', 'doctype': 'DocField', 'oldfieldname': 'amount_as_per_sr', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Amount As Per SR', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03637', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'amount_as_per_sr', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-13 16:18:34', 'doctype': 'DocField', 'oldfieldname': 'qty_consumed_per_unit', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Qty Consumed Per Unit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03572', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'qty_consumed_per_unit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-12 10:58:43', 'doctype': 'DocField', 'oldfieldname': 'flat_bom_no', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Flat BOM No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03566', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'flat_bom_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'bom_mat_no', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'BOM Mat No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03563', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'bom_mat_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-11 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'parent_bom', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Parent BOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03564', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'parent_bom', 'fieldtype': 'Link', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-02-08 12:37:51', 'doctype': 'DocField', 'oldfieldname': 'is_pro_applicable', 'owner': 'jai@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Is PRO Applicable', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Flat BOM Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03956', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-07-15 10:50:52', 'parenttype': 'DocType', 'fieldname': 'is_pro_applicable', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/pf_detail/__init__.py b/production/doctype/pf_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/pf_detail/__init__.py
diff --git a/production/doctype/pf_detail/pf_detail.txt b/production/doctype/pf_detail/pf_detail.txt
new file mode 100644
index 0000000..a835dae
--- /dev/null
+++ b/production/doctype/pf_detail/pf_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:39', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'PFD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'PF Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00386', 'parent': 'PF Detail', 'read': 1, 'create': 1, 'creation': '2009-08-31 15:17:39', 'modified': '2010-03-31 10:48:34', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00387', 'parent': 'PF Detail', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:39', 'modified': '2010-03-31 10:48:34', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Code', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PF Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02804', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02805', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02806', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Quantity', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02807', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'planned_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Planned Quantity', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02808', 'idx': 5, 'default': '0.00', 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'planned_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'produced_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Produced Quantity', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02809', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'produced_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'start_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 0, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Start Date', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PF Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL02810', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'start_date', 'fieldtype': 'Date', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'end_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 0, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'End Date', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PF Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL02811', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'end_date', 'fieldtype': 'Date', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'forecast_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Forecast Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02812', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'forecast_date', 'fieldtype': 'Date', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:39', 'doctype': 'DocField', 'oldfieldname': 'forecast_due_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Forecast Due Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PF Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02813', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:34', 'parenttype': 'DocType', 'fieldname': 'forecast_due_date', 'fieldtype': 'Date', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/pp_detail/__init__.py b/production/doctype/pp_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/pp_detail/__init__.py
diff --git a/production/doctype/pp_detail/pp_detail.txt b/production/doctype/pp_detail/pp_detail.txt
new file mode 100644
index 0000000..342adfa
--- /dev/null
+++ b/production/doctype/pp_detail/pp_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:51', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 21, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'PPID/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'PP Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-28 15:19:56', 'doctype': 'DocField', 'oldfieldname': 'source_doctype', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Against Document ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03872', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'source_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-28 15:19:56', 'doctype': 'DocField', 'oldfieldname': 'source_docname', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Document No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03873', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'source_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-28 15:19:56', 'doctype': 'DocField', 'oldfieldname': 'source_detail_docname', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Document Detail No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03874', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'source_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-09-26 13:40:26', 'doctype': 'DocField', 'oldfieldname': 'parent_item', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Parent Item', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03095', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'parent_item', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02847', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'document_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Document Date', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02848', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'document_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'confirmation_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Confirmed Delivery Date', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02849', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'confirmation_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'bom_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'BOM No', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02850', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'bom_no', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Description', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02851', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Stock UOM', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02852', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:51', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_reqd_qty', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Total Reqd Qty', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02853', 'idx': 11, 'default': '0.00', 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'prevdoc_reqd_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:52', 'doctype': 'DocField', 'oldfieldname': 'planned_qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Planned Quantity', 'width': '180px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02857', 'idx': 12, 'default': '0.00', 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'planned_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:52', 'doctype': 'DocField', 'oldfieldname': 'produced_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Produced Qty', 'width': '130px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02858', 'idx': 13, 'default': '0.00', 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'produced_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2010-02-18 12:45:30', 'doctype': 'DocField', 'oldfieldname': 'pro_created', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'PRO Created', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03990', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'pro_created', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-08-31 15:17:52', 'doctype': 'DocField', 'oldfieldname': 'mrp', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Already MRP Considered', 'width': '140px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02859', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-07-19 11:35:48', 'parenttype': 'DocType', 'fieldname': 'mrp', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/pp_so_detail/__init__.py b/production/doctype/pp_so_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/pp_so_detail/__init__.py
diff --git a/production/doctype/pp_so_detail/pp_so_detail.txt b/production/doctype/pp_so_detail/pp_so_detail.txt
new file mode 100644
index 0000000..d5f798d
--- /dev/null
+++ b/production/doctype/pp_so_detail/pp_so_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:45', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'PP/.SO/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'PP SO Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM00392', 'parent': 'PP SO Detail', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:45', 'modified': '2010-01-27 16:32:43', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM00393', 'parent': 'PP SO Detail', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:45', 'modified': '2010-01-27 16:32:43', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:45', 'doctype': 'DocField', 'oldfieldname': 'prevdoc', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Against Document', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP SO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02836', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-01-27 16:32:43', 'parenttype': 'DocType', 'fieldname': 'prevdoc', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:45', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Document No', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP SO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02837', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-01-27 16:32:43', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-08-31 15:17:45', 'doctype': 'DocField', 'oldfieldname': 'document_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Document Date', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP SO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02838', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-01-27 16:32:43', 'parenttype': 'DocType', 'fieldname': 'document_date', 'fieldtype': 'Date', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-01-27 16:09:09', 'doctype': 'DocField', 'oldfieldname': 'confirmation_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Confirmation Date', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PP SO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03852', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-01-27 16:32:43', 'parenttype': 'DocType', 'fieldname': 'confirmation_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-08-31 15:17:45', 'doctype': 'DocField', 'oldfieldname': 'include_in_plan', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Include In Plan', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PP SO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02840', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-01-27 16:32:43', 'parenttype': 'DocType', 'fieldname': 'include_in_plan', 'fieldtype': 'Check', 'options': '', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/ppw_detail/__init__.py b/production/doctype/ppw_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/ppw_detail/__init__.py
diff --git a/production/doctype/ppw_detail/ppw_detail.txt b/production/doctype/ppw_detail/ppw_detail.txt
new file mode 100644
index 0000000..ffb9ce6
--- /dev/null
+++ b/production/doctype/ppw_detail/ppw_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:49', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'PPWD/.#######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'PPW Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:49', 'doctype': 'DocField', 'oldfieldname': 'warehouse', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Warehouse', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PPW Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02843', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:48:47', 'parenttype': 'DocType', 'fieldname': 'warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/pro_detail/__init__.py b/production/doctype/pro_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/pro_detail/__init__.py
diff --git a/production/doctype/pro_detail/pro_detail.txt b/production/doctype/pro_detail/pro_detail.txt
new file mode 100644
index 0000000..4710cd5
--- /dev/null
+++ b/production/doctype/pro_detail/pro_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:58', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'PRODC/.#######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'PRO Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02886', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02887', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'source_warehouse', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Source Warehouse', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02888', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'source_warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'actual_qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Current Stock', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02889', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'actual_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02890', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'qty_reqd', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Qty Reqd', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02891', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'qty_reqd', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'issued_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Issued Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02892', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'issued_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:58', 'doctype': 'DocField', 'oldfieldname': 'consumed_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Consumed Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02893', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'consumed_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-02-08 15:21:40', 'doctype': 'DocField', 'oldfieldname': 'qty_consumed_per_unit', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Qty Consumed Per Unit', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03957', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-02-08 17:24:46', 'parenttype': 'DocType', 'fieldname': 'qty_consumed_per_unit', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/pro_pp_detail/__init__.py b/production/doctype/pro_pp_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/pro_pp_detail/__init__.py
diff --git a/production/doctype/pro_pp_detail/pro_pp_detail.txt b/production/doctype/pro_pp_detail/pro_pp_detail.txt
new file mode 100644
index 0000000..b7ed649
--- /dev/null
+++ b/production/doctype/pro_pp_detail/pro_pp_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-10-16 16:29:24', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'PRO PP Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-10-16 16:34:49', 'doctype': 'DocField', 'oldfieldname': 'source_doctype', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Source Doctype', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03242', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'source_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-10-16 16:34:49', 'doctype': 'DocField', 'oldfieldname': 'source_docname', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Source Docname', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03243', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'source_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-02 01:01:26', 'doctype': 'DocField', 'oldfieldname': 'source_detail_docname', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Source Detail Docname ', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03264', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'source_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-10-16 16:34:49', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_detail_docname', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Prevdoc Detail Docname', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03246', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'prevdoc_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-10-16 16:37:17', 'doctype': 'DocField', 'oldfieldname': 'confirm_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Confirm Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03247', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'confirm_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-10-16 16:37:17', 'doctype': 'DocField', 'oldfieldname': 'qty_reqd', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Qty Reqd', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03248', 'idx': 6, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'qty_reqd', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-10-16 16:37:17', 'doctype': 'DocField', 'oldfieldname': 'produced_qty', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Produced Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03249', 'idx': 7, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'produced_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-10-23 06:54:42', 'doctype': 'DocField', 'oldfieldname': 'update', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PRO PP Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03258', 'idx': 8, 'default': None, 'colour': None, 'modified': '2009-11-02 01:01:26', 'parenttype': 'DocType', 'fieldname': 'update', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/production_control/__init__.py b/production/doctype/production_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/production_control/__init__.py
diff --git a/production/doctype/production_control/production_control.py b/production/doctype/production_control/production_control.py
new file mode 100644
index 0000000..36db7dd
--- /dev/null
+++ b/production/doctype/production_control/production_control.py
@@ -0,0 +1,155 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__( self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    # pur_items = {'item_code':req_qty}
+    self.pur_items = {}
+    # bom_list = [[]]
+    self.bom_list = []
+    # list for sub assembly item
+    self.sub_assembly_items = []
+    # Item Master 
+    self.item_master = {}
+
+  def traverse_bom_tree( self, bom_no, qty, ext_pur_items = 0, ext_sub_assembly_items = 0, calculate_cost = 0, maintain_item_master = 0 ):
+    count, bom_list, qty_list = 0, [bom_no], [qty]
+    while (count < len(bom_list)):
+      # get child items from BOM MAterial Table.
+      child_items = sql("select item_code, bom_no, qty, qty_consumed_per_unit from `tabBOM Material` where parent = %s", bom_list[count], as_dict = 1)
+      child_items = child_items and child_items or []
+      #msgprint(bom_list[count])
+      #msgprint(qty_list)
+      for item in child_items:
+        # Calculate qty required for FG's qty.
+        item['reqd_qty'] = flt(qty) * ((count == 0) and 1 or flt(qty_list[count]) )* flt(item['qty_consumed_per_unit'])
+        #gprint("Item Reqd : " + cstr(item['reqd_qty']))
+
+        # extracting Purchase Items
+        if ext_pur_items and not item['bom_no']:
+          # item exist in pur_items dict then just add qty with previous qty
+          if self.pur_items.has_key(item['item_code']):
+            self.pur_items[item['item_code']] = flt(self.pur_items[item['item_code']]) + flt(item['reqd_qty'])
+            # maintain item master
+            #if maintain_item_master:
+              
+          # else add item in pur_item dict with reqd qty.
+          else:
+            self.pur_items[item['item_code']] = flt(item['reqd_qty'])
+            # maintain item master
+            #if maintain_item_master:
+              
+        # For calculate cost extracting BOM Items check for duplicate boms, this optmizes the time complexity for while loop.
+        if calculate_cost and item['bom_no'] and (item['bom_no'] not in bom_list):
+          bom_list.append(item['bom_no'])
+          qty_list.append(item['reqd_qty'])
+
+        # Here repeated bom are considered to calculate total qty of raw material required
+        if not calculate_cost and item['bom_no']:
+          # append bom to bom_list
+          bom_list.append(item['bom_no'])
+          qty_list.append(item['reqd_qty'])
+
+#          # extracting Sub Assembly Items . Make Sure Sub Assembly Items have BOM No. in BOM MATERIAL
+#          if ext_sub_assembly_items:
+#            # If Production Order Applicable is 'Yes'
+#            if item['pro_applicable#'] == "Yes":
+#              # append item in sub_assembly_items
+#              self.sub_assembly_items.append([item['item_code']])
+#              # Remove current bom from bom_list
+#              bom_list.pop()
+
+      count += 1
+    return bom_list
+
+
+
+  #  Raise Production Order
+  def create_production_order(self,company, fy, pp_detail = '', pro_detail = ''):
+    pro_lbl = {'production_item': 0, 'description': 1, 'qty' : 2, 'stock_uom' : 3, 'bom_no': 4, 'consider_sa_items': 5}
+           
+    default_values = { 'transaction_date'            : now(),
+                       'origin'          : pp_detail and 'MRP' or 'Direct',
+                       'wip_warehouse'   : 'MB1-Stores',
+                       'status'          : 'Draft',
+                       'company'         : company,
+                       'fiscal_year'     : fy }
+     
+    pro_list, count = pp_detail and pp_detail or pro_detail, 0
+
+    while (count < len(pro_list)):
+      pro_doc = Document('Production Order')
+
+      for key in pro_lbl.keys():
+        pro_doc.fields[key] = pro_list[count][pro_lbl[key]]
+      
+      for key in default_values:
+        pro_doc.fields[key] = default_values[key]
+      
+      pro_doc.save(new = 1)
+      pro_list[count] = pro_doc.name
+      
+      # This was for adding raw materials in pro detail and get sa items
+      #sa_list = get_obj('Porduction Order', pro_doc.name, with_children = 1).get_purchase_item( get_sa_items = 1, add_child= 1)
+      #for sa_item in sa_list:
+      #  pro_list.append(sa_item)
+
+      count = count + 1
+    return pro_list
+
+
+  def update_bom(self, bom_no):
+    main_bom_list = self.traverse_bom_tree(bom_no, 1)
+    main_bom_list.reverse()
+    #print('--------------')
+    msgprint(main_bom_list)
+    #print('--------------')
+    # run calculate cost and get
+    for bom in main_bom_list:
+      if bom and bom not in self.check_bom_list:
+        #print(bom)
+        bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
+        #print(bom_obj.doc.fields)
+        bom_obj.doc.save()
+        bom_obj.check_recursion()
+        bom_obj.update_flat_bom_engine()
+        bom_obj.doc.docstatus = 1
+        bom_obj.doc.save()
+        self.check_bom_list.append(bom)
+        #errprint(" " + cstr(bom) + " has been submitted successfully.")
+        
+
+  def update_all_fg(self):
+    self.check_bom_list = []
+    #pc_obj = get_obj(dt = 'Production Control')
+    cn_bom = sql("select name from `tabBill Of Materials` where item not like 'CN%' and item not like 'LDR%' and item not like 'HD%' limit 1")
+    #cn_bom = (('BOM/A012629/001',),)
+    i=1
+    #msgprint(cn_bom)
+    for d in cn_bom:
+      if not cstr(d[0]) in self.check_bom_list:
+        print('Main BOM')
+        msgprint(d[0])
+        msgprint(i)
+        #sql("start transaction")
+        #self.update_bom(d[0])
+        #sql("commit")
+        i += 1
\ No newline at end of file
diff --git a/production/doctype/production_control/production_control.txt b/production/doctype/production_control/production_control.txt
new file mode 100644
index 0000000..d738273
--- /dev/null
+++ b/production/doctype/production_control/production_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-09-07 18:57:06', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 19, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Production Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/production/doctype/production_order/__init__.py b/production/doctype/production_order/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/production_order/__init__.py
diff --git a/production/doctype/production_order/production_order.js b/production/doctype/production_order/production_order.js
new file mode 100644
index 0000000..731ce1a
--- /dev/null
+++ b/production/doctype/production_order/production_order.js
@@ -0,0 +1,113 @@
+$import(Production Tips Common)
+
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+
+  if (!doc.fiscal_year && doc.__islocal){ set_default_values(doc);}
+  if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
+  if (!doc.status) doc.status = 'Draft';
+  cfn_set_fields(doc, cdt, cdn);
+  if (doc.origin != "MRP"){
+    doc.origin = "Manual"; 
+    //get_field('Production Order', 'consider_sa_items').permlevel = 0;
+    set_field_permlevel('production_item', 0);
+    set_field_permlevel('bom_no', 0);
+    set_field_permlevel('consider_sa_items',0);
+    
+  }
+}
+// ================================== Refresh ==========================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
+
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  cfn_set_fields(doc, cdt, cdn);
+}
+
+cur_frm.fields_dict['production_item'].get_query = function(doc) {
+   return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+// ---------------------- Get project name --------------------------
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['bom_no'].get_query = function(doc)  {
+  if (doc.production_item){
+    return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.`item` = "' + cstr(doc.production_item) + '" AND`tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
+  }
+  else {
+    alert(" Please Enter Production Item First.")
+  }
+}
+
+cur_frm.cscript.production_item = function(doc, cdt, cdn) {
+  get_server_fields('get_item_detail',doc.production_item,'',doc,cdt,cdn,1);
+}
+
+var cfn_set_fields = function(doc, cdt, cdn) {
+  hide_field('Material Transfer');
+  hide_field('Stop Production Order');
+  hide_field('Unstop Production Order')
+  hide_field('Backflush');
+  if (doc.docstatus == 1){
+    unhide_field('Stop Production Order');
+    if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
+      unhide_field(['Material Transfer','Backflush']);
+    }
+    else if (doc.status == 'Stopped'){
+      unhide_field('Unstop Production Order');
+      hide_field(['Stop Production Order', 'Material Transfer', 'Backflush']);
+    }
+    else if (doc.status == 'Completed'){
+      hide_field(['Stop Production Order', 'Material Transfer', 'Backflush']);
+    }
+  }
+ 
+}
+
+// Stop PRODUCTION ORDER
+// ==================================================================================================
+cur_frm.cscript['Stop Production Order'] = function(doc,cdt,cdn) {
+  var check = confirm("DO YOU REALLY WANT TO Stop PRODUCTION ORDER : " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+  }
+}
+
+// Unstop PRODUCTION ORDER
+// ==================================================================================================
+cur_frm.cscript['Unstop Production Order'] = function(doc,cdt,cdn) {
+  var check = confirm("DO YOU REALLY WANT TO Unstop PRODUCTION ORDER : " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'update_status', 'arg': 'Unstopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+  }
+}
+
+cur_frm.cscript['Material Transfer'] = function(doc,cdt,cdn) {
+  cur_frm.cscript.make_se(doc, process = 'Material Transfer');
+}
+
+cur_frm.cscript['Backflush'] = function(doc,cdt,cdn) {
+  cur_frm.cscript.make_se(doc, process = 'Backflush');
+}
+
+cur_frm.cscript.make_se = function(doc, process) {
+  var se = LocalDB.create('Stock Entry');
+  se = locals['Stock Entry'][se];
+  se.purpose = 'Production Order';
+  se.process = process;
+  se.posting_date = doc.posting_date;
+  se.production_order = doc.name; 
+  se.fiscal_year = doc.fiscal_year;
+  se.company = doc.company;
+  
+  loaddoc('Stock Entry', se.name);
+}
diff --git a/production/doctype/production_order/production_order.py b/production/doctype/production_order/production_order.py
new file mode 100644
index 0000000..ce8f082
--- /dev/null
+++ b/production/doctype/production_order/production_order.py
@@ -0,0 +1,104 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  # Autoname
+  def autoname(self):
+    p = self.doc.fiscal_year
+    self.doc.name = make_autoname('PRO/' + self.doc.fiscal_year[2:5]+self.doc.fiscal_year[7:9] + '/.######')
+
+  def get_item_detail(self, production_item):
+    item = sql("select description, stock_uom, default_bom from `tabItem` where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now()) and name = %s", production_item, as_dict = 1 )
+    ret = {
+            'description' : item and item[0]['description'] or '',
+            'stock_uom'   : item and item[0]['stock_uom'] or '',
+            'default_bom' : item and item[0]['default_bom'] or ''
+    }
+    return cstr(ret)
+    
+  def validate(self):
+    if not self.doc.production_item :
+      msgprint("Please enter Production Item")
+      raise Exception
+    if self.doc.production_item :
+      item_detail = sql("select docstatus from `tabItem` where name = '%s'" % self.doc.production_item, as_dict = 1)
+      if not item_detail:
+        msgprint("Item '%s' do not exist in the system." % cstr(self.doc.production_item))
+        raise Exception
+      if item_detail[0]['docstatus'] == 2:
+        msgprint("Item '%s' is Trashed Item ."% self.doc.production_item)
+        raise Exception
+    if self.doc.bom_no:
+      bom_detail = sql("select item, is_active, docstatus from `tabBill Of Materials` where name = '%s'" % self.doc.bom_no, as_dict =1)
+      if not bom_detail:
+        msgprint("BOM No '%s' do not exist in the system." % cstr(self.doc.bom_no))
+        raise Exception
+      if cstr(bom_detail[0]['item']) != cstr(self.doc.production_item):
+        msgprint("The Item '%s' in BOM := '%s' do not match with Produciton Item '%s'." % (cstr(bom_detail[0]['item']), cstr(self.doc.bom_no), cstr(self.doc.production_item)))
+        raise Exception
+      if cstr(bom_detail[0]['is_active']) != 'Yes':
+        msgprint("BOM := '%s' is not Active BOM." % self.doc.bom_no)
+        raise Exception
+      if flt(bom_detail[0]['docstatus']) != 1:
+        msgprint("BOM := '%s' is not Submitted BOM." % self.doc.bom_no)
+        raise Exception
+  
+  def update_status(self, status):
+    # Set Status
+    if status == 'Stopped':
+      set(self.doc, 'status', cstr(status))
+    else:
+      if flt(self.doc.qty) == flt(self.doc.produced_qty):
+        set(self.doc, 'status', 'Completed')
+      if flt(self.doc.qty) > flt(self.doc.produced_qty):
+        set(self.doc, 'status', 'In Process')
+      if flt(self.doc.produced_qty) == 0:
+        set(self.doc, 'status', 'Submitted')
+
+    # Update Planned Qty of Production Item
+    qty = (flt(self.doc.qty) - flt(self.doc.produced_qty)) * ((status == 'Stopped') and -1 or 1)
+    get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0, flt(qty), self.doc.production_item, now())
+    
+    # Acknowledge user
+    msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s and status has been updated as %s." % (cstr(status), cstr(self.doc.status)))
+
+  def on_submit(self):
+    # Set Status AS "Submitted"
+    set(self.doc,'status', 'Submitted')
+
+    # increase Planned Qty of Prooduction Item by Qty
+    get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0,flt(self.doc.qty), self.doc.production_item, now())
+
+
+  def on_cancel(self):
+    # Stock Entries Against this Production Order
+    st = sql("select name from `tabStock Entry` where production_order = '%s' and docstatus = 1" % cstr(self.doc.name))
+    if st and st[0][0]:
+      msgprint("Stock Entry "+ cstr(st[0][0]) + " has already been submitted.")
+      raise Exception
+
+    # Set Status AS "Submitted"
+    set(self.doc,'status', 'Cancelled')
+    
+    # decrease Planned Qty of Prooduction Item by Qty
+    get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0,-flt(self.doc.qty), self.doc.production_item, now())
diff --git a/production/doctype/production_order/production_order.txt b/production/doctype/production_order/production_order.txt
new file mode 100644
index 0000000..8369732
--- /dev/null
+++ b/production/doctype/production_order/production_order.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-08-31 15:17:54', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 182, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': '', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Production Order', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00394', 'parent': 'Production Order', 'read': 1, 'create': 1, 'creation': '2009-08-31 15:17:54', 'modified': '2010-08-19 14:33:20', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00395', 'parent': 'Production Order', 'read': 1, 'create': None, 'creation': '2009-08-31 15:17:54', 'modified': '2010-08-19 14:33:20', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00396', 'parent': 'Production Order', 'read': 1, 'create': 1, 'creation': '2009-08-31 15:17:54', 'modified': '2010-08-19 14:33:20', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Production Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00397', 'parent': 'Production Order', 'read': 1, 'create': 1, 'creation': '2009-08-31 15:17:54', 'modified': '2010-08-19 14:33:20', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-08-31 15:17:54', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Production Order', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02860', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-02-08 12:00:59', 'doctype': 'DocField', 'oldfieldname': 'transaction_date', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Transaction Date', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date on which current entry is made in system.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03955', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'transaction_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-03-26 10:51:33', 'doctype': 'DocField', 'oldfieldname': 'posting_date', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Posting Date', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date on which current entry will get or has actually executed.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04143', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'posting_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'production_item', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Production Item', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': 'Item for which this Production Order is raised.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02867', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'production_item', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02868', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Qty', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Quantity of item for which Production Order is raised.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02871', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'bom_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'BOM No', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': 'Bill of Material which was considered for manufacturing the production item.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02869', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'bom_no', 'fieldtype': 'Link', 'options': 'Bill Of Materials', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2009-08-31 15:17:54', 'doctype': 'DocField', 'oldfieldname': 'origin', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Origin', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02862', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'origin', 'fieldtype': 'Select', 'options': 'Manual\nMRP', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-19 14:33:20', 'doctype': 'DocField', 'oldfieldname': 'project_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Project Name', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select name of the project if Production Order need to be created against any project', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05953', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'project_name', 'fieldtype': 'Link', 'options': 'Project', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-13 18:32:58', 'doctype': 'DocField', 'oldfieldname': 'amended_from', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Amended From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05909', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'amended_from', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-13 18:32:58', 'doctype': 'DocField', 'oldfieldname': 'amendment_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Amendment Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05910', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'amendment_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-07-23 09:30:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05679', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2009-08-31 15:17:54', 'doctype': 'DocField', 'oldfieldname': 'status', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Production Order', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02866', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'status', 'fieldtype': 'Select', 'options': '\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-02-18 21:35:51', 'doctype': 'DocField', 'oldfieldname': 'fg_warehouse', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'FG Warehouse', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The warehouse for finished goods where stock of produced items will be updated.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03995', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'fg_warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'wip_warehouse', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'WIP Warehouse', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The work in progress warehouse where raw materials will be operated upon to create finished goods.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02876', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'wip_warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-02-18 07:33:36', 'doctype': 'DocField', 'oldfieldname': 'consider_sa_items', 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Consider SA Items', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': 'Select "Yes" if stock is maintained and tracked for sub - assembly items.', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03989', 'idx': 16, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'consider_sa_items', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02870', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-02-03 12:34:21', 'doctype': 'DocField', 'oldfieldname': 'produced_qty', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Produced Qty (Updated after finished goods are transferred to FG Warehouse through Stock Entry)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': '', 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03920', 'idx': 18, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'produced_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02883', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-08-31 15:17:55', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02885', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-02-18 15:06:52', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Next Steps', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03993', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-02-18 14:51:05', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Material Transfer', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03991', 'idx': 22, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-02-18 15:06:52', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03994', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-02-18 14:51:05', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Backflush', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03992', 'idx': 24, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-02-18 21:40:49', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03996', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-02-08 12:00:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Stop Production Order', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03953', 'idx': 26, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-02-08 12:00:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Unstop Production Order', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Order', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL03954', 'idx': 27, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-19 14:33:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/production_planning_tool/__init__.py b/production/doctype/production_planning_tool/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/production_planning_tool/__init__.py
diff --git a/production/doctype/production_planning_tool/production_planning_tool.js b/production/doctype/production_planning_tool/production_planning_tool.js
new file mode 100644
index 0000000..5748284
--- /dev/null
+++ b/production/doctype/production_planning_tool/production_planning_tool.js
@@ -0,0 +1,45 @@
+
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  
+  if(!doc.fiscal_year){ set_default_values(doc);}
+}
+
+cur_frm.cscript.item_code = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    temp = "{'item_code':'"+(d.item_code?d.item_code:'')+"'}";
+    get_server_fields('get_item_details', temp, 'pp_details', doc, cdt, cdn, 1);
+  }
+}
+
+cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = function(doc) {
+  return 'SELECT DISTINCT `tabItem`.`name`,`tabItem`.`item_name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life`="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+// Get Query for BOM NO
+//-------------------------------------------------------------------------------
+cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) {
+  var d = locals[this.doctype][this.docname];
+  return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
+}
+
+cur_frm.cscript['Clear Document Table'] = function(doc, cdt, cdn){
+   $c('runserverobj', args={'method':'clear_table', 'arg': 'pp_so_details', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+}
+
+cur_frm.cscript['Clear Item Table'] = function(doc, cdt, cdn){
+   $c('runserverobj', args={'method':'clear_table', 'arg': 'pp_details', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+}
+
+cur_frm.cscript['Download Raw Material Report'] = function(doc, cdt, cdn) {
+  call_back = function(r, rt){
+    if (r.message) {
+      $c_obj_csv(make_doclist(cdt, cdn), 'get_raw_materials_report', '');
+    }
+  }
+  $c('runserverobj', args = {'method':'validate_data','args':'','docs':compress_doclist(make_doclist(doc.doctype, doc.name))}, call_back)
+}
diff --git a/production/doctype/production_planning_tool/production_planning_tool.py b/production/doctype/production_planning_tool/production_planning_tool.py
new file mode 100644
index 0000000..c548173
--- /dev/null
+++ b/production/doctype/production_planning_tool/production_planning_tool.py
@@ -0,0 +1,281 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.item_dict = {}
+    self.defaults = get_defaults()
+    
+  def get_item_details(self, args):
+    args = eval(args)
+    item = sql("select description, stock_uom, default_bom from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now())" % args['item_code'], as_dict =1 )
+    if item:
+      ret = {'description' : item and item[0]['description'],
+             'stock_uom'   : item and item[0]['stock_uom'],
+             'bom_no'      : item and item[0]['default_bom']
+      }
+      return cstr(ret)
+    else:
+      msgprint("Item %s does not exist in system." %(args['item_code']))
+      raise Exception
+    
+  def validate_data(self):
+    for d in getlist(self.doclist, 'pp_details'):
+      if not d.pro_created:
+
+        bom = sql("select name from `tabBill Of Materials` where item = %s and docstatus < 2", d.item_code, as_dict = 1)
+        if d.bom_no and not bom:
+          msgprint("There is no Active BOM for item code " + cstr(d.item_code) + " at row no." + cstr(d.idx)+ " which is Submitted. ")
+          raise Exception
+        if bom and bom[0]['name'] and not d.bom_no:
+          msgprint("Please Enter BOM No. for item code " + cstr(d.item_code) + "at row no " + cstr(d.idx))
+          raise Exception
+        item = sql("select is_purchase_item from `tabItem` where name = %s", d.item_code,as_dict = 1)
+#        if not item[0]['is_mrp_item']:
+#          msgprint("Please Delete Row No " + cstr(d.idx) + " as Item " + cstr(d.item_code) + " is not MRP ITEM ")
+#          raise Exception
+        if not item[0]['is_purchase_item'] and not d.bom_no:
+          msgprint("Please Delete Row No. "+ cstr(d.idx)+" as Item " + cstr(d.item_code) + " is not a PURCHASE ITEM ")
+          raise Exception
+        if not flt(d.planned_qty):
+          msgprint("Please Enter Planned Qty for item code " + cstr(d.item_code) + "at row no " + cstr(d.idx))
+          raise Exception
+        if flt(d.prevdoc_reqd_qty) and flt(d.planned_qty) > flt(d.prevdoc_reqd_qty):
+          msgprint(" Planned Qty cannot be greater than total Qty at row no " + cstr(d.idx))
+          raise Exception
+          
+        item = sql("select is_manufactured_item, is_sub_contracted_item from`tabItem` where name = %s", d.item_code, as_dict = 1)
+        if not item:
+          msgprint("Item %s is not present in Item Master." % d.item_code)
+          raise Exception
+
+        if item[0]['is_manufactured_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes':
+          bom = sql("select name, docstatus from `tabBill Of Materials` where item = %s", d.item_code, as_dict =1)
+          if bom and bom[0]['name']:
+            if not d.bom_no:
+              msgprint("Please Enter BOM No for Item " + cstr(d.item_code) + " in Materials at Row No. " + cstr(d.idx)  + " in BOM NO. " + self.doc.name)
+              raise Exception
+            else:
+              match = 0
+              for b in bom:
+                  if flt(b['docstatus']) > 1:
+                    msgprint("BOM %s is NOT SUBMITTED."% cstr(d.bom_no))
+                    raise Exception
+              
+                  match = 1
+              if not match:
+                msgprint("Item %s does not belong to Bill Of Material %s or Bill Of Material %s is NOT ACTIVE BOM." % (cstr(d.item_code),cstr(d.bom_no), cstr(d.bom_no)))
+                raise Exception
+    
+        if not item[0]['is_manufactured_item'] == 'Yes' and not item[0]['is_sub_contracted_item']== 'Yes':
+          if d.bom_no:
+            msgprint("As in Item Master of Item %s Is Manufactured Item / Is Sub-Contracted Item  is not 'Yes' hence there should be no BOM." % d.item_code)
+            raise Exception
+
+    return 1
+
+  def pull_document(self):
+    if self.doc.sales_order:
+      open_so = sql("select distinct 'Sales Order' as prevdoc, t1.name, ifnull(t1.transaction_date, ''), ifnull(t2.confirmation_date,'') from `tabSales Order` t1, `tabSales Order Detail` t2, `tabDelivery Note Packing Detail` t3 where ifnull(t3.planned_qty,0) < ifnull(t3.qty,0) and (t2.qty - ifnull(t2.delivered_qty,0)) > 0 and t3.parent_detail_docname =  t2.name and t2.parent = t1.name and t1.docstatus = 1 and t1.name = '%s' order by t1.transaction_date" % self.doc.sales_order)
+      self.add_open_documents(open_so)
+    #if self.doc.production_forecast:
+      #open_pf = sql("select distinct 'Production Forecast' as prevdoc, t1.name, ifnull(t1.transaction_date,''), ifnull(t1.forecast_due_date,'') from `tabProduction Forecast` t1, `tabPF Detail` t2 where t2.planned_qty < t2.qty and t2.parent = t1.name and t1.name = '%s' and t1.docstatus = 1  order by t1.forecast_due_date " % self.doc.production_forecast)
+      #self.add_open_documents(open_pf)
+      
+  def validate_duplicate_docname(self, check_data):
+    for d in getlist(self.doclist, 'pp_so_details'):
+      if [ d.prevdoc_docname, d.document_date, d.confirmation_date] == check_data :
+        msgprint(cstr(d.prevdoc) + ": " + cstr(d.prevdoc_docname) + " appears more than once.")
+        raise Exception
+    
+  def add_open_documents(self, open_doc):
+    for r in open_doc:
+      self.validate_duplicate_docname([r[1], r[2], r[3]])
+      pp_so = addchild(self.doc, 'pp_so_details', 'PP SO Detail', 1, self.doclist)
+      pp_so.prevdoc = r[0]
+      pp_so.prevdoc_docname = r[1] 
+      pp_so.document_date = cstr(r[2])
+      pp_so.confirmation_date = cstr(r[3])
+      pp_so.save()
+ 
+  def get_open_docs(self):
+    # Step 1:=> Remove unwanted rows from PP SO DETAIL TABLE
+    self.remove_unwanted_rows_from_table(check_field ='include_in_plan', table_fname='pp_so_details')
+    
+    # Step 2:=> Check From Date should be before To Date
+    if self.doc.from_date:
+      if (getdate(self.doc.from_date) > getdate(self.doc.to_date)):
+        msgprint("From Date cannot be after To Date")
+        raise Exception
+    
+    # Step 3:=> At Least to date should be there
+    if not self.doc.to_date:
+      msgprint("To Date is Mandatory.")
+      raise Exception
+
+    # Step 4:=> GEt Open Sales ORder and Production Forecasts
+    open_so = sql("select distinct 'Sales Order' as prevdoc, t1.name, t1.transaction_date, t2.confirmation_date from `tabSales Order` t1, `tabSales Order Detail` t2 where  (t2.qty - ifnull(t2.delivered_qty,0)) > 0 and t2.parent = t1.name %s and t1.transaction_date <= '%s' and t1.docstatus = 1 order by t1.transaction_date" % ((self.doc.from_date and "and t1.transaction_date >= '%s' " % self.doc.from_date or '') , self.doc.to_date))
+    #open_pf = sql("select distinct 'Production Forecast' as prevdoc, t1.name, t1.transaction_date, t1.forecast_due_date from `tabProduction Forecast` t1, `tabPF Detail` t2 where ifnull(t2.planned_qty,0) < ifnull(t2.qty,0) and t1.name = t2.parent %s and t1.forecast_due_date <= '%s' and t1.docstatus = 1  order by t1.forecast_due_date " % ( self.doc.from_date and "and t1.forecast_due_date >= '%s' " % self.doc.from_date or '', self.doc.to_date))
+    #open_doc = open_so + open_pf
+    open_doc = open_so
+    self.add_open_documents(open_doc)
+    
+  def remove_unwanted_rows_from_table(self, check_field, table_fname):
+    for d in getlist(self.doclist, table_fname):
+      if not d.fields[check_field]:
+        d.fields['__oldparent'] = d.parent
+        d.parent = 'old_parent:' + d.parent # for client to send it back while saving
+        d.docstatus = 2
+        if not d.fields.get('__islocal'):
+          d.save()
+      else:
+        d.save()
+
+  def get_packing_list_items(self, sales_order):
+    #sales_com_obj.make_packing_list(self,'sales_order_details')
+    pack_l = sql("select t2.name, t2.parent_item, t2.item_code, t0.transaction_date, t1.confirmation_date,(t1.qty - ifnull(t1.delivered_qty,0)) * (ifnull(t2.qty,0) / ifnull(t1.qty,1)) as 'pending_qty' from `tabSales Order` t0, `tabSales Order Detail` t1, `tabDelivery Note Packing Detail` t2 where ifnull(t2.planned_qty,0) < ifnull(t2.qty,0) and (t1.qty - ifnull(t1.delivered_qty,0)) > 0 and t2.parent_detail_docname = t1.name and t0.name = t1.parent and t1.parent = '%s' and t2.parent = '%s' and t1.docstatus =1 and t2.docstatus = 1" % (sales_order, sales_order), as_dict =1)
+    for p in pack_l:
+      pi = addchild(self.doc, 'pp_details', 'PP Detail', 0, self.doclist)
+      pi.source_doctype        = 'Sales Order'
+      pi.source_docname        = sales_order
+      pi.source_detail_docname = p['name']
+      pi.parent_item           = p['parent_item']
+      pi.item_code             = p['item_code']
+      pi.document_date         = cstr(p['transaction_date'])
+      pi.confirmation_date     = cstr(p['confirmation_date'])
+      item_details = sql("select description, stock_uom from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >  now())", p['item_code'])
+      pi.description = item_details and item_details[0][0] or ''
+      pi.stock_uom = item_details and item_details[0][1] or ''
+      pi.prevdoc_reqd_qty = flt(p['pending_qty'])
+      pi.save()
+  
+  def get_items(self):
+    # Step 1:=> Remove unwanted rows from PP SO DETAIL TABLE
+    self.remove_unwanted_rows_from_table(check_field ='include_in_plan', table_fname='pp_so_details')
+    # Step 2:=> Remove unwanted rows from PP DETAIL TABLE
+    self.doc.clear_table(self.doclist, 'pp_details', 1)
+    # Step 3:=> Get All Details From Production Forecast and Sales Order which are marked Include In Plan in PP SO Detail
+    for d in getlist(self.doclist, 'pp_so_details'):
+      if d.include_in_plan:
+        # Step 3.a :=> Get packing List items from sales order
+        if d.prevdoc == 'Sales Order':
+          self.get_packing_list_items(d.prevdoc_docname)
+        # Step 3.b :=> Get Production Forecast items
+        if d.prevdoc == 'Production Forecast':
+          get_obj('DocType Mapper', 'Production Forecast-Production Planning Tool').dt_map('Production Forecast','Production Planning Tool', d.prevdoc_docname, self.doc, self.doclist, "[['Production Forecast','Production Planning Tool'],['PF Detail', 'PP Detail']]")
+
+    self.set_defaults_pp_detail()
+
+  def clear_table(self, table_name = ''):
+    self.doc.clear_table(self.doclist, table_name, 1)
+
+  def set_defaults_pp_detail(self):
+    for d in getlist(self.doclist,'pp_details'):
+      if not d.mrp:
+        # set default BOM
+        if not d.bom_no:
+          bom = sql("select default_bom from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' or end_of_life >  now())", d.item_code, as_dict = 1)
+          if bom and bom[0]['default_bom']:
+            d.bom_no = bom[0]['default_bom']
+        # Set planned qty as prevdoc_reqd_qty 
+        d.planned_qty = flt(d.prevdoc_reqd_qty)
+        d.save()
+
+  def make_items_dict(self, items_list):
+    # items_list = [[item_name, qty]]
+    for i in items_list:
+      if self.item_dict.has_key(i[0]):
+        self.item_dict[i[0]] = flt(self.item_dict[i[0]]) + flt(i[1])
+      else:
+        self.item_dict[i[0]] = flt(i[1])
+
+  def get_raw_materials(self, bom_dict):
+    for bom in bom_dict:
+      # get all purchase items
+      if self.doc.consider_sa_items == 'No':
+        fl_bom_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s' from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus < 2 group by item_code" % (bom_dict[bom], bom))
+        self.make_items_dict(fl_bom_items)
+      
+      # get all purchase items without sa child_items
+      if self.doc.consider_sa_items == 'Yes':
+        fl_bom_sa_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s' from `tabFlat BOM Detail` where parent = '%s' and parent_bom != '%s' and is_pro_applicable = 'Yes' and docstatus < 2 group by item_code" % (bom_dict[bom], bom, bom))
+        self.make_items_dict(fl_bom_sa_items)
+        fl_bom_items = sql("select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s' from `tabFlat BOM Detail` where parent = '%s' and parent_bom not in (select distinct parent_bom from `tabFlat BOM Detail` where parent = '%s' and parent_bom != '%s' and is_pro_applicable = 'Yes' and docstatus <2) and docstatus < 2 and is_pro_applicable = 'No' group by item_code" % (bom_dict[bom], bom, bom, bom) )
+        self.make_items_dict(fl_bom_items)
+        
+    return self.item_dict
+    
+  def send_csv(self, item_dict):
+    item_list = [['Item Code', 'Description', 'Stock UOM','Required Qty', 'Indented Qty', 'Ordered Qty', 'Actual Qty', ]]
+    for d in item_dict:
+      item_detail = sql("select description, stock_uom from `tabItem` where name = '%s'" % d)
+      item_qty= sql("select sum(indented_qty), sum(ordered_qty), sum(actual_qty) from `tabBin` where item_code  = '%s' " % d)
+      item_list.append([d, cstr(item_detail[0][0]), cstr(item_detail[0][1]), flt(item_dict[d]), item_qty and flt(item_qty[0][0]), item_qty and flt(item_qty[0][1]), item_qty and flt(item_qty[0][2])])
+    return item_list
+    
+  def get_raw_materials_report(self):
+    #self.validate_data()
+    bom_dict = self.check_criteria_for_same_items(check_for = 'Report')
+    item_dict = self.get_raw_materials(bom_dict)
+    #msgprint(item_dict)
+    #raise Exception
+    return self.send_csv(item_dict)
+    
+  def raise_production_order(self):
+    self.validate_data()
+    pp_detail = self.check_criteria_for_same_items(check_for = 'Raise Production Order')
+    pro = get_obj(dt = 'Production Control').create_production_order(self.doc.company, self.doc.fiscal_year, pp_detail = pp_detail)
+    if len(pro) == 1:
+      result = "Only Production Order " + cstr(pro[0]) + " has been generated."
+    elif len(pro) > 1 :
+      result = "Production Order From " + cstr(pro[0]) + " to "  + cstr(pro[len(pro) - 1]) +  " has been generated."
+    else :
+      result = " No Production Order is generated."
+    msgprint(result)
+
+  def check_criteria_for_same_items(self, check_for):
+    pro_lbl = {'production_item': 0, 'description': 1, 'qty' : 2, 'stock_uom' : 3, 'bom_no': 4, 'consider_sa_items': 5}
+    pp_detail, appended, bom_dict = [], 0, {}
+    for d in getlist(self.doclist, 'pp_details'):
+      if check_for == 'Report':
+        if d.bom_no:
+          if bom_dict.has_key(d.bom_no):
+            bom_dict[d.bom_no] = flt(bom_dict[d.bom_no]) + flt(d.planned_qty)
+          else:
+            bom_dict[d.bom_no] = flt(d.planned_qty)
+        else:
+          self.make_items_dict([[d.item_code, d.planned_qty]])
+          
+      if check_for == 'Raise Production Order' and not d.pro_created:
+        appended = 0
+        if pp_detail:
+          for i in pp_detail:
+            # if same bom_no 
+            if d.bom_no and d.bom_no == i[pro_lbl['bom_no']]:
+              # set appended , add qty 
+              appended, i[pro_lbl['qty']], d.pro_created = 1, i[pro_lbl['qty']] + flt(d.planned_qty) , 1
+            
+        if not appended and d.bom_no:
+          pp_detail.append([d.item_code, d.description, d.planned_qty, d.stock_uom, d.bom_no, self.doc.consider_sa_items])
+          d.pro_created = 1
+        
+        d.save()
+    return (check_for =='Report') and bom_dict or pp_detail
\ No newline at end of file
diff --git a/production/doctype/production_planning_tool/production_planning_tool.txt b/production/doctype/production_planning_tool/production_planning_tool.txt
new file mode 100644
index 0000000..dca2150
--- /dev/null
+++ b/production/doctype/production_planning_tool/production_planning_tool.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-01-29 14:56:20', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 1, 'max_attachments': None, 'version': 89, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'Production Planning Tool', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM00669', 'parent': 'Production Planning Tool', 'read': 1, 'create': 1, 'creation': '2010-02-12 12:21:09', 'modified': '2010-08-13 17:59:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM01004', 'parent': 'Production Planning Tool', 'read': 1, 'create': 1, 'creation': '2010-05-19 16:55:18', 'modified': '2010-08-13 17:59:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'jai@webnotestech.com', 'name': 'PERM01005', 'parent': 'Production Planning Tool', 'read': 1, 'create': 1, 'creation': '2010-05-19 16:55:18', 'modified': '2010-08-13 17:59:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Production Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 09:58:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Find Sales Orders', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select Sales Orders from which you want to create Production Orders. Enter the From and To Dates to get Open Orders in that period.', 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04007', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 09:58:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'From Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04008', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'from_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 09:58:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'To Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04009', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'to_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 12:43:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': '40%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04014', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 09:58:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Get Open Documents', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04010', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_open_docs', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 12:43:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04015', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-23 10:50:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Clear Document Table', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04042', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 09:58:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'PP SO Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04011', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'pp_so_details', 'fieldtype': 'Table', 'options': 'PP SO Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 12:44:44', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04018', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-12 11:58:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Sales Order', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03972', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'sales_order', 'fieldtype': 'Link', 'options': 'Sales Order', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-12 11:58:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Production Forecast', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03973', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'production_forecast', 'fieldtype': 'Link', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 12:43:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': '40%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04016', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 12:43:51', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Add In Plan', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04017', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'pull_document', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-29 15:03:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Items', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Click on "Get Items" to get un-fulfilled items from your Sales Orders. After setting the quantities you can raise Production Orders or download the material requirements for analysis', 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03904', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-29 15:03:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Get Items', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03905', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': 'get_items', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 15:08:57', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04022', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-23 10:51:24', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Clear Item Table', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04043', 'idx': 17, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-19 15:08:57', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04023', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-18 06:31:46', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Consider Sub Assemblies', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Select "Yes" if stock is maintained and tracked for sub assembly items.', 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03983', 'idx': 19, 'default': 'No', 'colour': 'White:FFF', 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'consider_sa_items', 'fieldtype': 'Select', 'options': 'No\nYes', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-29 15:03:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'PP Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03906', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'pp_details', 'fieldtype': 'Table', 'options': 'PP Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-18 06:34:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03984', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-18 06:34:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Raise Production Order', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03985', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'raise_production_order', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-18 06:34:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03986', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-12 17:16:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Download Raw Material Report', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03975', 'idx': 24, 'default': None, 'colour': 'White:FFF', 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'Button', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-02-18 06:34:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Company Info', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03987', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-29 14:56:20', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03896', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'Link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-01-29 14:56:20', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Production Planning Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03895', 'idx': 27, 'default': None, 'colour': None, 'modified': '2010-08-13 17:59:00', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/update_delivery_date/__init__.py b/production/doctype/update_delivery_date/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/update_delivery_date/__init__.py
diff --git a/production/doctype/update_delivery_date/update_delivery_date.js b/production/doctype/update_delivery_date/update_delivery_date.js
new file mode 100644
index 0000000..372d6da
--- /dev/null
+++ b/production/doctype/update_delivery_date/update_delivery_date.js
@@ -0,0 +1,5 @@
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
\ No newline at end of file
diff --git a/production/doctype/update_delivery_date/update_delivery_date.py b/production/doctype/update_delivery_date/update_delivery_date.py
new file mode 100644
index 0000000..7cfe588
--- /dev/null
+++ b/production/doctype/update_delivery_date/update_delivery_date.py
@@ -0,0 +1,55 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def get_open_sales_order(self):
+    if not (self.doc.from_date and self.doc.to_date):
+      msgprint("From Date and To Date are Mandatory")
+      return
+    
+    cond = ''  
+    if self.doc.customer:
+      cond += " AND t1.customer = '%s' " % self.doc.customer
+    if self.doc.sales_order:
+      cond += " AND t1.name = '%s' " % self.doc.sales_order
+    if self.doc.territory:
+      cond += " AND t1.territory = '%s' " %self.doc.territory
+
+    dl = sql("select distinct t1.name, t1.customer,  t1.delivery_date, t1.territory, t1.rounded_total from `tabSales Order` t1, `tabSales Order Detail` t2 where  t1.transaction_date >= '%s' and t1.transaction_date <= '%s' and t1.docstatus=1 and t1.status != 'Completed' and t1.name = t2.parent and t2.docstatus =1 and t2.qty > t2.delivered_qty and (t2.confirmation_date is null or t2.confirmation_date= '' or t2.confirmation_date='0000-00-00') %s"% (self.doc.from_date, self.doc.to_date, cond)) 
+    self.doc.clear_table(self.doclist, 'entries')
+    count = 0 
+    for d in dl:
+      nl = addchild(self.doc, 'entries', 'Update Delivery Date Detail', 1, self.doclist)
+      nl.sales_order_no = str(d[0])
+      nl.customer = str(d[1])
+      nl.territory = str(d[3])
+      nl.rounded_total = str(d[4])
+      nl.delivery_date = str(d[2])
+      count = count +1
+    if not count:
+      msgprint("No Sales Order found as per filters set.")
+
+  def update_sales_order(self):
+    for d in getlist(self.doclist, 'entries'):
+      if d.confirmation_date:
+        sql("update `tabSales Order Detail` set confirmation_date = %s where parent = %s ", (d.confirmation_date, d.sales_order_no))
+    msgprint("Updated")
\ No newline at end of file
diff --git a/production/doctype/update_delivery_date/update_delivery_date.txt b/production/doctype/update_delivery_date/update_delivery_date.txt
new file mode 100644
index 0000000..9e5ce1f
--- /dev/null
+++ b/production/doctype/update_delivery_date/update_delivery_date.txt
@@ -0,0 +1,640 @@
+[
+	{
+		'_last_update': '1300960466',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:42:48',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'last_update': '1294161010',
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-09-20 14:06:57',
+		'modified_by': 'Administrator',
+		'module': 'Production',
+		'name': 'Update Delivery Date',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'use_template': None,
+		'version': 6
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'From Date',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL00655',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'from_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'From Date',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02950',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'To Date',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL00656',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'to_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'To Date',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02951',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:40',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL00887',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02952',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:42',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Sales Order',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL00977',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Sales Order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Sales Order',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02953',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Sales Order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Company',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02954',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Company',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-23 11:02:21',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Company',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': '000002690',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Company',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:40',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL00890',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02955',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Get Open Sales Order',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL02956',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'get_open_sales_order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:33',
+		'default': 'No Toolbar',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'entries',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Entries',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL00658',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Update Delivery Date Detail',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': 'No Toolbar',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'entries',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Entries',
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'FL02957',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Update Delivery Date Detail',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:48',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Update Sales Order',
+		'modified': '2011-03-24 15:58:11',
+		'modified_by': 'Administrator',
+		'name': 'FL02958',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'update_sales_order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-11-30 22:42:48',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-11-30 22:42:48',
+		'modified_by': 'Administrator',
+		'name': 'PERM00482',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Update Delivery Date',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	}
+]
\ No newline at end of file
diff --git a/production/doctype/update_delivery_date_detail/__init__.py b/production/doctype/update_delivery_date_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/update_delivery_date_detail/__init__.py
diff --git a/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt b/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt
new file mode 100644
index 0000000..faa65e7
--- /dev/null
+++ b/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-04 09:42:35', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'jai@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'jai@webnotestech.com', 'document_type': None, 'name': 'Update Delivery Date Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'sales_order_no', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Sales Order No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05806', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'sales_order_no', 'fieldtype': 'Link', 'options': 'Sales Order', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'customer', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Customer', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05807', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'customer', 'fieldtype': 'Data', 'options': 'Customer', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'city', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'City', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05808', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'city', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'state', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'State', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05809', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'state', 'fieldtype': 'Link', 'options': 'State', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'territory', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'jai@webnotestech.com', 'label': 'Territory', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05810', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'territory', 'fieldtype': 'Link', 'options': 'Territory', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'rounded_total', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Total Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05811', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'rounded_total', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'delivery_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Expected Delivery Date', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05812', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'delivery_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-04 09:42:35', 'doctype': 'DocField', 'oldfieldname': 'confirmation_date', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'jai@webnotestech.com', 'label': 'Confirmation Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Delivery Date Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05813', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-04 09:42:35', 'parenttype': 'DocType', 'fieldname': 'confirmation_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/doctype/workstation/__init__.py b/production/doctype/workstation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/doctype/workstation/__init__.py
diff --git a/production/doctype/workstation/workstation.js b/production/doctype/workstation/workstation.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/production/doctype/workstation/workstation.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/production/doctype/workstation/workstation.py b/production/doctype/workstation/workstation.py
new file mode 100644
index 0000000..aaa4908
--- /dev/null
+++ b/production/doctype/workstation/workstation.py
@@ -0,0 +1,33 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def update_bom_operation(self):
+      bom_list = sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name)
+      for bom_no in bom_list:
+        sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no, self.doc.name))
+  
+  def on_update(self):
+    set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
+    set(self.doc, 'hour_rate', flt(self.doc.hour_rate_labour) + flt(self.doc.overhead))
+    self.update_bom_operation()
\ No newline at end of file
diff --git a/production/doctype/workstation/workstation.txt b/production/doctype/workstation/workstation.txt
new file mode 100644
index 0000000..2dba6e8
--- /dev/null
+++ b/production/doctype/workstation/workstation.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-08-31 15:18:01', 'search_fields': None, 'module': 'Production', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:workstation_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Workstation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00398', 'parent': 'Workstation', 'read': 1, 'create': 1, 'creation': '2009-08-31 15:18:01', 'modified': '2010-09-20 11:10:42', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00399', 'parent': 'Workstation', 'read': 1, 'create': None, 'creation': '2009-08-31 15:18:01', 'modified': '2010-09-20 11:10:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01006', 'parent': 'Workstation', 'read': 1, 'create': 1, 'creation': '2010-05-20 11:39:35', 'modified': '2010-09-20 11:10:42', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01007', 'parent': 'Workstation', 'read': 1, 'create': 1, 'creation': '2010-05-20 11:39:35', 'modified': '2010-09-20 11:10:42', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01008', 'parent': 'Workstation', 'read': 1, 'create': None, 'creation': '2010-05-20 11:39:35', 'modified': '2010-09-20 11:10:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'Production Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01009', 'parent': 'Workstation', 'read': 1, 'create': None, 'creation': '2010-05-20 11:39:35', 'modified': '2010-09-20 11:10:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 6, 'parenttype': 'DocType', 'role': 'Production User', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04869', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'workstation_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Workstation Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02895', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'workstation_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'warehouse', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Warehouse', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02896', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02897', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'capacity', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Capacity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02898', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'capacity', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'capacity_units', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Capacity Units', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02899', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'capacity_units', 'fieldtype': 'Select', 'options': '\nUnits/Shifts\nUnits/Hour', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'hour_rate_labour', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Hour Rate Labour', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02900', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'hour_rate_labour', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Over Heads', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02901', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'hour_rate_electricity', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Hour Rate Electricity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02902', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'hour_rate_electricity', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'hour_rate_consumable', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Hour Rate Consumable', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02903', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'hour_rate_consumable', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'hour_rate_rent', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Hour Rate Rent', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02904', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'hour_rate_rent', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'overhead', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Overhead', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02905', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'overhead', 'fieldtype': 'Currency', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-08-31 15:18:01', 'doctype': 'DocField', 'oldfieldname': 'hour_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Hour Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Workstation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02907', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-09-20 11:10:42', 'parenttype': 'DocType', 'fieldname': 'hour_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/production/page/__init__.py b/production/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/page/__init__.py
diff --git a/production/page/bill_of_materials/__init__.py b/production/page/bill_of_materials/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/page/bill_of_materials/__init__.py
diff --git a/production/page/bill_of_materials/bill_of_materials.html b/production/page/bill_of_materials/bill_of_materials.html
new file mode 100644
index 0000000..1263e44
--- /dev/null
+++ b/production/page/bill_of_materials/bill_of_materials.html
@@ -0,0 +1,44 @@
+<div style="margin:0px">
+<div id="bom_header">&nbsp;</div>
+<!--
+<div style="color: #444444;" mce_style="color: #444444;">
+<table style="width: 100%;" border="0">
+<tbody>
+<tr>
+<td class="standard_title" style="width: 70%;">Bill of Materials</td>
+<td style="width: 30%; text-align: right; vertical-align: top;"><span class="link_type" style="vertical-align:top" mce_style="vertical-align:top"> <img style="cursor:pointer" mce_style="cursor:pointer" onclick="nav_obj.show_last_open()" src="images/ui/close_btn.gif" mce_src="images/ui/close_btn.gif" alt="" /> </span></td>
+</tr>
+</tbody>
+</table>
+</div>
+--> <!--  table.coa_toolbar td {  	vertical-align: middle;  }  --> <!--
+<div style="margin-top: 16px; padding: 4px; background-color: #EEE; border: 1px solid #AAA;" mce_style="margin-top: 16px; padding: 4px; background-color: #EEE; border: 1px solid #AAA;">
+<table class="coa_toolbar" border="0" cellspacing="2px">
+<tbody>
+<tr>
+<td>Item Group:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="bom_item_group"></select></td>
+<td>Enter Item Code:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="bom_item_code"></select></td>
+<td>Enter BOM No:</td>
+<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="bom_bom_no"></select></td>
+<td>
+<div id="bom_refresh"></div>
+</td>
+<td>
+<div id="bom_calculate_cost"></div>
+</td>
+</tr>
+</tbody>
+</table>
+</div>
+--> <!--
+<div style="margin: 0px 16px 16px; overflow: auto; padding-top: 4px; height: 300px;">-->
+<div style="overflow: auto; margin-top: 8px; padding-top: 4px; height: 300px;">
+<div style="width: 900px;">
+<div id="bom_head_op" style="display: none;"></div>
+<div id="bom_head_it" style="display: none; border-bottom: 2px solid #444;"></div>
+<div id="bom_tree"></div>
+</div>
+</div>
+</div>
\ No newline at end of file
diff --git a/production/page/bill_of_materials/bill_of_materials.js b/production/page/bill_of_materials/bill_of_materials.js
new file mode 100644
index 0000000..f2c9b0a
--- /dev/null
+++ b/production/page/bill_of_materials/bill_of_materials.js
@@ -0,0 +1,508 @@
+pscript['onload_Bill of Materials'] = function() {
+	
+	// header and toolbar
+	var h = new PageHeader('bom_header','Bill of Materials','BOM gives the breakdown of cost for product');
+	
+	var dv = $a(h.toolbar_area,'div','',{margin:'4px 0px'});
+	
+	var tbl = make_table(dv, 1,3,'480px',[],{padding:'4px', width:'160px'});
+	
+	var sel = $a($td(tbl,0,0),'select','',{width:'160px'});
+	sel.id = 'bom_item_group';
+	
+	var sel = $a($td(tbl,0,1),'select','',{width:'160px'});
+	sel.id = 'bom_item_code'; sel.innerHTML = 'Select Item Code...'; sel.disabled = 1;
+	
+	var sel = $a($td(tbl,0,2),'select','',{width:'160px'});
+	sel.id = 'bom_bom_no'; sel.innerHTML = 'Select Bom No...'; sel.disabled = 1;
+	
+	h.add_button('Calculate Cost', function(){ pscript.bom_calculate_cost(pscript.bom_no); },1,'ui-icon-calculator');
+	h.add_button('Refresh', function(){ pscript.bom_refresh(); },0,'ui-icon-refresh');
+        h.add_button('Collapse All', function(){pscript.collapse_all();},0,'');
+	
+  // select for Item Group
+    //$i('bom_item_group').style.width = '180px';
+   // $i('bom_item_code').style.width = '110px';
+   // $i('bom_bom_no').style.width = '150px';
+    $i('bom_tree').innerHTML = 'Please Select Item Group';
+    add_sel_options($i('bom_item_group'), ['Loading ...    ']);
+
+    $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_item_group'}, function(r,rt) {
+      pscript.item_group = r.message.split('~~~');
+      empty_select($i('bom_item_group'));
+//      add_sel_options($i('bom_item_group'), add_lists([' '], pscript.item_group), ' ');
+      add_sel_options($i('bom_item_group'), add_lists(['Select Item Group...'], pscript.item_group), 'Select Item Group...');
+      $i('bom_item_group').onchange = function() {
+		
+         //$i('bom_item_code').innerHTML = '';
+        // $i('bom_bom_no').innerHTML = '';
+         $i('bom_head_op').innerHTML = '';
+         $i('bom_head_it').innerHTML = '';
+         $i('bom_tree').innerHTML = 'Please Select Item Code';
+         pscript.bom_select_item_code(sel_val(this)); 
+      }
+    });	
+}
+
+pscript.bom_select_item_code = function(item_group) {
+
+  //select for Item Code	
+
+    add_sel_options($i('bom_item_code'), ['Loading ... ']);
+
+    $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_item_code', 'arg':item_group}, function(r,rt) {
+      pscript.item_code = r.message.split('~~~');
+      empty_select($i('bom_item_code'));
+      add_sel_options($i('bom_item_code'), add_lists(['Select Item Code...'], pscript.item_code), 'Select Item Code...');
+	  if(sel_val($i('bom_item_code')) == 'Select Item Group...'){
+		$i('bom_item_code').disabled = 1;
+		$i('bom_bom_no').disabled = 1;
+	  }
+	  else{ $i('bom_item_code').disabled = 0; }
+	  
+      $i('bom_item_code').onchange = function() {
+        // $i('bom_bom_no').innerHTML = '';
+         $i('bom_head_op').innerHTML = '';
+         $i('bom_head_it').innerHTML = '';
+         $i('bom_tree').innerHTML = 'Please Select BOM NO.'; 
+         pscript.bom_select_bom_no(sel_val(this));
+      }
+    });	
+  
+}
+
+pscript.bom_select_bom_no = function(item_code) {
+
+  //select for BOM NO
+    
+    add_sel_options($i('bom_bom_no'), ['Loading ...     ']);
+	
+    $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_bom_no', 'arg':item_code}, function(r,rt) {
+      var bom_list = r.message.split('~~~');
+      empty_select($i('bom_bom_no'));
+	  empty_select($i('bom_bom_no'));
+      add_sel_options($i('bom_bom_no'), add_lists(['Select Bom No...'], bom_list), 'Select Bom No...');
+	  if(sel_val($i('bom_item_code')) == 'Select Item Code...'){
+		$i('bom_bom_no').disabled = 1;
+	  }
+	  else{
+		$i('bom_bom_no').disabled = 0;
+	  }
+	  
+      $i('bom_bom_no').onchange = function() { 
+         $i('bom_head_op').innerHTML = '';
+         $i('bom_head_it').innerHTML = '';
+         $i('bom_tree').innerHTML = 'Loading...';
+         pscript.show_bom(); }
+    });	
+}
+
+// Refresh Function
+pscript.bom_refresh = function() {
+  $i('bom_head_op').innerHTML = '';
+  $i('bom_head_it').innerHTML = '';
+  $i('bom_tree').innerHTML = 'Refreshing....';
+  pscript.show_bom();
+}
+
+//Calculate Cost Function
+pscript.bom_calculate_cost = function() {
+  $i('bom_head_op').innerHTML = '';
+  $i('bom_head_it').innerHTML = '';
+  $i('bom_tree').innerHTML = ' Calculating Cost...';
+  $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'calculate_cost', 'arg':pscript.bom_no}, function(r,rt) {
+      var calculated = r.message;
+      if (calculated == 'calculated') {pscript.show_bom();}
+      else  {$i('bom_tree').innerHTML = "Sorry it's taking too long try next time....";}
+  });	
+}
+
+pscript.collapse_all = function(){
+  alert("In");
+  pscript.bom_tree.collapseall()
+}
+
+pscript.show_bom = function () {
+  pscript.item_code = $i('bom_item_code').value;
+  pscript.bom_no = $i('bom_bom_no').value;
+ // $i('bom_refresh').innerHTML = '';
+  //$i('bom_refresh').innerHTML = "<input type='button' value='Refresh' onClick='javascript:pscript.bom_refresh()' />";
+  //$i('bom_calculate_cost').innerHTML = "<input type='button' value='Calculate Cost' onClick='javascript:pscript.bom_calculate_cost(pscript.bom_no)' />";
+  if (pscript.item_code == "") {
+    alert("Please Enter Item Code");
+    return;
+  }
+  if (pscript.bom_no == "") {
+    alert("Please Enter BOM No");
+    return;
+  }
+  $ds('bom_head_op');
+  $ds('bom_head_it');
+  $ds('bom_tree');
+  pscript.bom_onexp = function(node) {
+    //alert("Server Call")
+    if(!node.expanded_once) {
+      $ds(node.loading_div);
+      if (!node.is_item){
+        // We will get List Of Items and BOM for particular Operation
+        data = "{'op_no':'" + node.text[1] +"','bom_no':'" + node.text[3] +"'}";
+        $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_item_bom', 'arg':data}, 
+        function(r,rt) {
+          $dh(node.loading_div);
+          var nl = r.message;
+          for(var i=0; i<nl.length; i++) {
+            if (nl[i][8] == 1) {
+              pscript.bom_tree.addNode(node,$i('bom_head_op'), nl[i], 'images/icons/box.png', null, null);
+            }
+            else {
+              pscript.bom_tree.addNode(node,$i('bom_head_op'), nl[i], 'images/icons/package.png', null, pscript.bom_onexp);
+            }
+         }
+        });
+      } else {
+        //alert("bom_no:%s"%node.text[2])
+        //We will get List Of Operations for particular Item and BOM
+        $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_operations', 'arg':node.text[3]},
+          function(r,rt) {
+            $dh(node.loading_div);
+            var nl = r.message;
+            for(var i=0; i<nl.length; i++) {
+              pscript.bom_tree.addNode(node, $i('bom_head_op'), nl[i], 'images/icons/folder.png', null, pscript.bom_onexp);
+            }
+          }
+        );
+      }
+    }
+  }
+  // First this function will execute and we will get list of operations
+  $c('runserverobj', args={'doctype':'BOM Control', 'docname':'BOM Control', 'method':'get_operations', 'arg':pscript.bom_no}, function(r,rt) {
+    var nl = r.message;
+    
+    $i('bom_tree').innerHTML = '';
+    var t = new Tree($i('bom_tree'),$i('bom_head_op'),$i('bom_head_it'));
+
+    pscript.bom_tree = t;
+    pscript.bom_curnode = null;
+
+    for(var i=0; i<nl.length; i++) {
+      t.addNode(null, $i('bom_head_op'), nl[i], 'images/icons/folder.png', null, pscript.bom_onexp);
+    }
+  });    
+}
+
+
+//
+// Tree
+//
+
+function Tree(parent,head_op,head_it) {
+  this.container = parent;
+  this.heading = head_op;
+  this.nodes = {};
+  this.all_nodes = [];
+  
+  var me = this;
+  
+  this.body = $a(parent, 'div');
+  this.hopbody = $a(head_op, 'div');
+  this.hitbody = $a(head_it, 'div');
+
+  // columns
+  this.col_details = [
+     ['340px','Opn No', 'Opn Descr','Item Code', 'Description',1,2]
+    ,['150px','BOM' , 'BOM', 3]
+    ,['80px', 'Workstn', 'Qty', 4]
+    ,['45px', 'Hr Rate','Stock UOM',5]
+    ,['45px', 'Time','Scrap',6]
+    ,['50px', 'Mat Cost','Rate',7]
+    ,['45px', 'Op Cost','',8]
+    ,['50px', 'Tot Cost','',9]
+    ,['25px', 'Refresh']
+  ]
+  
+  // Operation  header
+  this.hopbody_tab = $a(this.hopbody, 'table');
+  $y(this.hopbody_tab, {borderCollapse:'collapse', tableLayout:'fixed'})
+  
+  var r0 = this.hopbody_tab.insertRow(0);
+  for(var i=0; i<this.col_details.length; i++) {
+    var c = r0.insertCell(i);
+    c.style.width = this.col_details[i][0];
+    c.style.padding = '2px';
+    c.style.border = '1px solid #DDD';
+   if (i > 0 && this.col_details[i][1] != 'Refresh') c.innerHTML = this.col_details[i][1];
+  }
+  this.hopbody_label = $a(r0.cells[0], 'div');
+  var hopbody_nodetab = $a(this.hopbody_label, 'table');
+  $y(hopbody_nodetab, {borderCollapse:'collapse', tableLayout:'fixed'})
+  
+  var r0 = hopbody_nodetab.insertRow(0);
+  var c = r0.insertCell(0); c.style.width = '16px';  
+  var c = r0.insertCell(1); c.style.width = '20px'; c.innerHTML = "<img src='images/icons/wrench.png' />";
+  var c = r0.insertCell(2); c.style.width = '80px'; c.innerHTML = this.col_details[0][1];
+  l=340-116;
+  var c = r0.insertCell(3); c.style.width = l+'px'; c.innerHTML = this.col_details[0][2];
+  
+  // Item Header
+  this.hitbody_tab = $a(this.hitbody, 'table');
+  $y(this.hitbody_tab, {borderCollapse:'collapse', tableLayout:'fixed'})
+  
+  var r0 = this.hitbody_tab.insertRow(0);
+  for(var i=0; i<this.col_details.length; i++) {
+    var c = r0.insertCell(i);
+    c.style.width = this.col_details[i][0];
+    c.style.padding = '2px';
+    c.style.border = '1px solid #DDD';
+	if (i > 0 && this.col_details[i][1] != 'Refresh') c.innerHTML = this.col_details[i][2];
+  }
+  this.hitbody_label = $a(r0.cells[0], 'div');
+  var hitbody_nodetab = $a(this.hitbody_label, 'table');
+  $y(hitbody_nodetab, {borderCollapse:'collapse', tableLayout:'fixed'})
+  
+  var r0 = hitbody_nodetab.insertRow(0);
+  var c = r0.insertCell(0); c.style.width = '16px'; 
+  var c = r0.insertCell(1); c.style.width = '20px'; c.innerHTML = "<img src='images/icons/package.png' />";
+  var c = r0.insertCell(2); c.style.width = '100px'; c.innerHTML = this.col_details[0][3];
+  l=350-136;
+  var c = r0.insertCell(3); c.style.width = l+'px'; c.innerHTML = this.col_details[0][4];
+  
+  this.addNode = function(parent, head_op, label, imagesrc, onclick, onexpand) {
+    var t = new TreeNode(me, parent, head_op, label, imagesrc, onclick, onexpand);
+   	if(!parent) {
+      me.nodes[label]=t; // add to roots
+    } else {
+      parent.nodes[label] = t; // add to the node
+    }
+    
+    this.all_nodes.push(t);
+		
+    // note: this will only be for groups
+    if(onexpand)t.create_expimage();
+    t.expanded_once = false;
+
+    return t;
+    
+  }
+  
+  this.deleteNode = function(node) {
+    node.container.remove(node);
+
+  }
+  var me = this;
+
+  this.collapseall = function() {
+    //alert("collapseall")
+    for(n in me.nodes) {
+      if (me.nodes[n].expimage){
+        l = me.nodes[n].get_list_of_child_nodes()  
+        for (var i=0; i < l.length; i++ )  l[i].collapse(l[i]);
+      }
+    }
+  }
+}
+
+function TreeNode(tree, parent, head_op, label, imagesrc, onclick, onexpand) {
+  
+  var me = this;
+  this.parent = parent;
+  this.head = head_op;
+  this.nodes = {};
+  this.onclick = onclick;
+  this.onexpand = onexpand;
+  this.text = label;
+
+  if(!parent) {
+    var container = tree.body; 
+  }
+  else {
+    var container = parent.body;
+  }
+  var h_container = tree.hopbody;
+  
+  var t = $a(container, "div");
+  var ht = $a(h_container, "div");
+
+  t.style.display = "none";
+  ht.style.display = "none";
+ 
+  this.node_area = $a(t, "div");
+  this.node_area.style.cursor = 'pointer';
+    
+  this.loading_div = $a(container, "div");
+  this.loading_div.innerHTML = 'Loading...';
+  $dh(this.loading_div);
+
+  // main table
+  this.tab = $a(this.node_area, 'table');
+  $y(this.tab, {borderCollapse:'collapse', tableLayout:'fixed'})
+  
+  var r0 = this.tab.insertRow(0);
+  for(var i=0; i<tree.col_details.length; i++) {
+    var c = r0.insertCell(i);
+    c.style.width = tree.col_details[i][0];
+    c.style.padding = '2px';
+    c.style.border = '1px solid #DDD';
+  }
+  
+  this.label = $a(r0.cells[0], 'div');
+  
+  var m=0;
+  var tn = this;
+   
+  while(tn.parent){m+=16;tn=tn.parent;}
+  this.label.style.marginLeft = m+'px';
+  this.loading_div.style.marginLeft = m+40+'px';
+  var l = 350 - m;
+  this.body = $a(t, 'div'); // children will come here
+
+  // make the node
+  var nodetab = $a(this.label, 'table');
+  $y(nodetab, {borderCollapse:'collapse', tableLayout:'fixed'})
+  
+  var r0 = nodetab.insertRow(0);
+  var c = r0.insertCell(0); c.style.width = '16px';  
+  var c = r0.insertCell(1); c.style.width = '20px';
+  var c = r0.insertCell(2); c.style.width = '100px';
+  l=l-136;
+  
+  var c = r0.insertCell(3); c.style.width = l+'px';
+  // BOM - is it item or operation
+  this.is_item = 1;
+  if(label[0] == 'operation') {
+    this.is_item = 0;
+    imagesrc = 'images/icons/wrench.png';
+  }
+  
+  if(!imagesrc) imagesrc = "images/icons/folder.png";
+  this.usrimg = $a(nodetab.rows[0].cells[1], 'img');
+  this.usrimg.src = imagesrc;
+
+
+  //this.node_area.onmouseover = function() {this.style.backgroundColor = '#DEF';  }
+  //this.node_area.onmouseout = function() { this.style.backgroundColor = '#FFF';  }
+
+  this.create_expimage = function() {
+    if(!me.expimage) {
+      me.expimage = $a(nodetab.rows[0].cells[0], 'img');
+      me.expimage.style.marginTop = "3px";
+      me.expimage.src = "images/icons/plus.gif";
+      me.expimage.onclick = me.toggle;
+      me.expimage.node = me;
+    }
+  }
+  
+  this.get_list_of_child_nodes = function() {
+    var main_l = [];
+    for (n in me.nodes){
+      if(!me.expimage){}
+      else{
+        var l = [];
+        if (me.nodes[n].get_list_of_child_nodes()) l = me.nodes[n].get_list_of_child_nodes();
+        for(var i=0 ; i < l.length; i ++){
+          main_l.push(l[i]);
+        }
+        alert(1);
+        main_l.push(me.nodes[n]);
+        alert(2);
+      }
+    }
+    return main_l
+  }
+
+ this.select = function() {
+    me.show_selected();
+    if(this.onclick)this.onclick(this);
+  }
+  this.show_selected = function() {
+    if(pscript.bom_curnode)pscript.bom_curnode.deselect();
+    me.tab.style.backgroundColor = '#DEF';
+    if(me.is_item == 1) tree.hitbody_tab.style.backgroundColor = '#DEF';
+    if(me.is_item == 0) tree.hopbody_tab.style.backgroundColor = '#DEF';
+    me.tab.style.fontWeight = 'bold';
+    pscript.bom_curnode = me;
+    $ds(me.refresh);
+  }
+
+  this.deselect = function() {
+    me.tab.style.fontWeight = 'normal';
+    pscript.bom_curnode=null;
+    me.tab.style.backgroundColor = '#FFF';
+    tree.hopbody_tab.style.backgroundColor = '#FFF';
+    tree.hitbody_tab.style.backgroundColor = '#FFF';
+    $dh(me.refresh);
+  }
+   
+
+  var expanded = 1;
+  this.toggle = function(node) {
+    //alert("toggle")
+    if(!me.expimage)return;
+    if(me.expanded)me.collapse(this.node);
+    else me.expand(this.node);
+  }
+  this.collapse = function(node) {
+    //alert("collapse")
+    if(!node.expimage)return;
+    node.body.style.display = 'none';
+    if(node.expimage.src)node.expimage.src = "images/icons/plus.gif";
+    node.expanded = 0;
+  }
+  this.expand = function(node) {
+    //alert("expand")
+    if(!node.expimage)return;
+    if(node.onexpand)node.onexpand(node);
+    node.body.style.display = 'block';
+    if(node.expimage.src)node.expimage.src = "images/icons/minus.gif";
+    node.expanded = 1;
+    node.expanded_once = 1;
+  }
+
+  // BOM - Set values
+  for(var i=0;i<tree.col_details.length; i++) {
+    if ( i == 0) {
+      if(this.is_item == 1) {
+        var c = $a( nodetab.rows[0].cells[2], 'span', 'link_type');
+        c.item_code = label[tree.col_details[i][5]]
+        c.onclick = function() { loaddoc("Item", this.item_code); }
+      }
+      if(this.is_item == 0) var c = nodetab.rows[0].cells[2];
+      var d = nodetab.rows[0].cells[3];
+      c.innerHTML = label[tree.col_details[i][5]];
+      d.innerHTML = label[tree.col_details[i][6]].substring(0,15) + '...';
+    }
+    if(i==1) {
+      var c = $a(this.tab.rows[0].cells[i], 'div', 'link_type', {overflow:'hidden', width:'100%'});
+      c.bom_no = label[tree.col_details[i][3]]
+      c.onclick = function() { loaddoc("Bill Of Materials", this.bom_no); }
+      c.innerHTML = label[tree.col_details[i][3]];
+    }
+    if(this.is_item == 1 && i > 1 && i < 6) {
+      var c = this.tab.rows[0].cells[i];
+      c.innerHTML = label[tree.col_details[i][3]];
+    }
+    if(this.is_item == 0 && i > 1 && tree.col_details[i][1] != 'Refresh') {
+      var c = this.tab.rows[0].cells[i];
+      c.innerHTML = label[tree.col_details[i][3]];
+    }
+    if(tree.col_details[i][1] == 'Refresh') {
+      this.refresh = $a(this.tab.rows[0].cells[i], 'span', 'link_type');  
+      this.refresh.onclick = function() {
+        me.node = me
+        if(me.node.expanded_once){
+          me.node.body.innerHTML = '';
+          me.node.expanded_once = 0
+          me.expanded = 0
+          me.toggle();
+        }
+        else {me.toggle()}
+      }
+      this.refresh.innerHTML = "<img src='images/icons/page_refresh.gif' />"
+      $dh(this.refresh);
+    }
+  }
+
+  this.tab.onclick= function(e) { me.select(); }
+  this.tab.ondblclick = function(e) { me.select(); if(me.ondblclick)me.ondblclick(me); }
+  t.style.display = "block";
+  ht.style.display = "block";
+}
\ No newline at end of file
diff --git a/production/page/bill_of_materials/bill_of_materials.txt b/production/page/bill_of_materials/bill_of_materials.txt
new file mode 100644
index 0000000..ce3232d
--- /dev/null
+++ b/production/page/bill_of_materials/bill_of_materials.txt
@@ -0,0 +1 @@
+[{'creation': '2009-08-31 15:26:19', 'module': 'Production', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 1, 'content': None, 'page_name': 'Bill of Materials', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': '', 'name': 'Bill of Materials', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000040', 'parent': 'Bill of Materials', 'creation': '2009-08-31 15:26:19', 'modified': '2010-05-10 09:41:53', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000111', 'parent': 'Bill of Materials', 'creation': '2010-03-15 13:25:15', 'modified': '2010-05-10 09:41:53', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'Production User', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000112', 'parent': 'Bill of Materials', 'creation': '2010-03-15 13:25:15', 'modified': '2010-05-10 09:41:53', 'doctype': 'Page Role', 'idx': 3, 'parenttype': 'Page', 'role': 'Production Manager', 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/production/search_criteria/__init__.py b/production/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/search_criteria/__init__.py
diff --git a/production/search_criteria/consumption_against_production/__init__.py b/production/search_criteria/consumption_against_production/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/search_criteria/consumption_against_production/__init__.py
diff --git a/production/search_criteria/consumption_against_production/consumption_against_production.txt b/production/search_criteria/consumption_against_production/consumption_against_production.txt
new file mode 100644
index 0000000..152069e
--- /dev/null
+++ b/production/search_criteria/consumption_against_production/consumption_against_production.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '`tabProduction Order`.consider_sa_items',
+		'add_cond': '`tabProduction Order`.name = `tabStock Entry`.production_order',
+		'add_tab': '`tabProduction Order`',
+		'columns': 'Stock Entry\x01ID,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Posting Date,Stock Entry\x01Company,Stock Entry Detail\x01Source Warehouse,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01FG Item,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Reqd Qty,Stock Entry Detail\x01Transfer Quantity',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Consumption Against Production',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Stock Entry Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-11 16:32:48',
+		'modified_by': 'Administrator',
+		'module': 'Production',
+		'name': 'consumption_against_production',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Stock Entry',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabStock Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/production/search_criteria/delivery_plan/__init__.py b/production/search_criteria/delivery_plan/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/search_criteria/delivery_plan/__init__.py
diff --git a/production/search_criteria/delivery_plan/delivery_plan.js b/production/search_criteria/delivery_plan/delivery_plan.js
new file mode 100644
index 0000000..970dd51
--- /dev/null
+++ b/production/search_criteria/delivery_plan/delivery_plan.js
@@ -0,0 +1,18 @@
+report.customize_filters = function() {
+
+  //to hide all filters
+  //this.hide_all_filters();
+
+  // to disable a filter from query set 
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Status'].df.ignore = 1;
+
+  // to unhide required filters
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'From Confirmed Delivery Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'To Confirmed Delivery Date'].df.filter_hide = 0;
+
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/production/search_criteria/delivery_plan/delivery_plan.txt b/production/search_criteria/delivery_plan/delivery_plan.txt
new file mode 100644
index 0000000..ba35b90
--- /dev/null
+++ b/production/search_criteria/delivery_plan/delivery_plan.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabSales Order Detail`.`pending_qty` * `tabSales Order Detail`.`basic_rate` ) AS 'Amount'",
+		'add_cond': "`tabSales Order Detail`.pending_qty > 0 and (`tabSales Order Detail`.confirmation_date is not null or `tabSales Order Detail`.confirmation_date!='' or `tabSales Order Detail`.confirmation_date != '00-00-0000')",
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Delivery Plan',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSales Order Detail`.`confirmation_date`, `tabSales Order`.`name`',
+		'idx': None,
+		'modified': '2010-08-30 14:06:22',
+		'modified_by': 'Administrator',
+		'module': 'Production',
+		'name': 'delivery_plan',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': '',
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/production/search_criteria/itemwise_production_report/__init__.py b/production/search_criteria/itemwise_production_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/search_criteria/itemwise_production_report/__init__.py
diff --git a/production/search_criteria/itemwise_production_report/itemwise_production_report.js b/production/search_criteria/itemwise_production_report/itemwise_production_report.js
new file mode 100644
index 0000000..10ec7fb
--- /dev/null
+++ b/production/search_criteria/itemwise_production_report/itemwise_production_report.js
@@ -0,0 +1,16 @@
+report.customize_filters = function() {
+
+  //to hide all filters
+  this.hide_all_filters();
+
+  // to unhide required filters
+  this.filter_fields_dict['Stock Entry'+FILTER_SEP +'ID'].df.filter_hide = 0;
+  this.filter_fields_dict['Stock Entry'+FILTER_SEP +'Production Order'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Stock Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Stock Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Stock Entry Detail'+FILTER_SEP +'Target Warehouse'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Stock Entry Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
+}
\ No newline at end of file
diff --git a/production/search_criteria/itemwise_production_report/itemwise_production_report.txt b/production/search_criteria/itemwise_production_report/itemwise_production_report.txt
new file mode 100644
index 0000000..5058455
--- /dev/null
+++ b/production/search_criteria/itemwise_production_report/itemwise_production_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Stock Entry\x01ID,Stock Entry\x01Posting Date,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Company,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Stock UOM,Stock Entry Detail\x01Transfer Quantity',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Itemwise Production Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Stock Entry Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Stock Entry\x01Saved':1,'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':'Backflush','Stock Entry Detail\x01FG Item':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-14 15:50:44',
+		'modified_by': 'Administrator',
+		'module': 'Production',
+		'name': 'itemwise_production_report',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Stock Entry',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabStock Entry`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/production/search_criteria/production_orders_in_process/__init__.py b/production/search_criteria/production_orders_in_process/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/production/search_criteria/production_orders_in_process/__init__.py
diff --git a/production/search_criteria/production_orders_in_process/production_orders_in_process.txt b/production/search_criteria/production_orders_in_process/production_orders_in_process.txt
new file mode 100644
index 0000000..a84aedc
--- /dev/null
+++ b/production/search_criteria/production_orders_in_process/production_orders_in_process.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': '`tabProduction Order`.qty > `tabProduction Order`.produced_qty',
+		'add_tab': None,
+		'columns': 'Production Order\x01ID,Production Order\x01Origin,Production Order\x01Status,Production Order\x01Posting Date,Production Order\x01Production Item,Production Order\x01BOM No,Production Order\x01Description,Production Order\x01Stock UOM,Production Order\x01Qty,Production Order\x01Produced Qty,Production Order\x01FG Warehouse,Production Order\x01WIP Warehouse,Production Order\x01Consider SA Items,Production Order\x01Fiscal Year,Production Order\x01Company',
+		'creation': '2010-08-08 17:09:32',
+		'criteria_name': 'Production Orders In Process',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Production Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Production Order\x01Submitted':1,'Production Order\x01Origin':'','Production Order\x01Status':'','Production Order\x01Consider SA Items':'','Production Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-06-15 10:01:15',
+		'modified_by': 'Administrator',
+		'module': 'Production',
+		'name': 'production_orders_in_process',
+		'owner': 'jai@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabProduction Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/Module Def/Projects/Projects.txt b/projects/Module Def/Projects/Projects.txt
new file mode 100644
index 0000000..f8cf6f7
--- /dev/null
+++ b/projects/Module Def/Projects/Projects.txt
@@ -0,0 +1,141 @@
+[
+	{
+		'_last_update': '1300959287',
+		'creation': '2010-11-30 17:31:44',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': 'undefined,undefined',
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2011-03-10 15:57:47',
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'module_desc': '<div id="projects_div"></div>',
+		'module_icon': 'puzzle.png',
+		'module_label': 'Projects',
+		'module_name': 'Projects',
+		'module_page': None,
+		'module_seq': 2,
+		'name': 'Projects',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 17:31:44',
+		'description': None,
+		'display_name': 'Project',
+		'doc_name': 'Project',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'name': 'MDI00099',
+		'owner': 'Administrator',
+		'parent': 'Projects',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': None,
+		'description': None,
+		'display_name': 'Task',
+		'doc_name': 'Ticket',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'name': 'MDI00285',
+		'owner': None,
+		'parent': 'Projects',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': None,
+		'description': None,
+		'display_name': 'Gantt Chart',
+		'doc_name': 'Projects',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'name': 'MDI00286',
+		'owner': None,
+		'parent': 'Projects',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': None,
+		'description': None,
+		'display_name': 'Timesheet',
+		'doc_name': 'Timesheet',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'name': 'MDI00287',
+		'owner': None,
+		'parent': 'Projects',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 17:31:44',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'name': 'MDR00012',
+		'owner': 'Administrator',
+		'parent': 'Projects',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Projects User'
+	},
+	{
+		'creation': '2010-11-30 17:31:44',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2011-03-24 15:07:53',
+		'modified_by': 'Administrator',
+		'name': 'MDR00013',
+		'owner': 'Administrator',
+		'parent': 'Projects',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'System Manager'
+	}
+]
\ No newline at end of file
diff --git a/projects/__init__.py b/projects/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/__init__.py
diff --git a/projects/doctype/__init__.py b/projects/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/__init__.py
diff --git a/projects/doctype/activity_type/__init__.py b/projects/doctype/activity_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/activity_type/__init__.py
diff --git a/projects/doctype/activity_type/activity_type.txt b/projects/doctype/activity_type/activity_type.txt
new file mode 100644
index 0000000..22abb5b
--- /dev/null
+++ b/projects/doctype/activity_type/activity_type.txt
@@ -0,0 +1,136 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'field:activity_type',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-21 15:43:40',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': 1,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-21 15:43:40',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'Activity Type',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'use_template': None,
+		'version': 12
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-02-21 15:43:40',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-02-21 15:43:40',
+		'modified_by': 'Administrator',
+		'name': 'PERM00739',
+		'owner': 'Administrator',
+		'parent': 'Activity Type',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-02-21 15:43:40',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-02-21 15:43:40',
+		'modified_by': 'Administrator',
+		'name': 'PERM00740',
+		'owner': 'Administrator',
+		'parent': 'Activity Type',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Projects User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-21 15:43:40',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'activity_type',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Activity Type',
+		'modified': '2011-02-21 15:43:40',
+		'modified_by': 'Administrator',
+		'name': 'FL04231',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Activity Type',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/projects/doctype/project/__init__.py b/projects/doctype/project/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/project/__init__.py
diff --git a/projects/doctype/project/project.js b/projects/doctype/project/project.js
new file mode 100644
index 0000000..b286cd7
--- /dev/null
+++ b/projects/doctype/project/project.js
@@ -0,0 +1,39 @@
+//-------------------------- Onload ---------------------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+}
+
+//-------------------  Get Contact Person based on customer selected ---------------------------
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  if(doc.customer)
+    return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE (`tabContact`.is_customer = 1 AND `tabContact`.customer_name = "'+ doc.customer+'") AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+  else
+    msgprint("Please select Customer first")
+}
+
+//-------------------------------- get query select Territory ------------------------------------------
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+//------------------------ Customer and its primary contact Details ------------------------------------
+cur_frm.cscript.customer = function(doc, cdt, cdn) {
+  if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
+}
+
+//--------------------- Customer's Contact Person Details --------------------------------------------
+cur_frm.cscript.contact_person = function(doc, cdt, cdn) {
+  if(doc.contact_person) {
+    get_server_fields('get_contact_details','','',doc, cdt, cdn, 1);
+  }
+}
+
+//--------- calculate gross profit --------------------------------
+cur_frm.cscript.project_value = function(doc, cdt, cdn){
+  get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
+}
+
+//--------- calculate gross profit --------------------------------
+cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){
+  get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
+}
\ No newline at end of file
diff --git a/projects/doctype/project/project.py b/projects/doctype/project/project.py
new file mode 100644
index 0000000..e68771c
--- /dev/null
+++ b/projects/doctype/project/project.py
@@ -0,0 +1,76 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist  
+  
+  # Get Customer Details along with its primary contact details
+  # ==============================================================
+  def get_customer_details(self):
+    details =sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1)
+    if details:
+      ret = {
+        'customer_address'  :  details and details[0]['address'] or '',
+        'territory'       :  details and details[0]['territory'] or '',
+        'customer_group'    :  details and details[0]['customer_group'] or '',
+	'customer_name'     :  details and details[0]['customer_name'] or ''
+      }
+      #get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details)
+      contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact='Yes' and docstatus!=2" %(self.doc.customer), as_dict = 1)
+      ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
+      ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
+      ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''    
+      return cstr(ret)
+    else:
+      msgprint("Customer : %s does not exist in system." % (self.doc.customer))
+      raise Exception  
+  
+  # Get customer's contact person details
+  # ==============================================================
+  def get_contact_details(self):
+    contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc,contact_person,self.doc.customer), as_dict=1)
+    if contact:
+      ret = {
+        'contact_no' : contact and contact[0]['contact_no'] or '',
+        'email_id' : contact and contact[0]['email_id'] or ''
+      }
+      return str(ret)
+    else:
+      msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person))
+      raise Exception
+  
+  #calculate gross profit
+  #=============================================
+  def get_gross_profit(self):
+    pft, per_pft =0, 0
+    pft = flt(self.doc.project_value) - flt(self.doc.est_material_cost)
+    #if pft > 0:
+    per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
+    ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
+    return cstr(ret)
+    
+  # validate
+  #================================================
+  def validate(self):
+    if self.doc.project_start_date and self.doc.completion_date:
+      if getdate(self.doc.completion_date) < getdate(self.doc.project_start_date):
+        msgprint("Expected Completion Date can not be less than Project Start Date")
+        raise Exception
diff --git a/projects/doctype/project/project.txt b/projects/doctype/project/project.txt
new file mode 100644
index 0000000..70c4947
--- /dev/null
+++ b/projects/doctype/project/project.txt
@@ -0,0 +1,1220 @@
+[
+	{
+		'_last_update': '1300962301',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:project_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:14',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-11-26 12:28:34',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'Project',
+		'name_case': '',
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': '',
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'customer, status, priority, is_active',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'subject': ' ',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 32
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:14',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00408',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:14',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'PERM00409',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Projects User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': 'Helps you keep track of your projects and links to Tasks. You can tag a task to a project to track its progress',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02344',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': 'Project will get saved and will be searchable with project name given',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Project Name',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02345',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:55',
+		'default': 'Open',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2010-09-01 15:47:55',
+		'modified_by': 'Administrator',
+		'name': 'FL03822',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': 'Open\nCompleted\nCancelled',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_active',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Is Active',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02348',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_active',
+		'oldfieldtype': 'Select',
+		'options': 'Yes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'priority',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Priority',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02346',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'priority',
+		'oldfieldtype': 'Select',
+		'options': 'Medium\nLow\nHigh',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_value',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Project Value',
+		'modified': '2010-12-14 10:33:01',
+		'modified_by': 'Administrator',
+		'name': 'FL04170',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_value',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'gross_margin_value',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Gross Margin Value',
+		'modified': '2010-12-14 10:33:01',
+		'modified_by': 'Administrator',
+		'name': 'FL04171',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'gross_margin_value',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_gross_margin',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Gross Margin %',
+		'modified': '2010-12-14 10:33:01',
+		'modified_by': 'Administrator',
+		'name': 'FL04172',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'per_gross_margin',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'est_material_cost',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Estimated Material Cost',
+		'modified': '2010-12-14 10:33:01',
+		'modified_by': 'Administrator',
+		'name': 'FL04173',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'est_material_cost',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_type',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Project Type',
+		'modified': '2010-09-01 15:47:55',
+		'modified_by': 'Administrator',
+		'name': 'FL03823',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_type',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_start_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 1,
+		'label': 'Project Start Date',
+		'modified': '2010-09-01 15:47:55',
+		'modified_by': 'Administrator',
+		'name': 'FL03824',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_start_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'completion_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Completion Date',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02347',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'completion_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_completion_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Actual Completion Date',
+		'modified': '2010-12-14 10:33:01',
+		'modified_by': 'Administrator',
+		'name': 'FL04169',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'act_completion_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03825',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amemdment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Amemdment Date',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03826',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amemdment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Project Details',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03827',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02349',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': '',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02350',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'notes',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Notes',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02351',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'notes',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Customer Details',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03828',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': ''
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select name of Customer to whom project belongs',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': 1,
+		'label': 'Customer',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03829',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': 1,
+		'label': 'Customer Name',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03830',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Customer Address',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03831',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': 1,
+		'label': 'Contact Person',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03832',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_person',
+		'oldfieldtype': 'Link',
+		'options': '',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': 1,
+		'label': 'Territory',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03833',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Contact No',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03834',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Email Id',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03835',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'email_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:47:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Customer Group',
+		'modified': '2010-09-01 15:47:56',
+		'modified_by': 'Administrator',
+		'name': 'FL03836',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_group',
+		'oldfieldtype': 'Link',
+		'options': 'Customer Group',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': 'Important dates and commitments in your project life cycle',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Milestones',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02352',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:14',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_milestones',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Project Milestones',
+		'modified': '2010-08-08 17:09:14',
+		'modified_by': 'Administrator',
+		'name': 'FL02353',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_milestones',
+		'oldfieldtype': 'Table',
+		'options': 'Project Milestone',
+		'owner': 'Administrator',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2010-12-14 10:33:01',
+		'modified_by': 'Administrator',
+		'name': 'FL04174',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Project',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/projects/doctype/project_activity/__init__.py b/projects/doctype/project_activity/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/project_activity/__init__.py
diff --git a/projects/doctype/project_activity/project_activity.js b/projects/doctype/project_activity/project_activity.js
new file mode 100644
index 0000000..bc256a1
--- /dev/null
+++ b/projects/doctype/project_activity/project_activity.js
@@ -0,0 +1,83 @@
+cur_frm.cscript.onload = function(doc, dt, dn) {
+  // created?
+  if(cur_frm.mylist) {
+     cur_frm.mylist.run();
+     return;
+  } else {
+
+    // create a new listing
+    var lst = new Listing('Activities Updates');
+
+    lst.colwidths = ['5%','30%','40%','25%'];
+ 
+    // define options
+    var opts = {};
+
+    opts.head_main_style = {};
+    opts.cell_style = { padding:'3px 2px', borderRight : '0px', borderBottom : '1px solid #AAA', verticalAlign: 'top'}
+    opts.head_style = { padding:'3px 2px', borderBottom : '1px solid #AAA'}
+    opts.alt_cell_style = {};
+    opts.hide_print = 1;
+    opts.no_border = 1;
+
+    opts.hide_export = 1;
+    opts.hide_print = 1;
+    opts.hide_rec_label = 1;
+
+    lst.opts = opts;
+  
+    // query
+    lst.get_query = function() {
+      var doc = cur_frm.doc;
+      this.query = "select owner,creation,`update`, hours from `tabProject Activity Update` where parent = '"+doc.name+"'";
+      this.query_max = "select count(*) from `tabProject Activity Update` where parent = '"+doc.name+"'";
+    }
+
+    lst.show_cell = function(cell,ri,ci,d){
+ 
+      // owner and date
+      if (ci==0){ 
+        var d1 = $a(cell,'div');
+        var img = $a(cell,'img','',{width:'40px'});
+        set_user_img(img,d[ri][0])
+        var d2 = $a(cell,'div');
+        d2.innerHTML =  d[ri][0] + ' on: ' + date.str_to_user(d[ri][1]);
+      }
+
+      // update
+      if(ci==1) {
+        cell.innerHTML =  replace_newlines(d[ri][2]);
+      }
+
+      // Hours
+      if (ci==2) { 
+        cell.innerHTML = d[ri][3] + ' hrs';
+      }
+    }
+  
+    lst.make(cur_frm.fields_dict['Updates HTML'].wrapper);
+    cur_frm.mylist = lst;
+    lst.run();
+  }
+}
+
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+
+  // show activities only after project is saved
+
+  var fl = ['new_update','Add','hours','Updates HTML'];
+  if(doc.__islocal) { 
+    hide_field(fl);}
+  else { 
+    unhide_field(fl); }
+}
+
+cur_frm.cscript['Add'] = function(doc, dt, dn) {
+  var callback = function(r,rt) {
+    
+    // refresh listing
+    cur_frm.mylist.run();
+
+  }
+  $c_obj([doc],'add_update','',callback);
+}
\ No newline at end of file
diff --git a/projects/doctype/project_activity/project_activity.py b/projects/doctype/project_activity/project_activity.py
new file mode 100644
index 0000000..af94ec8
--- /dev/null
+++ b/projects/doctype/project_activity/project_activity.py
@@ -0,0 +1,32 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+
+  def add_update(self):
+    d = Document('Project Activity Update')
+    d.parent = self.doc.name
+    d.update = self.doc.new_update
+    d.hours = self.doc.hours
+    d.save(1)
+
+    self.doc.new_update = ''
+    self.doc.hours = ''
\ No newline at end of file
diff --git a/projects/doctype/project_activity/project_activity.txt b/projects/doctype/project_activity/project_activity.txt
new file mode 100644
index 0000000..38c0139
--- /dev/null
+++ b/projects/doctype/project_activity/project_activity.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 13:29:32', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'Activity.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Project Activity', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00846', 'parent': 'Project Activity', 'read': 1, 'create': 1, 'creation': '2010-04-20 13:29:32', 'modified': '2010-04-20 15:22:20', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-20 13:52:55', 'doctype': 'DocField', 'oldfieldname': 'project', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Project', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04821', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:20', 'parenttype': 'DocType', 'fieldname': 'project', 'fieldtype': 'Link', 'options': 'Project', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 13:29:32', 'doctype': 'DocField', 'oldfieldname': 'activity_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Activity Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04814', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:20', 'parenttype': 'DocType', 'fieldname': 'activity_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-20 13:29:32', 'doctype': 'DocField', 'oldfieldname': 'percent_complete', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Percent Complete', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04815', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': 'percent_complete', 'fieldtype': 'Select', 'options': '0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75\n80\n85\n90\n95\n100', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-20 13:39:48', 'doctype': 'DocField', 'oldfieldname': 'last_update', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Last Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04819', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': 'last_update', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 13:39:48', 'doctype': 'DocField', 'oldfieldname': 'last_update_by', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Last Update By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04820', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': 'last_update_by', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-04-20 15:16:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Updates', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04875', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-04-20 13:29:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Updates HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04816', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-20 15:05:24', 'doctype': 'DocField', 'oldfieldname': 'new_update', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'New Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04872', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': 'new_update', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Float', 'creation': '2010-04-20 15:05:24', 'doctype': 'DocField', 'oldfieldname': 'hours', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Hours', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04873', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': 'hours', 'fieldtype': 'Float', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-04-20 15:05:24', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Add', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04874', 'idx': 10, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-20 15:22:21', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/projects/doctype/project_activity_update/__init__.py b/projects/doctype/project_activity_update/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/project_activity_update/__init__.py
diff --git a/projects/doctype/project_activity_update/project_activity_update.txt b/projects/doctype/project_activity_update/project_activity_update.txt
new file mode 100644
index 0000000..9b11c67
--- /dev/null
+++ b/projects/doctype/project_activity_update/project_activity_update.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 13:32:19', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Project Activity Update', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-20 13:32:19', 'doctype': 'DocField', 'oldfieldname': 'update', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity Update', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04817', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-20 13:32:19', 'parenttype': 'DocType', 'fieldname': 'update', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Float', 'creation': '2010-04-20 13:32:19', 'doctype': 'DocField', 'oldfieldname': 'hours', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Hours', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'e.g. 0.5, 2.5 etc', 'parent': 'Project Activity Update', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04818', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-20 13:32:19', 'parenttype': 'DocType', 'fieldname': 'hours', 'fieldtype': 'Float', 'options': '', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/projects/doctype/project_control/__init__.py b/projects/doctype/project_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/project_control/__init__.py
diff --git a/projects/doctype/project_control/project_control.py b/projects/doctype/project_control/project_control.py
new file mode 100644
index 0000000..82cb1c7
--- /dev/null
+++ b/projects/doctype/project_control/project_control.py
@@ -0,0 +1,116 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+  
+  def get_projects(self, arg):
+    # project list
+    pl=[]
+    status={}
+    if arg == 'Open':
+      pl = [p[0] for p in sql("select name from `tabProject` where status = 'Open' order by creation desc limit 20")]
+      for p1 in pl:
+        status[p1] = 'Open'
+    elif arg == 'Completed':
+      pl = [p[0] for p in sql("select name from `tabProject` where status = 'Completed' order by creation desc limit 20")]
+      for p2 in pl:
+        status[p2] = 'Completed'
+    elif arg == 'Cancelled':
+      pl = [p[0] for p in sql("select name from `tabProject` where status = 'Cancelled' order by creation desc limit 20")]
+      for p3 in pl:
+        status[p3] = 'Cancelled'
+    else:
+      #pl = [p[0] for p in sql("select name from `tabProject` order by creation desc limit 20")]
+      pl1 = sql("select name, status from `tabProject` order by creation desc limit 20", as_dict=1)
+      for p4 in pl1:
+        status[p4['name']] = p4['status']
+        pl.append(p4['name'])
+    
+    # milestones in the next 7 days for active projects
+    ml = convert_to_lists(sql("select t1.milestone_date, t1.milestone, t1.parent from `tabProject Milestone` t1, tabProject t2 where t1.parent = t2.name and t2.status='Open' and DATEDIFF(t1.milestone_date, CURDATE()) BETWEEN 0 AND 7 ORDER BY t1.milestone_date ASC"))
+
+    # percent of activity completed per project
+    comp = {}
+    n_tasks = {}
+    
+    for p in pl:
+      t1 = sql('select count(*) from tabTicket where project=%s and docstatus!=2', p)[0][0]
+      n_tasks[p] = t1 or 0
+      if t1:
+        t2 = sql('select count(*) from tabTicket where project=%s and docstatus!=2 and status="Closed"', p)[0][0]
+        comp[p] = cint(flt(t2)*100/t1)
+    
+    return {'pl':pl, 'ml':ml, 'comp':comp, 'n_tasks':n_tasks, 'status':status}
+    
+  def get_resources(self):
+    ret = {}
+
+    # resource list
+    rl = sql("select distinct allocated_to, assignee_email from tabTicket")
+
+    # get open & closed tickets
+    for r in rl:
+      if r[0]:
+        ret[r[1]] = {}
+        ret[r[1]]['id'] = r[0]
+        ret[r[1]]['Total'] = sql("select count(*) from tabTicket where allocated_to=%s and docstatus!=2", r[0])[0][0]
+        ret[r[1]]['Closed'] = sql("select count(*) from tabTicket where allocated_to=%s and status='Closed' and docstatus!=2", r[0])[0][0]
+        ret[r[1]]['percent'] = cint(flt(ret[r[1]]['Closed']) * 100 / ret[r[1]]['Total'])
+
+    return ret
+
+  # --------------------------------------------------------------
+  # for Gantt Chart
+
+  def get_init_data(self, arg=''):
+    pl = [p[0] for p in sql('select name from tabProject where docstatus != 2')]
+    rl = [p[0] for p in sql('select distinct allocated_to from tabTicket where docstatus != 2 and ifnull(allocated_to,"") != ""')]
+    return {'pl':pl, 'rl':rl}
+
+  def get_tasks(self, arg):
+    start_date, end_date, project, resource = arg.split('~~~')
+
+    cl = ''
+    if project and project != 'All':
+      cl = " and ifnull(project,'') = '%s'" % project
+
+    if resource and resource != 'All':
+      cl = " and ifnull(allocated_to,'') = '%s'" % resource
+
+    tl = sql("""
+      select subject, allocated_to, project, exp_start_date, exp_end_date, priority, status, name
+      from tabTicket 
+      where 
+        ((exp_start_date between '%(st)s' and '%(end)s') or 
+        (exp_end_date between '%(st)s' and '%(end)s') or 
+        (exp_start_date < '%(st)s' and exp_end_date > '%(end)s')) %(cond)s order by exp_start_date limit 100""" % {'st': start_date, 'end': end_date, 'cond':cl})
+
+    return convert_to_lists(tl)
+  
+  def declare_proj_completed(self, arg):
+    chk = sql("select name from `tabTicket` where project=%s and status='Open'", arg)
+    if chk:
+      chk_lst = [x[0] for x in chk]
+      msgprint("Task(s) "+','.join(chk_lst)+" has staus 'Open'. Please submit all tasks against this project before closing the project.")
+      return cstr('false')
+    else:
+      sql("update `tabProject` set status = 'Completed' where name = %s", arg)
+      return cstr('true')
\ No newline at end of file
diff --git a/projects/doctype/project_control/project_control.txt b/projects/doctype/project_control/project_control.txt
new file mode 100644
index 0000000..e171912
--- /dev/null
+++ b/projects/doctype/project_control/project_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 15:42:00', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 43, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': '', 'name': 'Project Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-02 10:10:37', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/projects/doctype/project_milestone/__init__.py b/projects/doctype/project_milestone/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/project_milestone/__init__.py
diff --git a/projects/doctype/project_milestone/project_milestone.txt b/projects/doctype/project_milestone/project_milestone.txt
new file mode 100644
index 0000000..c098400
--- /dev/null
+++ b/projects/doctype/project_milestone/project_milestone.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 13:27:02', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Project Milestone', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-20 13:27:02', 'doctype': 'DocField', 'oldfieldname': 'milestone_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Milestone Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Milestone', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04807', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-20 13:27:02', 'parenttype': 'DocType', 'fieldname': 'milestone_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-20 13:27:02', 'doctype': 'DocField', 'oldfieldname': 'milestone', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Milestone', 'width': '300px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Milestone', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04808', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-20 13:27:02', 'parenttype': 'DocType', 'fieldname': 'milestone', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-20 13:27:02', 'doctype': 'DocField', 'oldfieldname': 'status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Milestone', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04809', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-20 13:27:02', 'parenttype': 'DocType', 'fieldname': 'status', 'fieldtype': 'Select', 'options': 'Pending\nCompleted', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/projects/doctype/ticket/__init__.py b/projects/doctype/ticket/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/ticket/__init__.py
diff --git a/projects/doctype/ticket/ticket.comp.js b/projects/doctype/ticket/ticket.comp.js
new file mode 100644
index 0000000..35972cb
--- /dev/null
+++ b/projects/doctype/ticket/ticket.comp.js
@@ -0,0 +1,16 @@
+
+cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.senders_name){doc.senders_name=user_fullname;doc.senders_email=user;refresh_many(['senders_name','senders_email']);}
+if(doc.__islocal){doc.status='Open';doc.opening_date=get_today();refresh_many(['status','opening_date']);}
+else{if(!doc.opening_date){doc.opening_date=dateutil.str_to_user(only_date(doc.creation));refresh_field('opening_date');}}
+if(doc.status=='Open')doc.review_date=doc.closing_date='';else if(doc.status=='Pending Review')doc.closing_date='';refresh_many(['closing_date','review_date']);if(doc.project)cur_frm.cscript.project(doc,cdt,cdn);}
+cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons();if(doc.status=='Pending Review'&&(doc.senders_name==user_fullname||doc.senders_email==user)){cur_frm.add_custom_button('Declare Completed',cur_frm.cscript['Declare Completed']);cur_frm.add_custom_button('Reopen Task',cur_frm.cscript['Reopen Task']);}
+if(doc.status=='Open'&&!doc.__islocal){cur_frm.add_custom_button('Cancel Task',cur_frm.cscript['Cancel Task']);if(doc.allocated_to==user)cur_frm.add_custom_button('Get Approval',cur_frm.cscript['Get Approval']);}}
+cur_frm.fields_dict['project'].get_query=function(doc,cdt,cdn){var cond='';if(doc.customer)cond='ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50',{cond:cond});}
+cur_frm.cscript.project=function(doc,cdt,cdn){if(doc.project)get_server_fields('get_project_details','','',doc,cdt,cdn,1);}
+cur_frm.fields_dict['customer'].get_query=function(doc,cdt,cdn){var cond='';if(doc.project)cond='ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50',{cond:cond});}
+cur_frm.cscript.customer=function(doc,cdt,cdn){if(doc.customer)get_server_fields('get_customer_details','','',doc,cdt,cdn,1);else doc.customer_name='';}
+cur_frm.cscript.allocated_to=function(doc,cdt,cdn){get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);}
+cur_frm.cscript['Get Approval']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'set_for_review','',function(r,rt){if(r.message=='true'){doc.status='Pending Review';refresh_many(['review_date','status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
+cur_frm.cscript['Reopen Task']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'reopen_task','',function(r,rt){if(r.message=='true'){doc.status='Open';refresh_many(['status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
+cur_frm.cscript['Cancel Task']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'cancel_task','',function(r,rt){if(r.message=='true'){doc.status='Cancelled';refresh_many(['status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
+cur_frm.cscript['Declare Completed']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_completed','',function(r,rt){if(r.message=='true'){doc.status='Closed';refresh_many(['review_date','closing_date','status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
\ No newline at end of file
diff --git a/projects/doctype/ticket/ticket.js b/projects/doctype/ticket/ticket.js
new file mode 100644
index 0000000..323643b
--- /dev/null
+++ b/projects/doctype/ticket/ticket.js
@@ -0,0 +1,106 @@
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  if(!doc.senders_name) {  
+    doc.senders_name = user_fullname;
+    doc.senders_email = user;
+    refresh_many(['senders_name', 'senders_email']);
+  }
+
+  if(doc.__islocal) {
+    doc.status = 'Open';
+    doc.opening_date = get_today();
+    refresh_many(['status', 'opening_date']);
+  }
+  else{
+    if(!doc.opening_date){
+      doc.opening_date = dateutil.str_to_user(only_date(doc.creation));
+      refresh_field('opening_date');      
+    }
+  }  
+  
+  //hide unhide field depends on status
+  if(doc.status == 'Open') doc.review_date = doc.closing_date = '';
+  else if(doc.status == 'Pending Review') doc.closing_date = '';
+  refresh_many(['closing_date','review_date']); 
+
+  if(doc.project) cur_frm.cscript.project(doc, cdt, cdn);  
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn) {
+  cur_frm.clear_custom_buttons();
+  if(doc.status == 'Pending Review' && (doc.senders_name == user_fullname || doc.senders_email == user)) {
+    cur_frm.add_custom_button('Declare Completed', cur_frm.cscript['Declare Completed']);
+    cur_frm.add_custom_button('Reopen Task', cur_frm.cscript['Reopen Task']);
+  }
+  if(doc.status == 'Open' && !doc.__islocal) {
+    cur_frm.add_custom_button('Cancel Task', cur_frm.cscript['Cancel Task']);
+    if(doc.allocated_to == user) cur_frm.add_custom_button('Get Approval', cur_frm.cscript['Get Approval']);
+  }
+}
+
+cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
+  var cond='';
+  if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
+  
+  return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
+}
+
+
+cur_frm.cscript.project = function(doc, cdt, cdn){
+  if(doc.project) get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
+}
+
+cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){
+  var cond='';
+  if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';
+  
+  return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50', {cond:cond});
+}
+
+cur_frm.cscript.customer = function(doc, cdt, cdn){
+  if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
+  else doc.customer_name ='';
+}
+
+cur_frm.cscript.allocated_to = function(doc,cdt,cdn){
+  get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript['Get Approval'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'set_for_review', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Pending Review'; //for refresh
+      refresh_many(['review_date','status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
+
+cur_frm.cscript['Reopen Task'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'reopen_task', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Open'; //for refresh
+      refresh_many(['status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
+
+cur_frm.cscript['Cancel Task'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'cancel_task', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Cancelled'; //for refresh
+      refresh_many(['status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
+
+cur_frm.cscript['Declare Completed'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_completed', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Closed'; //for refresh
+      refresh_many(['review_date', 'closing_date', 'status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
\ No newline at end of file
diff --git a/projects/doctype/ticket/ticket.py b/projects/doctype/ticket/ticket.py
new file mode 100644
index 0000000..8d716cc
--- /dev/null
+++ b/projects/doctype/ticket/ticket.py
@@ -0,0 +1,167 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  def get_project_details(self):
+    cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
+    if cust:
+      ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
+      return cstr(ret)
+  
+  def get_customer_details(self):
+    cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
+    if cust:
+      ret = {'customer_name': cust and cust[0][0] or ''}
+      return cstr(ret)
+  
+  def get_allocated_to_name(self):
+    as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
+    ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
+    return cstr(ret)
+
+  # validate
+  #--------------------------------------------   
+
+
+  def validate(self):
+    if not self.doc.opening_date:
+      msgprint("Please enter Opening Date.")
+      raise Exception
+    elif getdate(self.doc.opening_date) > getdate(nowdate()):
+      msgprint("Opening date can not be future date")
+      raise Exception
+    
+    if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
+      msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
+      raise Exception
+    
+    if self.doc.act_start_date and self.doc.act_end_date and getdate(self.doc.act_start_date) > getdate(self.doc.act_end_date):
+      msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
+      raise Exception
+    
+    if self.doc.opening_date and self.doc.review_date and getdate(self.doc.opening_date) > getdate(self.doc.review_date):
+      msgprint("Review Date should be greater than or equal to Opening Date ")
+      raise Exception
+    
+    if self.doc.closing_date and self.doc.review_date and getdate(self.doc.closing_date) < getdate(self.doc.review_date):
+      msgprint("Closing Date should be greater than or equal to Review Date ")
+      raise Exception
+
+  # on update
+  #--------------------------------------------   
+  
+  def on_update(self):
+    pass
+        
+  #validate before sending for approval
+  def validate_for_pending_review(self):
+    if not self.doc.allocated_to:
+      msgprint("Please enter allocated_to.")
+      raise Exception
+    self.validate_with_timesheet_dates()
+  
+  #validate before closing task
+  def validate_for_closed(self):
+    self.check_non_submitted_timesheets()
+    self.get_actual_total_hrs()
+  
+  def check_non_submitted_timesheets(self):
+    chk = sql("select t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent=t1.name and t2.task_id=%s and t1.status='Draft'", self.doc.name)
+    if chk:
+      chk_lst = [x[0] for x in chk]
+      msgprint("Please submit timesheet(s) : "+','.join(chk_lst)+" before declaring this task as completed. As details of this task present in timesheet(s)")
+      raise Exception
+  
+  #calculate actual total hours taken to complete task from timesheets
+  def get_actual_total_hrs(self):
+    import datetime
+    import time
+    chk = sql("select t2.act_total_hrs from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' and ifnull(t2.act_total_hrs, '')!='' order by t1.timesheet_date asc", self.doc.name)
+    if chk:
+      chk_lst = [x[0] for x in chk]
+      actual_total = total =0
+      
+      for m in chk_lst:
+        m1, m2=[], 0
+        m1 = m.split(":")
+        m2 = (datetime.timedelta(minutes=cint(m1[1]), hours=cint(m1[0]))).seconds
+        total = total + m2
+      
+      actual_total = time.strftime("%H:%M", time.gmtime(total))
+      set(self.doc, 'act_total_hrs', actual_total)
+  
+  # validate and fetch actual start and end date
+  def validate_with_timesheet_dates(self):
+    chk = sql("select t1.name, t1.timesheet_date from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' order by t1.timesheet_date asc", self.doc.name, as_dict=1)
+    if chk:
+      if self.doc.act_start_date:
+        if chk[0]['timesheet_date'] > getdate(self.doc.act_start_date) or chk[0]['timesheet_date'] < getdate(self.doc.act_start_date):
+          msgprint("Actual start date of this task is "+cstr(chk[0]['timesheet_date'])+" as per timesheet "+cstr(chk[0]['name']))
+          raise Exception
+      else:
+        self.doc.act_start_date = chk[0]['timesheet_date']
+      
+      if self.doc.act_end_date:
+        if chk[len(chk)-1]['timesheet_date'] < getdate(self.doc.act_end_date) or chk[len(chk)-1]['timesheet_date'] > getdate(self.doc.act_end_date):
+          msgprint("Actual end date of this task is "+cstr(chk[len(chk)-1]['timesheet_date'])+" as per timesheet "+cstr(chk[len(chk)-1]['name']))
+          raise Exception
+      else:
+        self.doc.act_end_date = chk[len(chk)-1]['timesheet_date']
+  
+  def set_for_review(self):
+    self.check_non_submitted_timesheets()
+    self.validate_for_pending_review()
+    self.get_actual_total_hrs()
+    self.doc.review_date = nowdate()
+    set(self.doc, 'status', 'Pending Review')
+    self.doc.save()
+    return cstr('true')
+  
+  def reopen_task(self):
+    set(self.doc, 'status', 'Open')
+    self.doc.save()
+    return cstr('true')
+  
+  def declare_completed(self):
+    if self.doc.status == 'Open':
+      self.validate_for_pending_review()
+      self.doc.review_date = nowdate()
+    else:
+      self.validate_with_timesheet_dates()
+    self.validate_for_closed()
+    self.doc.closing_date = nowdate()
+    set(self.doc, 'status', 'Closed')
+    set(self.doc, 'docstatus', 1)
+    self.doc.save()
+    return cstr('true')
+  
+  def cancel_task(self):
+    chk = sql("select distinct t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status!='Cancelled'", self.doc.name)
+    if chk:
+      chk_lst = [x[0] for x in chk]
+      msgprint("Timesheet(s) "+','.join(chk_lst)+" created against this task. Thus can not be cancelled")
+      raise Exception
+    else:
+      set(self.doc, 'status', 'Cancelled')
+      set(self.doc, 'docstatus', 2)
+    self.doc.save()
+    return cstr('true')
+  
+  def on_cancel(self):
+    self.cancel_task()
\ No newline at end of file
diff --git a/projects/doctype/ticket/ticket.txt b/projects/doctype/ticket/ticket.txt
new file mode 100644
index 0000000..adb49b3
--- /dev/null
+++ b/projects/doctype/ticket/ticket.txt
@@ -0,0 +1,1590 @@
+[
+	{
+		'_last_update': '1301381320',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'TIC/.####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:28',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'Ticket',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(subject)s',
+		'tag_fields': 'status',
+		'use_template': None,
+		'version': 146
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:28',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'name': 'PERM00615',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:28',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'name': 'PERM00616',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:28',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'name': 'PERM00617',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Projects User',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:28',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'name': 'PERM00618',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Projects User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:28',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Task Details',
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'name': 'FL03607',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'subject',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Subject',
+		'modified': '2011-03-29 12:18:37',
+		'modified_by': 'Administrator',
+		'name': 'FL03608',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'subject',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Status',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03610',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': 'Open\nPending Review\nClosed\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'reason',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Reason / Error Message',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04215',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'reason',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'document_num',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Document Num',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04216',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'document_num',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': '_Login',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ticket_by',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Ticket By',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04217',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'ticket_by',
+		'oldfieldtype': 'Link',
+		'options': 'Profile',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ticket_by_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Ticket By Email',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04218',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'ticket_by_email',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'opening_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Opening Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03611',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'opening_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': 'eval:doc.status == "Closed" || doc.status == "Pending Review"',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'review_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Review Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03612',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'review_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': 'eval:doc.status == "Closed"',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'closing_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Closing Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03613',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'closing_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'priority',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': 1,
+		'label': 'Priority',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03616',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'priority',
+		'oldfieldtype': 'Select',
+		'options': 'Low\nMedium\nHigh\nUrgent',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Project',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03623',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04219',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04220',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 17:56:51',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04418',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'allocated_to',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Allocated To',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03626',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'allocated_to',
+		'oldfieldtype': 'Link',
+		'options': 'Profile',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'allocated_to_name',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Allocated To Name',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04221',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'allocated_to_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'senders_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'Raised By',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03618',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'senders_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'senders_email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Email',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03619',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'senders_email',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'senders_contact_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Senders Contact No',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03620',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'senders_contact_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'senders_company',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Senders Company',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03621',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'senders_company',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'category',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Category',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03614',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'category',
+		'oldfieldtype': 'Link',
+		'options': 'Ticket Category',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'external_or_internal',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'External or Internal',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03615',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'external_or_internal',
+		'oldfieldtype': 'Select',
+		'options': 'External\nInternal',
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04222',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04223',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03628',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Details',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03629',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'first_creation_flag',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 28,
+		'in_filter': 0,
+		'label': 'First Creation Flag',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03630',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'first_creation_flag',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'second_creation_flag',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Second Creation Flag',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL03631',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'second_creation_flag',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Time and Budget',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04224',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Expected',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04225',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'exp_start_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Expected Start Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04226',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'exp_start_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'exp_end_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': 1,
+		'label': 'Expected End Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04227',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'exp_end_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'exp_total_hrs',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Total Hours (Expected)',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04228',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'exp_total_hrs',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'allocated_budget',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Allocated Budget',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04229',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'allocated_budget',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Actual',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04230',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_start_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Actual Start Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04231',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'act_start_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_end_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Actual End Date',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04232',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'act_end_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_total_hrs',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Total Hours (Actual)',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04233',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'act_total_hrs',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'actual_budget',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Actual Budget',
+		'modified': '2011-03-29 12:18:38',
+		'modified_by': 'Administrator',
+		'name': 'FL04234',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'actual_budget',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Ticket',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/projects/doctype/timesheet/__init__.py b/projects/doctype/timesheet/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/timesheet/__init__.py
diff --git a/projects/doctype/timesheet/timesheet.js b/projects/doctype/timesheet/timesheet.js
new file mode 100644
index 0000000..4140698
--- /dev/null
+++ b/projects/doctype/timesheet/timesheet.js
@@ -0,0 +1,31 @@
+
+// ======================= OnLoad =============================================
+cur_frm.cscript.onload = function(doc,cdt,cdn){  
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+  if(!doc.timesheet_date) set_multiple(cdt,cdn,{timesheet_date:get_today()});
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn){}
+
+
+cur_frm.fields_dict['timesheet_details'].grid.get_field("project_name").get_query = function(doc,cdt,cdn){
+  var cond=cond1='';
+  var d = locals[cdt][cdn];
+  //if(d.customer_name) cond = 'ifnull(`tabProject`.customer_name, "") = "'+d.customer_name+'" AND';
+  if(d.task_id) cond1 = 'ifnull(`tabTicket`.project, "") = `tabProject`.name AND `tabTicket`.name = "'+d.task_id+'" AND';
+  
+  return repl('SELECT distinct `tabProject`.`name` FROM `tabProject`, `tabTicket` WHERE %(cond1)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond1:cond1});
+}
+
+cur_frm.cscript.task_name = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  if(d.task_name) get_server_fields('get_task_details', d.task_name, 'timesheet_details', doc, cdt, cdn, 1);
+}
+
+cur_frm.fields_dict['timesheet_details'].grid.get_field("task_name").get_query = function(doc,cdt,cdn){
+  var cond='';
+  var d = locals[cdt][cdn];
+  if(d.project_name) cond = 'ifnull(`tabTicket`.project, "") = "'+d.project_name+'" AND';
+  
+  return repl('SELECT distinct `tabTicket`.`subject` FROM `tabTicket` WHERE %(cond)s `tabTicket`.`subject` LIKE "%s" ORDER BY `tabTicket`.`subject` ASC LIMIT 50', {cond:cond});
+}
\ No newline at end of file
diff --git a/projects/doctype/timesheet/timesheet.py b/projects/doctype/timesheet/timesheet.py
new file mode 100644
index 0000000..ba921f4
--- /dev/null
+++ b/projects/doctype/timesheet/timesheet.py
@@ -0,0 +1,81 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  
+  def get_customer_details(self, project_name):
+    cust = sql("select customer, customer_name from `tabProject` where name = %s", project_name)
+    if cust:
+      ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
+      return (ret)
+  
+  def get_task_details(self, task_sub):
+    tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub)
+    if tsk:
+      ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
+      return cstr(ret)
+  
+  def validate(self):
+    if getdate(self.doc.timesheet_date) > getdate(nowdate()):
+      msgprint("You can not prepare timesheet for future date")
+      raise Exception
+    
+    chk = sql("select name from `tabTimesheet` where timesheet_date=%s and owner=%s and status!='Cancelled' and name!=%s", (self.doc.timesheet_date, self.doc.owner, self.doc.name))
+    if chk:
+      msgprint("You have already created timesheet "+ cstr(chk and chk[0][0] or '')+" for this date.")
+      raise Exception
+
+    import time
+    for d in getlist(self.doclist, 'timesheet_details'):
+      if d.act_start_time and d.act_end_time:
+        d1 = time.strptime(d.act_start_time, "%H:%M")
+        d2 = time.strptime(d.act_end_time, "%H:%M")
+        
+        if d1 > d2:
+          msgprint("Start time can not be greater than end time. Check for Task Id : "+cstr(d.task_id))
+          raise Exception
+        elif d1 == d2:
+          msgprint("Start time and end time can not be same. Check for Task Id : "+cstr(d.task_id))
+          raise Exception
+  
+  def calculate_total_hr(self):
+    import datetime
+    import time
+    for d in getlist(self.doclist, 'timesheet_details'):
+      x1 = d.act_start_time.split(":")
+      x2 = d.act_end_time.split(":")
+      
+      d1 = datetime.timedelta(minutes=cint(x1[1]), hours=cint(x1[0]))      
+      d2 = datetime.timedelta(minutes=cint(x2[1]), hours=cint(x2[0]))
+      d3 = (d2 - d1).seconds
+      d.act_total_hrs = time.strftime("%H:%M", time.gmtime(d3))
+      sql("update `tabTimesheet Detail` set act_total_hrs = %s where parent=%s and name=%s", (d.act_total_hrs,self.doc.name,d.name))
+  
+  def on_update(self):
+    self.calculate_total_hr()
+    set(self.doc, 'status', 'Draft')
+  
+  def on_submit(self):
+    set(self.doc, 'status', 'Submitted')
+  
+  def on_cancel(self):
+    set(self.doc, 'status', 'Cancelled')
\ No newline at end of file
diff --git a/projects/doctype/timesheet/timesheet.txt b/projects/doctype/timesheet/timesheet.txt
new file mode 100644
index 0000000..18dcf4f
--- /dev/null
+++ b/projects/doctype/timesheet/timesheet.txt
@@ -0,0 +1,510 @@
+[
+	{
+		'_last_update': '1300962490',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'TimeSheet.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 10:33:07',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-03-05 17:16:43',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'Timesheet',
+		'name_case': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'status, owner, timesheet_date',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'subject': '%(owner)s',
+		'tag_fields': '',
+		'use_template': None,
+		'version': 68
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-12-23 11:48:49',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': None,
+		'modified': '2010-12-23 11:48:49',
+		'modified_by': 'Administrator',
+		'name': 'PERM00769',
+		'owner': 'Administrator',
+		'parent': 'Timesheet',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Projects User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-12-23 11:48:49',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': None,
+		'match': None,
+		'modified': '2010-12-23 11:48:49',
+		'modified_by': 'Administrator',
+		'name': 'PERM00770',
+		'owner': 'Administrator',
+		'parent': 'Timesheet',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Projects User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-12-14 10:33:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'PERM00739',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-12-14 10:33:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'PERM00740',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-05 17:16:42',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Timesheet Details',
+		'modified': '2011-03-05 17:16:42',
+		'modified_by': 'Administrator',
+		'name': 'FL04673',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 10:33:07',
+		'default': 'Draft',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 0,
+		'label': 'Status',
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'FL04235',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nCancelled',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 10:33:07',
+		'default': 'Today',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'timesheet_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Timesheet Date',
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'FL04236',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'timesheet_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'owner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Timesheet By',
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'FL04237',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'owner',
+		'oldfieldtype': 'Link',
+		'options': 'Profile',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'FL04238',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'FL04239',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-05 17:16:42',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-05 17:16:42',
+		'modified_by': 'Administrator',
+		'name': 'FL04674',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-05 17:16:42',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'notes',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Notes',
+		'modified': '2011-03-05 17:16:42',
+		'modified_by': 'Administrator',
+		'name': 'FL04672',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-05 17:16:42',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-05 17:16:42',
+		'modified_by': 'Administrator',
+		'name': 'FL04675',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-14 10:33:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'timesheet_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Timesheet Details',
+		'modified': '2010-12-14 10:33:07',
+		'modified_by': 'Administrator',
+		'name': 'FL04240',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'timesheet_details',
+		'oldfieldtype': 'Table',
+		'options': 'Timesheet Detail',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/projects/doctype/timesheet_detail/__init__.py b/projects/doctype/timesheet_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/doctype/timesheet_detail/__init__.py
diff --git a/projects/doctype/timesheet_detail/timesheet_detail.txt b/projects/doctype/timesheet_detail/timesheet_detail.txt
new file mode 100644
index 0000000..6d8dac5
--- /dev/null
+++ b/projects/doctype/timesheet_detail/timesheet_detail.txt
@@ -0,0 +1,370 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'TSD.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-02-26 11:39:45',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'module': 'Projects',
+		'name': 'Timesheet Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': None,
+		'smallicon': None,
+		'use_template': None,
+		'version': 15
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_start_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Actual Start Time',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04246',
+		'no_copy': None,
+		'oldfieldname': 'act_start_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_end_time',
+		'fieldtype': 'Time',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Actual End Time',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04247',
+		'no_copy': None,
+		'oldfieldname': 'act_end_time',
+		'oldfieldtype': 'Time',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '160px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'activity_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Activity Type',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04248',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Activity Type',
+		'owner': 'Administrator',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_details',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Additional Info',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04249',
+		'no_copy': None,
+		'oldfieldname': 'other_details',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '200px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'act_total_hrs',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Total Hours (Actual)',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04250',
+		'no_copy': None,
+		'oldfieldname': 'act_total_hrs',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04251',
+		'no_copy': None,
+		'oldfieldname': 'customer_name',
+		'oldfieldtype': 'Data',
+		'options': 'Customer',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Project',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04252',
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'task_id',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Task Id',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04253',
+		'no_copy': None,
+		'oldfieldname': 'task_id',
+		'oldfieldtype': 'Link',
+		'options': 'Ticket',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-02-26 11:39:45',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'task_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Task Name',
+		'modified': '2011-02-26 11:39:45',
+		'modified_by': 'Guest',
+		'name': 'FL04254',
+		'no_copy': None,
+		'oldfieldname': 'task_name',
+		'oldfieldtype': 'Link',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Timesheet Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': None,
+		'width': '250px'
+	}
+]
\ No newline at end of file
diff --git a/projects/page/__init__.py b/projects/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/page/__init__.py
diff --git a/projects/page/projects/__init__.py b/projects/page/projects/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/page/projects/__init__.py
diff --git a/projects/page/projects/projects.comp.js b/projects/page/projects/projects.comp.js
new file mode 100644
index 0000000..d2bd867
--- /dev/null
+++ b/projects/page/projects/projects.comp.js
@@ -0,0 +1,29 @@
+
+pscript.queries_bg_dict={'Urgent':'RED','High':'ORANGE','Low':'BLUE','Closed':'GREEN','Pending Review':'YELLOW'}
+pscript.onload_Projects=function(){var d=$i('projects_div');new PageHeader(d,'Gantt Chart');new GanttChart($a(d,'div','',{margin:'16px'}));}
+GanttChart=function(parent){this.wrapper=$a(parent,'div');this.toolbar_area=$a(this.wrapper,'div','',{padding:'16px',border:'1px solid #AAF',});$bg(this.toolbar_area,'#EEF');$br(this.toolbar_area,'3px');this.toolbar_tab=make_table(this.toolbar_area,1,4,'100%',['25%','25%','25%','25%']);this.grid_area=$a(this.wrapper,'div','',{margin:'16px 0px'});this.no_task_message=$a(this.wrapper,'div','help_box',{textAign:'center',fontSize:'14px'},'Select your criteria and click on "Make" to show the Gantt Chart')
+this.get_init_data();}
+GanttChart.prototype.get_init_data=function(){var me=this;var callback=function(r,rt){me.pl=r.message.pl.sort();me.rl=r.message.rl.sort();me.make_toolbar();}
+$c_obj('Project Control','get_init_data','',callback);}
+GanttChart.prototype.make_filter=function(label,idx){var w=$a($td(this.toolbar_tab,0,idx),'div','',{marginBottom:'8px'});var l=$a(w,'div','',{fontSize:'11px'});l.innerHTML=label;return w;}
+GanttChart.prototype.make_select=function(label,options,idx){var w=this.make_filter(label,idx);var s=$a(w,'select','',{width:'100px'});add_sel_options(s,add_lists(['All'],options));return s;}
+GanttChart.prototype.make_date=function(label,idx){var w=this.make_filter(label,idx);var i=$a(w,'input');var user_fmt=locals['Control Panel']['Control Panel'].date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';$(i).datepicker({dateFormat:user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true});return i;}
+GanttChart.prototype.make_toolbar=function(){this.r_sel=this.make_select('Resource',this.rl,0);this.p_sel=this.make_select('Project',this.pl,1);this.s_date=this.make_date('Start Date',2);this.s_date.value=date.str_to_user(date.month_start());this.e_date=this.make_date('End Date',3);this.e_date.value=date.str_to_user(date.month_end());var me=this;$btn(this.toolbar_area,'Make',function(){me.refresh();},null,'green',1);this.print_btn=$btn(this.toolbar_area,'Print',function(){me.print();},{display:'none'},null);}
+GanttChart.prototype.print=function(){$(this.grid_area).printElement();}
+GanttChart.prototype.get_data=function(){var me=this;var callback=function(r,rt){me.tasks=r.message;if(me.tasks.length){$dh(me.no_task_message);$ds(me.grid_area);me.show_tasks();$di(me.print_btn);}else{$dh(me.grid_area);$ds(me.no_task_message);$dh(me.print_btn);me.no_task_message.innerHTML='Nothing allocated for the above criteria'}}
+$c_obj('Project Control','get_tasks',[date.user_to_str(this.s_date.value),date.user_to_str(this.e_date.value),sel_val(this.p_sel),sel_val(this.r_sel)].join('~~~'),callback)}
+GanttChart.prototype.make_grid=function(){this.grid_area.innerHTML='';this.grid=new GanttGrid(this,this.s_date.value,this.e_date.value);}
+GanttChart.prototype.refresh=function(){this.get_data();}
+GanttChart.prototype.show_tasks=function(){this.make_grid();for(var i=0;i<this.tasks.length;i++){new GanttTask(this.grid,this.tasks[i],i)}}
+GanttGrid=function(chart,s_date,e_date){this.chart=chart;this.s_date=s_date;this.wrapper=$a(chart.grid_area,'div');this.start_date=date.str_to_obj(date.user_to_str(s_date));this.end_date=date.str_to_obj(date.user_to_str(e_date));this.n_days=date.get_diff(this.end_date,this.start_date)+1;this.g_width=100/this.n_days+'%';this.make();}
+GanttGrid.prototype.make_grid=function(){var ht=this.chart.tasks.length*40+'px';this.grid=$a($td(this.body,0,1),'div','',{border:'2px solid #888',height:ht,position:'relative'});this.grid_tab=make_table(this.grid,1,this.n_days,'100%',[],{width:this.g_width,borderLeft:'1px solid #DDD',height:ht});$y(this.grid_tab,{tableLayout:'fixed'});this.task_area=$a(this.grid,'div','',{position:'absolute',height:ht,width:'100%',top:'0px'});}
+GanttGrid.prototype.make_labels=function(){this.x_labels=$a($td(this.body,0,1),'div','',{marginTop:'8px'});this.x_lab_tab=make_table(this.x_labels,1,this.n_days,'100%',[],{width:this.g_width,fontSize:'10px'});$y(this.x_lab_tab,{tableLayout:'fixed'});var d=this.start_date;var today=new Date();for(var i=0;i<this.n_days;i++){if(d.getDay()==0){$td(this.x_lab_tab,0,i).innerHTML=d.getDate()+'-'+month_list[d.getMonth()];$y($td(this.grid_tab,0,i),{borderLeft:'1px solid RED'})}
+if(d.getDate()==today.getDate()&&d.getMonth()==today.getMonth()&&d.getYear()==today.getYear()){$y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'})}
+var d=date.add_days(this.start_date,1);}
+this.start_date=date.str_to_obj(date.user_to_str(this.s_date));}
+GanttGrid.prototype.make=function(){this.body=make_table(this.wrapper,1,2,'100%',['30%','70%']);this.make_grid();this.make_labels();this.y_labels=$a($td(this.body,0,0),'div','',{marginTop:'2px',position:'relative'});}
+GanttGrid.prototype.get_x=function(dt){var d=date.str_to_obj(dt);return flt(date.get_diff(d,this.start_date)+1)/flt(date.get_diff(this.end_date,this.start_date)+1)*100;}
+GanttTask=function(grid,data,idx){this.start_date=data[3];this.end_date=data[4];this.label=$a(grid.y_labels,'div','',{'top':(idx*40)+'px',overflow:'hidden',position:'absolute','width':'100%',height:'40px'});var l1=$a($a(this.label,'div'),'span','link_type');l1.innerHTML=data[0];l1.dn=data[7];l1.onclick=function(){loaddoc('Ticket',this.dn)};var l2=$a(this.label,'div','',{fontSize:'10px'});l2.innerHTML=data[1];var col=pscript.queries_bg_dict[data[5]];if(data[6]!='Open')col=pscript.queries_bg_dict[data[6]];if(!col)col='BLUE';this.body=$a(grid.task_area,'div','',{backgroundColor:col,height:'12px',position:'absolute'});this.body_info=$a(this.body,'div','',{backgroundColor:'#CCC',position:'absolute',zIndex:20});var x1=grid.get_x(this.start_date);var x2=grid.get_x(this.end_date);if(x1<=0)x1=0;else x1-=100/flt(date.get_diff(grid.end_date,grid.start_date)+1);if(x2>=100)x2=100;$y(this.body,{top:idx*40+14+'px',left:x1+'%',width:(x2-x1)+'%',zIndex:1,cursor:'pointer'})
+if(idx){var d1=$a(grid.task_area,'div','',{borderBottom:'1px solid #AAA',position:'absolute',width:'100%',top:(idx*40)+'px'});var d2=$a(grid.y_labels,'div','',{borderBottom:'1px solid #AAA',position:'absolute',width:'100%',top:(idx*40)+'px'});}
+this.make_tooltip(data);}
+GanttTask.prototype.make_tooltip=function(d){var t='<div>';if(d[0])t+='<b>Task: </b>'+d[0];if(d[5])t+='<br><b>Priority: </b>'+d[5];if(d[6])t+='<br><b>Status: </b>'+d[6];if(d[1])t+='<br><b>Allocated To: </b>'+d[1];if(d[2])t+='<br><b>Project: </b>'+d[2];if(d[3])t+='<br><b>From: </b>'+date.str_to_user(d[3]);if(d[4])t+='<br><b>To: </b>'+date.str_to_user(d[4]);t+='</div>';$(this.body).qtip({content:t,position:{corner:{tooltip:'topMiddle',target:'bottomMiddle'}},style:{border:{width:5,radius:10},padding:10,tip:true,name:'green'}})}
\ No newline at end of file
diff --git a/projects/page/projects/projects.html b/projects/page/projects/projects.html
new file mode 100644
index 0000000..c09eeba
--- /dev/null
+++ b/projects/page/projects/projects.html
@@ -0,0 +1 @@
+<div id="projects_div" class="layout_wrapper"></div>
\ No newline at end of file
diff --git a/projects/page/projects/projects.js b/projects/page/projects/projects.js
new file mode 100644
index 0000000..8335869
--- /dev/null
+++ b/projects/page/projects/projects.js
@@ -0,0 +1,276 @@
+pscript.queries_bg_dict = {
+	'Urgent':'RED',
+	'High':'ORANGE',
+	'Low':'BLUE',
+	'Closed':'GREEN',
+	'Pending Review':'YELLOW'
+}
+
+pscript.onload_Projects = function() {
+	var d = $i('projects_div');
+	
+	new PageHeader(d, 'Gantt Chart');
+	new GanttChart($a(d, 'div', '', { margin:'16px'}));
+}
+
+
+// Gantt Chart
+// ==========================================================================
+
+GanttChart = function(parent) {
+	this.wrapper = $a(parent, 'div');
+	//this.head = new PageHeader(this.wrapper, 'Gantt Chart');
+
+	this.toolbar_area = $a(this.wrapper, 'div','',{padding:'16px', border:'1px solid #AAF', }); $bg(this.toolbar_area, '#EEF'); $br(this.toolbar_area, '3px');
+	this.toolbar_tab = make_table(this.toolbar_area, 1, 4, '100%', ['25%', '25%','25%', '25%']);
+	this.grid_area = $a(this.wrapper, 'div', '', {margin: '16px 0px'});
+	this.no_task_message = $a(this.wrapper, 'div', 'help_box', 
+		{textAign:'center', fontSize:'14px'}, 'Select your criteria and click on "Make" to show the Gantt Chart')
+
+	this.get_init_data();
+	//this.make_grid();
+}
+
+GanttChart.prototype.get_init_data = function() {
+	var me = this;
+	var callback = function(r,rt) {
+		me.pl = r.message.pl.sort();
+		me.rl = r.message.rl.sort();
+
+		me.make_toolbar();
+	}
+	$c_obj('Project Control','get_init_data','', callback);
+}
+
+GanttChart.prototype.make_filter = function(label, idx) {
+	var w = $a($td(this.toolbar_tab,0,idx), 'div','',{marginBottom:'8px'});
+	var l = $a(w, 'div','',{fontSize:'11px'}); l.innerHTML = label;
+	return w;
+}
+
+GanttChart.prototype.make_select = function(label, options,idx) {
+	var w = this.make_filter(label,idx);
+	var s = $a(w, 'select','',{width:'100px'}); add_sel_options(s, add_lists(['All'],options));
+	return s;
+}
+
+GanttChart.prototype.make_date = function(label,idx) {
+	var w = this.make_filter(label,idx);
+	var i = $a(w, 'input');
+
+	var user_fmt = locals['Control Panel']['Control Panel'].date_format;
+	if(!this.user_fmt)this.user_fmt = 'dd-mm-yy';
+
+	$(i).datepicker({
+		dateFormat: user_fmt.replace('yyyy','yy'), 
+		altFormat:'yy-mm-dd', 
+		changeYear: true
+	});
+	
+	return i;
+}
+
+GanttChart.prototype.make_toolbar = function() {
+
+	// resource / project
+	this.r_sel = this.make_select('Resource', this.rl, 0);
+	this.p_sel = this.make_select('Project', this.pl, 1);
+	
+	// start / end
+	this.s_date = this.make_date('Start Date', 2); this.s_date.value = date.str_to_user(date.month_start());
+	this.e_date = this.make_date('End Date', 3); this.e_date.value = date.str_to_user(date.month_end());
+	
+	// button
+	var me = this;
+	$btn(this.toolbar_area, 'Make', function() { me.refresh(); }, null, 'green', 1);
+	this.print_btn = $btn(this.toolbar_area, 'Print', function() { me.print(); }, {display:'none'},null);
+}
+
+GanttChart.prototype.print = function() {
+	$(this.grid_area).printElement();
+}
+
+GanttChart.prototype.get_data = function() {
+	var me = this;
+	var callback = function(r, rt) {
+		me.tasks = r.message;
+		if(me.tasks.length) {
+			$dh(me.no_task_message);
+			$ds(me.grid_area);
+			me.show_tasks(); 
+			$di(me.print_btn);
+		} else {
+			// nothign to show
+			$dh(me.grid_area);
+			$ds(me.no_task_message);
+			$dh(me.print_btn);
+			me.no_task_message.innerHTML = 'Nothing allocated for the above criteria'
+		}			
+	}
+	$c_obj('Project Control','get_tasks',
+		[date.user_to_str(this.s_date.value), 
+		date.user_to_str(this.e_date.value), 
+		sel_val(this.p_sel), 
+		sel_val(this.r_sel)].join('~~~')
+	, callback)
+}
+
+GanttChart.prototype.make_grid = function() {
+	// clear earlier chart
+	this.grid_area.innerHTML = '';
+	this.grid = new GanttGrid(this, this.s_date.value, this.e_date.value);
+}
+
+GanttChart.prototype.refresh = function() {
+	this.get_data();
+}
+	
+GanttChart.prototype.show_tasks = function() {
+	this.make_grid();
+	for(var i=0; i<this.tasks.length; i++) {
+		new GanttTask(this.grid, this.tasks[i], i)
+	}
+}
+
+// ==========================================================================
+
+GanttGrid = function(chart, s_date, e_date) {
+	this.chart = chart;
+	this.s_date = s_date;
+
+	this.wrapper = $a(chart.grid_area, 'div');
+	this.start_date = date.str_to_obj(date.user_to_str(s_date));
+	this.end_date = date.str_to_obj(date.user_to_str(e_date));
+
+	this.n_days = date.get_diff(this.end_date, this.start_date) + 1;	
+	this.g_width = 100 / this.n_days + '%';	
+
+	this.make();
+}
+
+GanttGrid.prototype.make_grid = function() {
+	// grid -----------
+	var ht = this.chart.tasks.length * 40 + 'px';
+	this.grid = $a($td(this.body, 0, 1), 'div', '', {border:'2px solid #888', height: ht, position:'relative'});	
+
+	this.grid_tab = make_table(this.grid, 1, this.n_days, '100%', [], {width:this.g_width, borderLeft:'1px solid #DDD', height: ht});
+	$y(this.grid_tab,{tableLayout:'fixed'});
+
+	this.task_area = $a(this.grid, 'div', '', {position:'absolute', height:ht, width: '100%', top:'0px'});
+}
+
+GanttGrid.prototype.make_labels = function() {
+	// labels ------------
+	this.x_labels = $a($td(this.body, 0, 1), 'div', '', {marginTop:'8px'});	
+	this.x_lab_tab = make_table(this.x_labels, 1, this.n_days, '100%', [], {width:this.g_width, fontSize:'10px'});
+	$y(this.x_lab_tab,{tableLayout:'fixed'});
+	
+	var d = this.start_date;
+	var today = new Date();
+	for(var i=0; i<this.n_days; i++) {
+		if(d.getDay()==0) {
+			$td(this.x_lab_tab,0,i).innerHTML = d.getDate() + '-' + month_list[d.getMonth()];
+			$y($td(this.grid_tab,0,i),{borderLeft:'1px solid RED'})
+		}
+		if(d.getDate()==today.getDate() && d.getMonth()==today.getMonth() && d.getYear() == today.getYear()) {
+			$y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'})
+		}
+		var d = date.add_days(this.start_date, 1);
+	}
+	this.start_date = date.str_to_obj(date.user_to_str(this.s_date));
+}
+
+GanttGrid.prototype.make = function() {
+	this.body = make_table(this.wrapper, 1, 2, '100%', ['30%','70%']);
+	this.make_grid();
+	this.make_labels();
+	this.y_labels = $a($td(this.body, 0, 0), 'div', '', {marginTop:'2px', position:'relative'});	
+}
+
+GanttGrid.prototype.get_x = function(dt) {
+	var d = date.str_to_obj(dt); // convert to obj
+	return flt(date.get_diff(d, this.start_date)+1) / flt(date.get_diff(this.end_date, this.start_date)+1) * 100;
+}
+
+// ==========================================================================
+
+GanttTask = function(grid, data, idx) {
+	// start_date, end_date, name, status
+	this.start_date = data[3];
+	this.end_date = data[4];
+
+	// label
+	this.label = $a(grid.y_labels, 'div', '', {'top':(idx*40) + 'px', overflow:'hidden', position:'absolute', 'width':'100%', height: '40px'});
+	var l1 = $a($a(this.label, 'div'), 'span', 'link_type'); l1.innerHTML = data[0]; l1.dn = data[7]; l1.onclick = function() { loaddoc('Ticket', this.dn) };
+	var l2 = $a(this.label, 'div', '', {fontSize:'10px'}); l2.innerHTML = data[1];
+
+	// bar
+	var col = pscript.queries_bg_dict[data[5]];
+	if(data[6]!='Open') col = pscript.queries_bg_dict[data[6]];
+	if(!col) col = 'BLUE';
+	
+	this.body = $a(grid.task_area, 'div','',{backgroundColor:col, height:'12px', position:'absolute'});
+
+	//bar info
+	this.body_info = $a(this.body, 'div','',{backgroundColor:'#CCC', position:'absolute', zIndex:20});
+
+	var x1 = grid.get_x(this.start_date);
+	var x2 = grid.get_x(this.end_date);
+
+	if(x1<=0)x1=0;
+	else x1 -=100/flt(date.get_diff(grid.end_date, grid.start_date)+1);
+	if(x2>=100)x2=100;
+//	else x2+=100/flt(date.get_diff(grid.end_date, grid.start_date)+1);
+	
+	$y(this.body, { 
+		top: idx * 40 + 14 + 'px',
+		left: x1 + '%',
+		width: (x2-x1) + '%',
+		zIndex: 1,
+		cursor:'pointer'
+	})
+	
+	// divider
+	if(idx) {
+		var d1 = $a(grid.task_area, 'div','',{borderBottom: '1px solid #AAA', position:'absolute', width:'100%', top:(idx*40) + 'px'});
+		var d2 = $a(grid.y_labels, 'div','',{borderBottom: '1px solid #AAA', position:'absolute', width:'100%', top:(idx*40) + 'px'});
+	}
+	
+	this.make_tooltip(data);
+}
+
+GanttTask.prototype.make_tooltip = function(d) {
+	var t = '<div>';
+	if(d[0]) t += '<b>Task: </b>' + d[0];
+	if(d[5]) t += '<br><b>Priority: </b>' + d[5];
+	if(d[6]) t += '<br><b>Status: </b>' + d[6];
+	if(d[1]) t += '<br><b>Allocated To: </b>' + d[1];
+	if(d[2]) t += '<br><b>Project: </b>' + d[2];
+	if(d[3]) t += '<br><b>From: </b>' + date.str_to_user(d[3]);
+	if(d[4]) t += '<br><b>To: </b>' + date.str_to_user(d[4]);
+	t += '</div>';
+
+	$(this.body).qtip({
+		content:t,
+		position:{
+			corner:{
+				tooltip: 'topMiddle', // Use the corner...
+				target: 'bottomMiddle' // ...and opposite corner
+			}
+		},
+		style:{
+			border: {
+				width: 5,
+				radius: 10
+			},
+			padding: 10, 
+			tip: true, // Give it a speech bubble tip with automatic corner detection
+			name: 'green' // Style it according to the preset 'cream' style
+		}
+	})
+
+}
+
+
+
+
diff --git a/projects/page/projects/projects.txt b/projects/page/projects/projects.txt
new file mode 100644
index 0000000..60059d9
--- /dev/null
+++ b/projects/page/projects/projects.txt
@@ -0,0 +1 @@
+[{'creation': '2010-07-13 14:54:32', 'module': 'Projects', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'ashwini@webnotestech.com', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Projects', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Projects', 'idx': None, 'static_content': None, 'modified': '2010-11-26 09:46:09', 'parenttype': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/projects/page/projects/projects_static.html b/projects/page/projects/projects_static.html
new file mode 100644
index 0000000..0577545
--- /dev/null
+++ b/projects/page/projects/projects_static.html
@@ -0,0 +1 @@
+Projects
\ No newline at end of file
diff --git a/projects/search_criteria/__init__.py b/projects/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/__init__.py
diff --git a/projects/search_criteria/dispatch_report/__init__.py b/projects/search_criteria/dispatch_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/dispatch_report/__init__.py
diff --git a/projects/search_criteria/dispatch_report/dispatch_report.js b/projects/search_criteria/dispatch_report/dispatch_report.js
new file mode 100644
index 0000000..f2ffe9f
--- /dev/null
+++ b/projects/search_criteria/dispatch_report/dispatch_report.js
@@ -0,0 +1,5 @@
+report.customize_filters = function() {
+  this.mytabs.items['Select Columns'].hide()
+  //this.mytabs.items['More Filters'].hide()
+  //this.hide_all_filters();
+}
\ No newline at end of file
diff --git a/projects/search_criteria/dispatch_report/dispatch_report.txt b/projects/search_criteria/dispatch_report/dispatch_report.txt
new file mode 100644
index 0000000..7a56aee
--- /dev/null
+++ b/projects/search_criteria/dispatch_report/dispatch_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Posting Date,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Amount*',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Dispatch Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-05 20:34:19',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'dispatch_report',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py b/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js b/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
new file mode 100644
index 0000000..594c5c0
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
@@ -0,0 +1,16 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Delivery Note Detail'});
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt b/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
new file mode 100644
index 0000000..552b23c
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01% Billed,Delivery Note\x01% Installed,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Amount*',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Projectwise Delivered Qty and Costs',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-05 20:33:28',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_delivered_qty_and_costs',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs1/__init__.py b/projects/search_criteria/projectwise_delivered_qty_and_costs1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs1/__init__.py
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs1/projectwise_delivered_qty_and_costs1.js b/projects/search_criteria/projectwise_delivered_qty_and_costs1/projectwise_delivered_qty_and_costs1.js
new file mode 100644
index 0000000..594c5c0
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs1/projectwise_delivered_qty_and_costs1.js
@@ -0,0 +1,16 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Delivery Note Detail'});
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs1/projectwise_delivered_qty_and_costs1.txt b/projects/search_criteria/projectwise_delivered_qty_and_costs1/projectwise_delivered_qty_and_costs1.txt
new file mode 100644
index 0000000..3c8e53f
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs1/projectwise_delivered_qty_and_costs1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Detail\x01Amount*',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Projectwise Delivered Qty and Costs1',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:21:55',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_delivered_qty_and_costs1',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs2/__init__.py b/projects/search_criteria/projectwise_delivered_qty_and_costs2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs2/__init__.py
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs2/projectwise_delivered_qty_and_costs2.txt b/projects/search_criteria/projectwise_delivered_qty_and_costs2/projectwise_delivered_qty_and_costs2.txt
new file mode 100644
index 0000000..1d11e74
--- /dev/null
+++ b/projects/search_criteria/projectwise_delivered_qty_and_costs2/projectwise_delivered_qty_and_costs2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
+		'add_tab': None,
+		'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Detail\x01Amount*',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Projectwise Delivered Qty and Costs2',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Delivery Note Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:22:05',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_delivered_qty_and_costs2',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Delivery Note',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabDelivery Note`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py b/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js b/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
new file mode 100644
index 0000000..f518e4b
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
@@ -0,0 +1,15 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Detail'});
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt b/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
new file mode 100644
index 0000000..3e3108c
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
+		'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Projectwise Pending Qty and Costs',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 14:21:20',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_pending_qty_and_costs',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': '',
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs1/__init__.py b/projects/search_criteria/projectwise_pending_qty_and_costs1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs1/__init__.py
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs1/projectwise_pending_qty_and_costs1.js b/projects/search_criteria/projectwise_pending_qty_and_costs1/projectwise_pending_qty_and_costs1.js
new file mode 100644
index 0000000..f518e4b
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs1/projectwise_pending_qty_and_costs1.js
@@ -0,0 +1,15 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Detail'});
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs1/projectwise_pending_qty_and_costs1.txt b/projects/search_criteria/projectwise_pending_qty_and_costs1/projectwise_pending_qty_and_costs1.txt
new file mode 100644
index 0000000..32e83e1
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs1/projectwise_pending_qty_and_costs1.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
+		'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Projectwise Pending Qty and Costs1',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:20:54',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_pending_qty_and_costs1',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs2/__init__.py b/projects/search_criteria/projectwise_pending_qty_and_costs2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs2/__init__.py
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs2/projectwise_pending_qty_and_costs2.js b/projects/search_criteria/projectwise_pending_qty_and_costs2/projectwise_pending_qty_and_costs2.js
new file mode 100644
index 0000000..f518e4b
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs2/projectwise_pending_qty_and_costs2.js
@@ -0,0 +1,15 @@
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Detail'});
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs2/projectwise_pending_qty_and_costs2.txt b/projects/search_criteria/projectwise_pending_qty_and_costs2/projectwise_pending_qty_and_costs2.txt
new file mode 100644
index 0000000..eaff112
--- /dev/null
+++ b/projects/search_criteria/projectwise_pending_qty_and_costs2/projectwise_pending_qty_and_costs2.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
+		'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order Detail\x01Quantity,Sales Order Detail\x01Amount*',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Projectwise Pending Qty and Costs2',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Company':'Alpha Company','Sales Order\x01Fiscal Year':'2010-2011'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '`tabSales Order Detail`.`name`',
+		'idx': None,
+		'modified': '2011-05-09 11:21:04',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_pending_qty_and_costs2',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_purchase_details/__init__.py b/projects/search_criteria/projectwise_purchase_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_purchase_details/__init__.py
diff --git a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
new file mode 100644
index 0000000..19ffe09
--- /dev/null
+++ b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
@@ -0,0 +1,92 @@
+report.customize_filters = function() {
+  //hide all filters
+  //------------------------------------------------
+  this.hide_all_filters();
+
+  //add filters
+  //------------------------------------------------ 
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Purchase Order'+NEWLINE+'Purchase Invoice'+NEWLINE+'Purchase Receipt',report_default:'Purchase Order',ignore : 1,parent:'Purchase Order', single_select:1});
+
+  this.add_filter({fieldname:'purchase_order', label:'Purchase Order', fieldtype:'Link', options:'Purchase Order', ignore : 1, parent:'Purchase Order'});
+  this.add_filter({fieldname:'purchase_receipt', label:'Purchase Receipt',fieldtype:'Link', options:'Purchase Receipt',ignore : 1, parent:'Purchase Order'});
+  this.add_filter({fieldname:'purchase_invoice', label:'Purchase Invoice',fieldtype:'Link', options:'Purchase Invoice',ignore : 1, parent:'Purchase Order'});  
+
+  //unhide filters
+  //------------------------------------------------    
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+
+  //move filter field in first page
+  //------------------------------------------------    
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Order'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Invoice'].df.in_first_page = 1;   
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Receipt'].df.in_first_page = 1;   
+  
+  // default values
+  //------------------------------------------------    
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
+
+//hide select columns field
+//------------------------------------------------
+this.mytabs.items['Select Columns'].hide();
+
+
+report.get_query = function() {
+
+  //get filter values
+  based_on = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Based On'].get_value();   
+  purchase_order = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Order'].get_value();
+  purchase_invoice = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Invoice'].get_value();      
+  purchase_receipt = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Receipt'].get_value();      
+  project_name = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Project Name'].get_value();   
+  company = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Company'].get_value();      
+  fy = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Fiscal Year'].get_value();        
+     
+  // make query based on transaction
+  //-------------------------------------------------------------------------------------------
+
+  var cond = '';  
+  //for purchase order
+  if(based_on == 'Purchase Order'){
+
+    if(purchase_order) cond += ' AND `tabPurchase Order`.name = "'+purchase_order+'"';
+    if(project_name) cond += ' AND `tabPurchase Order`.project_name = "'+project_name+'"';    
+    if(company) cond += ' AND `tabPurchase Order`.company = "'+company+'"';
+    if(fy !='') cond += ' AND `tabPurchase Order`.fiscal_year = "'+fy+'"'; 
+
+    var q = 'SELECT DISTINCT `tabPurchase Order`.name, `tabPurchase Order`.status, `tabPurchase Order`.project_name, `tabPurchase Order`.supplier,`tabPurchase Order`.supplier_name,`tabPurchase Order`.per_received, `tabPurchase Order`.per_billed, `tabPurchase Order`.grand_total FROM `tabPurchase Order` WHERE IFNULL(`tabPurchase Order`.project_name,"") != ""'+cond+' AND `tabPurchase Order`.docstatus != 2';  
+    return q;
+  }  
+  
+  //for purchase receipt
+  else if(based_on == 'Purchase Receipt'){
+    if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
+    if(purchase_receipt) cond += ' t1.name = "'+purchase_receipt+'" AND ';
+    if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';    
+    if(company) cond += ' t1.company = "'+company+'" AND ';
+    if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND '; 
+ 
+  
+    var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.supplier, t1.supplier_name,t1.grand_total FROM `tabPurchase Receipt` t1,  `tabPurchase Receipt Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
+  
+    return q;  
+  }
+  //for purchase invoice
+  else if(based_on == 'Purchase Invoice'){
+    if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
+    if(purchase_receipt) cond += ' t2.purchase_receipt = "'+purchase_receipt+'" AND';
+    if(purchase_invoice) cond += ' t1.name = "'+purchase_invoice+'" AND';
+    if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';    
+    if(company) cond += ' t1.company = "'+company+'" AND ';
+    if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';     
+    
+    var q = 'SELECT DISTINCT t1.name , t1.credit_to , t1.project_name, t1.supplier, t1.supplier_name , t1.grand_total FROM `tabPayable Voucher` t1,  `tabPV Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
+  
+    return q;  
+  }  
+}
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
new file mode 100644
index 0000000..60a09d1
--- /dev/null
+++ b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
@@ -0,0 +1,23 @@
+based_on = filter_values.get('based_on')
+# make default columns
+#for r in res:
+col = []
+if based_on == 'Purchase Order':
+  col = [['Purchase Order ID','Link','Purchase Order'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['% Received','Data',''],['% Billed','Data',''],['Grand Total','Currency','']] 
+
+elif based_on == 'Purchase Invoice':
+  col = [['Purchase Receipt ID','Link','Payable Voucher'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
+
+elif based_on == 'Purchase Receipt':
+  col = [['Purchase Invoice ID','Link','Purchase Receipt'],['Credit To','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
+ 
+  
+for c in col:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  coloptions.append(c[2])
+  l = (len(c[0])*9) 
+  if l < 150 : col_width = '150px'
+  else:  col_width = '%spx'%(l)
+  colwidths.append(col_width)
+  col_idx[c[0]] = len(colnames)-1  
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
new file mode 100644
index 0000000..de306a6
--- /dev/null
+++ b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Projectwise Purchase Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Purchase Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-12 09:23:17',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_purchase_details',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_details/__init__.py b/projects/search_criteria/projectwise_sales_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_sales_details/__init__.py
diff --git a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
new file mode 100644
index 0000000..0d3a598
--- /dev/null
+++ b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
@@ -0,0 +1,96 @@
+report.customize_filters = function() {
+  //hide all filters
+  //------------------------------------------------
+  this.hide_all_filters();
+
+  //add filters
+  //------------------------------------------------
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1,parent:'Sales Order', single_select:1});
+
+  this.add_filter({fieldname:'sales_order', label:'Sales Order', fieldtype:'Link', options:'Sales Order', ignore : 1, parent:'Sales Order'});
+  this.add_filter({fieldname:'delivery_note', label:'Delivery Note', fieldtype:'Link', options:'Delivery Note',ignore : 1, parent:'Sales Order'});
+  this.add_filter({fieldname:'sales_invoice', label:'Sales Invoice',fieldtype:'Link', options:'Sales Invoice',ignore : 1, parent:'Sales Order'});
+
+  //unhide filters
+  //------------------------------------------------  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
+
+  //move filter field in first page
+  //------------------------------------------------  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Delivery Note'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Invoice'].df.in_first_page = 1;   
+
+  // default values
+  //------------------------------------------------  
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+
+}
+
+//hide select columns field
+//------------------------------------------------
+//this.mytabs.items['Select Columns'].hide();
+
+
+report.get_query = function() {
+
+  //get filter values
+  based_on = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Based On'].get_value();   
+  sales_order = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Order'].get_value();
+  delivery_note = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Delivery Note'].get_value();
+  sales_invoice = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Invoice'].get_value();      
+  project_name = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Project Name'].get_value();      
+  company = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Company'].get_value();      
+  fy = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Fiscal Year'].get_value();      
+
+  // make query based on transaction
+  //-------------------------------------------------------------------------------------------
+
+  var cond = '';  
+  //for sales order
+  if(based_on == 'Sales Order'){
+
+    if(sales_order) cond += ' AND `tabSales Order`.name = "'+sales_order+'"';
+    if(project_name) cond += ' AND `tabSales Order`.project_name = "'+project_name+'"';    
+    if(company) cond += ' AND `tabSales Order`.company = "'+company+'"';
+    if(fy) cond += ' AND `tabSales Order`.fiscal_year = "'+fy+'"'; 
+           
+    var q = 'SELECT DISTINCT `tabSales Order`.name, `tabSales Order`.order_type, `tabSales Order`.status, `tabSales Order`.project_name, `tabSales Order`.customer,`tabSales Order`.customer_name,`tabSales Order`.per_delivered, `tabSales Order`.per_billed, `tabSales Order`.grand_total FROM `tabSales Order` WHERE IFNULL(`tabSales Order`.project_name,"") != ""'+cond+' AND `tabSales Order`.docstatus != 2';  
+    return q;
+  }  
+  
+  //for delivery note
+  else if(based_on == 'Delivery Note'){
+    if(sales_order) cond += ' t1.name = t2.parent AND t2.prevdoc_docname = "'+sales_order+'" AND ';
+    if(delivery_note) cond += ' t1.name = "'+delivery_note+'" AND ';
+    if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';    
+    if(company) cond += ' t1.company = "'+company+'" AND ';
+    if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND '; 
+    
+    var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.customer, t1.customer_name, t1.per_billed, t1.per_installed, t1.grand_total FROM `tabDelivery Note` t1, `tabDelivery Note Detail` t2  WHERE '+cond+' IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2';
+
+    return q;
+  }
+  
+  //for sales invoice
+  else if(based_on == 'Sales Invoice'){
+    if(sales_order) cond += ' t2.sales_order = "'+sales_order+'" AND ';
+    if(delivery_note) cond += ' t2.delivery_note = "'+delivery_note+'" AND ';
+    if(sales_invoice) cond += ' t1.name = "'+sales_invoice+'" AND ';
+    if(project_name) cond += ' t1.project_name = "'+project_name+'" AND '; 
+    if(company) cond += ' t1.company = "'+company+'" AND ';
+    if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND '; 
+
+       
+    var q = 'SELECT DISTINCT t1.name , t1.debit_to , t1.project_name , t1.customer , t1.customer_name , t1.grand_total  FROM `tabReceivable Voucher` t1,  `tabRV Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
+
+    return q;  
+  }
+  
+}
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
new file mode 100644
index 0000000..0999ac4
--- /dev/null
+++ b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
@@ -0,0 +1,20 @@
+based_on = filter_values.get('based_on')
+
+cols=[]
+
+if based_on == 'Sales Order':  
+  cols = [['Sales Order No','Link','150px','Sales Order'], ['Order Type','Data','100px',''], ['Status','Data','100px',''], ['Project Name','Link','150px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Delivered','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
+
+elif based_on == 'Delivery Note':
+  cols = [['Delivery Note No','Link','150px','Delivery Note'], ['Status','Data','100px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Installed','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
+
+elif based_on == 'Sales Invoice':
+  cols = [['Sales Invoice No','Link','150px','Receivable Voucher'], ['Debit To','Data','150px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['Grand Total','Currency','150px','']]
+
+
+for c in cols:
+  colnames.append(c[0])
+  coltypes.append(c[1])
+  colwidths.append(c[2])
+  coloptions.append(c[3])
+  col_idx[c[0]] = len(colnames)-1
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
new file mode 100644
index 0000000..59bea25
--- /dev/null
+++ b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': '',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Projectwise Sales Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-12 09:21:11',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_sales_details',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_orders/__init__.py b/projects/search_criteria/projectwise_sales_orders/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/projectwise_sales_orders/__init__.py
diff --git a/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt b/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
new file mode 100644
index 0000000..18b2bd2
--- /dev/null
+++ b/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': "ifnull(`tabSales Order`.project_name ,'') != ''",
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Grand Total*',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Projectwise Sales Orders',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-08-30 14:21:59',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'projectwise_sales_orders',
+		'owner': 'harshada@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': None,
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': '',
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/projects/search_criteria/timesheet_report/__init__.py b/projects/search_criteria/timesheet_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/search_criteria/timesheet_report/__init__.py
diff --git a/projects/search_criteria/timesheet_report/timesheet_report.js b/projects/search_criteria/timesheet_report/timesheet_report.js
new file mode 100644
index 0000000..1cfe178
--- /dev/null
+++ b/projects/search_criteria/timesheet_report/timesheet_report.js
@@ -0,0 +1,7 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Timesheet Detail'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+  this.filter_fields_dict['Timesheet Detail'+FILTER_SEP +'Task Id'].df.in_first_page = 1;
+this.filter_fields_dict['Timesheet'+FILTER_SEP +'Timesheet by'].df.filter_hide = 1;
+}
+
+//this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/projects/search_criteria/timesheet_report/timesheet_report.txt b/projects/search_criteria/timesheet_report/timesheet_report.txt
new file mode 100644
index 0000000..d289c41
--- /dev/null
+++ b/projects/search_criteria/timesheet_report/timesheet_report.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Timesheet\x01ID,Timesheet\x01Timesheet Date,Timesheet\x01Timesheet by,Timesheet Detail\x01Project Name,Timesheet Detail\x01Task Id,Timesheet Detail\x01Task Name,Timesheet Detail\x01Actual Start Time,Timesheet Detail\x01Actual End Time,Timesheet Detail\x01Total Hours (Actual)',
+		'creation': '2010-12-14 10:33:09',
+		'criteria_name': 'Timesheet Report',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Timesheet Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Timesheet\x01Saved':1,'Timesheet\x01Submitted':1}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-11-05 20:44:03',
+		'modified_by': 'Administrator',
+		'module': 'Projects',
+		'name': 'timesheet_report',
+		'owner': 'ashwini@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Timesheet',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabTimesheet`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/replacecode.py b/replacecode.py
new file mode 100644
index 0000000..512d12e
--- /dev/null
+++ b/replacecode.py
@@ -0,0 +1,19 @@
+import os
+
+def replace_code(old, new):
+	txt = os.popen("""grep "%s" ./*/*/*/*.js""" % old).read().split()
+	txt = [t.split(':')[0] for t in txt]
+	txt = list(set(filter(lambda t: t.startswith('./'), txt)))
+	for t in txt:
+		if new:
+			code = open(t,'r').read().replace(old, new)
+			open(t, 'w').write(code)
+			print "Replaced for %s" % t
+		else:
+			print 'Found in %s' % t
+	
+if __name__=='__main__':
+	old = """\.button("""
+	new = ""
+	replace_code(old, new)
+			
\ No newline at end of file
diff --git a/roles/Module Def/Roles/Roles.txt b/roles/Module Def/Roles/Roles.txt
new file mode 100644
index 0000000..80f1992
--- /dev/null
+++ b/roles/Module Def/Roles/Roles.txt
@@ -0,0 +1,71 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:42:12',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module_desc': 'Roles',
+		'module_icon': 'users.png',
+		'module_label': 'Roles',
+		'module_name': 'Roles',
+		'module_page': None,
+		'module_seq': None,
+		'name': 'Roles',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:42:12',
+		'description': None,
+		'display_name': 'Role',
+		'doc_name': 'Role',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00208',
+		'owner': 'Administrator',
+		'parent': 'Roles',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': None,
+		'doc_name': 'Forms',
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': None,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003097',
+		'owner': 'Administrator',
+		'parent': 'Roles',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	}
+]
\ No newline at end of file
diff --git a/roles/Role/Accounts Manager/Accounts Manager.txt b/roles/Role/Accounts Manager/Accounts Manager.txt
new file mode 100644
index 0000000..b347d61
--- /dev/null
+++ b/roles/Role/Accounts Manager/Accounts Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Accounts Manager', 'parent': None, 'creation': '2009-03-19 14:57:46', 'modified': '2009-03-19 14:57:46', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Accounts User/Accounts User.txt b/roles/Role/Accounts User/Accounts User.txt
new file mode 100644
index 0000000..67994a3
--- /dev/null
+++ b/roles/Role/Accounts User/Accounts User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Guest', 'name': 'Accounts User', 'parent': None, 'creation': '2010-04-08 12:05:21', 'modified': '2010-04-08 12:05:21', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Administrator/Administrator.txt b/roles/Role/Administrator/Administrator.txt
new file mode 100644
index 0000000..283b1ff
--- /dev/null
+++ b/roles/Role/Administrator/Administrator.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Administrator', 'parent': '', 'creation': '2009-03-12 12:01:57', 'modified': '2009-03-12 12:01:57', 'module': 'Roles', 'doctype': 'Role', 'idx': 0, 'parenttype': '', 'role_name': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': ''}]
\ No newline at end of file
diff --git a/roles/Role/All/All.txt b/roles/Role/All/All.txt
new file mode 100644
index 0000000..1385f06
--- /dev/null
+++ b/roles/Role/All/All.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'All', 'parent': None, 'creation': '2009-03-12 14:40:07', 'modified': '2009-03-12 14:40:07', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'All', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Customer/Customer.txt b/roles/Role/Customer/Customer.txt
new file mode 100644
index 0000000..39d0d82
--- /dev/null
+++ b/roles/Role/Customer/Customer.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Customer', 'parent': None, 'creation': '2009-06-26 14:42:33', 'modified': '2009-06-26 14:42:33', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Customer', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Employee/Employee.txt b/roles/Role/Employee/Employee.txt
new file mode 100644
index 0000000..4b73c1a
--- /dev/null
+++ b/roles/Role/Employee/Employee.txt
@@ -0,0 +1,17 @@
+[
+	{
+		'creation': '2011-02-12 15:07:26',
+		'docstatus': 0,
+		'doctype': 'Role',
+		'idx': None,
+		'modified': '2011-02-14 14:05:55',
+		'modified_by': 'Administrator',
+		'module': 'Roles',
+		'name': 'Employee',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'role_name': 'Employee'
+	}
+]
\ No newline at end of file
diff --git a/roles/Role/Guest/Guest.txt b/roles/Role/Guest/Guest.txt
new file mode 100644
index 0000000..9438a28
--- /dev/null
+++ b/roles/Role/Guest/Guest.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Guest', 'parent': None, 'creation': '2009-10-03 16:59:07', 'modified': '2010-01-13 16:45:40', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Guest', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'DEF000069', 'parent': 'Guest', 'defvalue': '1', 'creation': '2009-10-03 16:59:07', 'defkey': 'hide_webnotes_toolbar', 'modified': '2010-01-13 16:45:40', 'doctype': 'DefaultValue', 'idx': 1, 'parenttype': 'Role', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'defaults'}, {'modified_by': 'Administrator', 'name': 'DEF000133', 'parent': 'Guest', 'defvalue': '1', 'creation': '2010-01-13 16:45:40', 'defkey': 'hide_sidebars', 'modified': '2010-01-13 16:45:40', 'doctype': 'DefaultValue', 'idx': 2, 'parenttype': 'Role', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'defaults'}]
\ No newline at end of file
diff --git a/roles/Role/HR Manager/HR Manager.txt b/roles/Role/HR Manager/HR Manager.txt
new file mode 100644
index 0000000..db31afc
--- /dev/null
+++ b/roles/Role/HR Manager/HR Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'HR Manager', 'parent': None, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 10:19:09', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'HR Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/HR User/HR User.txt b/roles/Role/HR User/HR User.txt
new file mode 100644
index 0000000..e7134c5
--- /dev/null
+++ b/roles/Role/HR User/HR User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'HR User', 'parent': None, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 10:18:55', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'HR User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Maintenance Manager/Maintenance Manager.txt b/roles/Role/Maintenance Manager/Maintenance Manager.txt
new file mode 100644
index 0000000..4047171
--- /dev/null
+++ b/roles/Role/Maintenance Manager/Maintenance Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Maintenance Manager', 'parent': None, 'creation': '2010-07-22 15:19:33', 'modified': '2010-07-22 15:19:33', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Maintenance Manager', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Maintenance User/Maintenance User.txt b/roles/Role/Maintenance User/Maintenance User.txt
new file mode 100644
index 0000000..6f7a5ab
--- /dev/null
+++ b/roles/Role/Maintenance User/Maintenance User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Maintenance User', 'parent': None, 'creation': '2010-07-22 15:19:19', 'modified': '2010-07-22 15:19:19', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Maintenance User', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Material Manager/Material Manager.txt b/roles/Role/Material Manager/Material Manager.txt
new file mode 100644
index 0000000..9e3ba18
--- /dev/null
+++ b/roles/Role/Material Manager/Material Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Material Manager', 'parent': None, 'creation': '2009-03-12 12:09:44', 'modified': '2009-03-19 14:56:51', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Material Master Manager/Material Master Manager.txt b/roles/Role/Material Master Manager/Material Master Manager.txt
new file mode 100644
index 0000000..5f4666d
--- /dev/null
+++ b/roles/Role/Material Master Manager/Material Master Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Material Master Manager', 'parent': None, 'creation': '2010-04-08 13:49:58', 'modified': '2010-04-08 13:49:58', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Material Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Material User/Material User.txt b/roles/Role/Material User/Material User.txt
new file mode 100644
index 0000000..320e280
--- /dev/null
+++ b/roles/Role/Material User/Material User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Material User', 'parent': None, 'creation': '2010-04-08 12:08:13', 'modified': '2010-04-08 12:08:13', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Partner/Partner.txt b/roles/Role/Partner/Partner.txt
new file mode 100644
index 0000000..037d9f7
--- /dev/null
+++ b/roles/Role/Partner/Partner.txt
@@ -0,0 +1 @@
+[{'modified_by': 'yogesh@webnotestech.com', 'name': 'Partner', 'parent': None, 'creation': '2009-07-13 11:29:39', 'modified': '2009-07-13 11:29:39', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Partner', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Production Manager/Production Manager.txt b/roles/Role/Production Manager/Production Manager.txt
new file mode 100644
index 0000000..b6cad1e
--- /dev/null
+++ b/roles/Role/Production Manager/Production Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Production Manager', 'parent': None, 'creation': '2009-09-23 16:35:34', 'modified': '2009-09-23 16:35:35', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Production Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Production User/Production User.txt b/roles/Role/Production User/Production User.txt
new file mode 100644
index 0000000..5d1e64e
--- /dev/null
+++ b/roles/Role/Production User/Production User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Production User', 'parent': None, 'creation': '2009-09-23 16:36:08', 'modified': '2009-09-23 16:36:08', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Production User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Projects User/Projects User.txt b/roles/Role/Projects User/Projects User.txt
new file mode 100644
index 0000000..53f1216
--- /dev/null
+++ b/roles/Role/Projects User/Projects User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Projects User', 'parent': None, 'creation': '2010-05-08 09:40:07', 'modified': '2010-05-08 09:40:07', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Projects User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'modified_by': 'yogesh@webnotestech.com', 'name': 'DEF000253', 'parent': 'Projects User', 'defvalue': 'Public', 'creation': '2010-11-19 10:47:59', 'defkey': 'customer_group', 'modified': '2010-11-19 10:47:59', 'doctype': 'DefaultValue', 'idx': None, 'parenttype': 'Role', 'owner': 'yogesh@webnotestech.com', 'docstatus': 0, 'parentfield': 'defaults'}]
\ No newline at end of file
diff --git a/roles/Role/Purchase Manager/Purchase Manager.txt b/roles/Role/Purchase Manager/Purchase Manager.txt
new file mode 100644
index 0000000..0372549
--- /dev/null
+++ b/roles/Role/Purchase Manager/Purchase Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Purchase Manager', 'parent': None, 'creation': '2010-04-08 12:07:53', 'modified': '2010-04-08 12:07:53', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Purchase Master Manager/Purchase Master Manager.txt b/roles/Role/Purchase Master Manager/Purchase Master Manager.txt
new file mode 100644
index 0000000..5d516ce
--- /dev/null
+++ b/roles/Role/Purchase Master Manager/Purchase Master Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Purchase Master Manager', 'parent': None, 'creation': '2010-04-08 13:50:20', 'modified': '2010-04-08 13:50:20', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Purchase User/Purchase User.txt b/roles/Role/Purchase User/Purchase User.txt
new file mode 100644
index 0000000..94cb25e
--- /dev/null
+++ b/roles/Role/Purchase User/Purchase User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Purchase User', 'parent': None, 'creation': '2010-04-08 12:08:01', 'modified': '2010-04-08 12:08:01', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Quality Manager/Quality Manager.txt b/roles/Role/Quality Manager/Quality Manager.txt
new file mode 100644
index 0000000..aacf400
--- /dev/null
+++ b/roles/Role/Quality Manager/Quality Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Quality Manager', 'parent': None, 'creation': '2010-05-04 13:12:27', 'modified': '2010-05-04 13:12:27', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Quality Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Sales Manager/Sales Manager.txt b/roles/Role/Sales Manager/Sales Manager.txt
new file mode 100644
index 0000000..5136e7c
--- /dev/null
+++ b/roles/Role/Sales Manager/Sales Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Sales Manager', 'parent': None, 'creation': '2010-04-08 12:07:36', 'modified': '2010-04-08 12:07:36', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Sales Master Manager/Sales Master Manager.txt b/roles/Role/Sales Master Manager/Sales Master Manager.txt
new file mode 100644
index 0000000..e973100
--- /dev/null
+++ b/roles/Role/Sales Master Manager/Sales Master Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Sales Master Manager', 'parent': None, 'creation': '2010-04-08 13:50:11', 'modified': '2010-04-08 13:50:11', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Sales User/Sales User.txt b/roles/Role/Sales User/Sales User.txt
new file mode 100644
index 0000000..ce9f91c
--- /dev/null
+++ b/roles/Role/Sales User/Sales User.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Sales User', 'parent': None, 'creation': '2010-04-08 12:07:44', 'modified': '2010-04-08 12:07:44', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Supplier/Supplier.txt b/roles/Role/Supplier/Supplier.txt
new file mode 100644
index 0000000..ffae145
--- /dev/null
+++ b/roles/Role/Supplier/Supplier.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Supplier', 'parent': None, 'creation': '2009-06-26 14:42:19', 'modified': '2009-06-26 14:42:19', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Supplier', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Support Manager/Support Manager.txt b/roles/Role/Support Manager/Support Manager.txt
new file mode 100644
index 0000000..c0b0b4e
--- /dev/null
+++ b/roles/Role/Support Manager/Support Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Support Manager', 'parent': None, 'creation': '2010-12-28 15:17:40', 'modified': '2010-12-28 15:17:40', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Support Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/Support Team/Support Team.txt b/roles/Role/Support Team/Support Team.txt
new file mode 100644
index 0000000..259b30a
--- /dev/null
+++ b/roles/Role/Support Team/Support Team.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'Support Team', 'parent': None, 'creation': '2010-12-28 15:19:11', 'modified': '2010-12-28 15:19:11', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Support Team', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/Role/System Manager/System Manager.txt b/roles/Role/System Manager/System Manager.txt
new file mode 100644
index 0000000..37c4fb5
--- /dev/null
+++ b/roles/Role/System Manager/System Manager.txt
@@ -0,0 +1 @@
+[{'modified_by': 'Administrator', 'name': 'System Manager', 'parent': None, 'creation': '2009-03-12 13:53:20', 'modified': '2009-07-07 17:00:24', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
\ No newline at end of file
diff --git a/roles/__init__.py b/roles/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/roles/__init__.py
diff --git a/roles/doctype/__init__.py b/roles/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/roles/doctype/__init__.py
diff --git a/roles/doctype/role/__init__.py b/roles/doctype/role/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/roles/doctype/role/__init__.py
diff --git a/roles/doctype/role/role.js b/roles/doctype/role/role.js
new file mode 100644
index 0000000..672f4ac
--- /dev/null
+++ b/roles/doctype/role/role.js
@@ -0,0 +1,6 @@
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def t1(self):
+    msgprint('role')
\ No newline at end of file
diff --git a/roles/doctype/role/role.py b/roles/doctype/role/role.py
new file mode 100644
index 0000000..4c9d7f5
--- /dev/null
+++ b/roles/doctype/role/role.py
@@ -0,0 +1,25 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def t1(self):
+    msgprint('role')
\ No newline at end of file
diff --git a/roles/doctype/role/role.txt b/roles/doctype/role/role.txt
new file mode 100644
index 0000000..f6e3f6c
--- /dev/null
+++ b/roles/doctype/role/role.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:01:55', 'search_fields': '', 'module': 'Roles', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': 0, 'allow_email': 0, 'dt_template': None, 'hide_heading': 0, 'issingle': 0, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 7, 'menu_index': None, 'docstatus': 0, 'allow_copy': 0, 'istable': 0, 'description': '', 'parent': '', 'server_code': '', 'allow_trash': None, 'allow_print': 0, 'autoname': 'field:role_name', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Guest', 'document_type': None, 'name': 'Role', 'idx': 0, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': '', 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': ''}, {'cancel': 0, 'amend': None, 'execute': 0, 'modified_by': 'Guest', 'name': 'PERM00014', 'parent': 'Role', 'read': 1, 'create': 1, 'creation': '2009-03-12 12:01:57', 'modified': '2010-04-08 12:05:09', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-17 12:09:47', 'doctype': 'DocField', 'oldfieldname': 'module', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Guest', 'label': 'Module', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Role', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01437', 'idx': 1, 'default': 'Roles', 'colour': None, 'modified': '2010-04-08 12:05:09', 'parenttype': 'DocType', 'fieldname': 'module', 'fieldtype': 'Select', 'options': 'link:Module Def', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:01:56', 'doctype': 'DocField', 'oldfieldname': 'role_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Guest', 'label': 'Role Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Role', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00194', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-08 12:05:09', 'parenttype': 'DocType', 'fieldname': 'role_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-03-12 12:01:56', 'doctype': 'DocField', 'oldfieldname': 'defaults', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 0, 'print_hide': None, 'modified_by': 'Guest', 'label': 'Defaults', 'width': '', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'Role', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL00195', 'idx': 3, 'default': '', 'colour': '', 'modified': '2010-04-08 12:05:09', 'parenttype': 'DocType', 'fieldname': 'defaults', 'fieldtype': 'Table', 'options': 'DefaultValue', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/Module Def/Settings/Settings.txt b/settings/Module Def/Settings/Settings.txt
new file mode 100644
index 0000000..38bcbb5
--- /dev/null
+++ b/settings/Module Def/Settings/Settings.txt
@@ -0,0 +1,218 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:45:39',
+		'disabled': 'Yes',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module_desc': None,
+		'module_icon': None,
+		'module_label': 'Settings',
+		'module_name': 'Settings',
+		'module_page': None,
+		'module_seq': None,
+		'name': 'Settings',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Country',
+		'doc_name': 'Country',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003098',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'State',
+		'doc_name': 'State',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003099',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Currency',
+		'doc_name': 'Currency',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003100',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Price List',
+		'doc_name': 'Price List',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003101',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Warehouse Type',
+		'doc_name': 'Warehouse Type',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003102',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Warehouse',
+		'doc_name': 'Warehouse',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003103',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'UOM',
+		'doc_name': 'UOM',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003104',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Terms and Conditions',
+		'doc_name': 'Terms And Conditions',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003105',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Terrioty',
+		'doc_name': 'Territoy',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 9,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003106',
+		'owner': 'Administrator',
+		'parent': 'Settings',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	}
+]
\ No newline at end of file
diff --git a/settings/__init__.py b/settings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/__init__.py
diff --git a/settings/doctype/__init__.py b/settings/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/__init__.py
diff --git a/settings/doctype/authorization_control/__init__.py b/settings/doctype/authorization_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/authorization_control/__init__.py
diff --git a/settings/doctype/authorization_control/authorization_control.js b/settings/doctype/authorization_control/authorization_control.js
new file mode 100644
index 0000000..fdec673
--- /dev/null
+++ b/settings/doctype/authorization_control/authorization_control.js
@@ -0,0 +1 @@
+// Settings
\ No newline at end of file
diff --git a/settings/doctype/authorization_control/authorization_control.py b/settings/doctype/authorization_control/authorization_control.py
new file mode 100644
index 0000000..9e8186b
--- /dev/null
+++ b/settings/doctype/authorization_control/authorization_control.py
@@ -0,0 +1,195 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+
+  # Get Names of all Approving Users and Roles
+  # -------------------------------------------
+  def get_appr_user_role(self, det, doctype_name, total, based_on, condition, item, company):
+    amt_list, appr_users, appr_roles = [], [], []
+    users, roles = '',''
+    if det:
+      for x in det:
+        amt_list.append(flt(x[0]))
+      max_amount = max(amt_list)
+      
+      app_dtl = sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = '%s' and (value = '%s' or value > '%s') and docstatus != 2 and based_on = '%s' and company = '%s' %s" % (doctype_name, flt(max_amount), total, based_on, company, condition))
+      if not app_dtl:
+        app_dtl = sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = '%s' and (value = '%s' or value > '%s') and docstatus != 2 and based_on = '%s' and ifnull(company,'') = '' %s" % (doctype_name, flt(max_amount), total, based_on, condition)) 
+      for d in app_dtl:
+        if(d[0]): appr_users.append(d[0])
+        if(d[1]): appr_roles.append(d[1])
+      
+      if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, session['user']):
+        msg, add_msg = '',''
+        if max_amount:
+          if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (get_defaults()['currency'], flt(max_amount))
+          elif based_on == 'Itemwise Discount': msg = "since Discount exceeds %s for Item Code : %s" % (cstr(max_amount)+'%', item)
+          elif based_on == 'Average Discount' or based_on == 'Customerwise Discount': msg = "since Discount exceeds %s" % (cstr(max_amount)+'%')
+        
+        if appr_users: add_msg = "Users : "+cstr(appr_users)
+        if appr_roles: add_msg = "Roles : "+cstr(appr_roles)
+        if appr_users and appr_roles: add_msg = "Users : "+cstr(appr_users)+" or "+"Roles : "+cstr(appr_roles)
+        msgprint("You do not have an authority to submit this %s %s. Please send for approval to %s" % (doctype_name, msg, add_msg))
+        raise Exception
+
+
+  # Check if authorization rule is set specific to user
+  # ----------------------------------------------------
+  def validate_auth_rule(self, doctype_name, total, based_on, cond, company, item = ''):
+    chk = 1
+    add_cond1,add_cond2  = '',''
+    if based_on == 'Itemwise Discount':
+      add_cond1 += " and master_name = '"+cstr(item)+"'"
+      itemwise_exists = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and company = '%s' and docstatus != 2 %s %s" % (doctype_name, total, based_on, company, cond, add_cond1))
+      if not itemwise_exists:
+        itemwise_exists = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and ifnull(company,'') = '' and docstatus != 2 %s %s" % (doctype_name, total, based_on, cond, add_cond1))
+      if itemwise_exists:
+        self.get_appr_user_role(itemwise_exists, doctype_name, total, based_on, cond+add_cond1, item,company)
+        chk = 0
+    if chk == 1:
+      if based_on == 'Itemwise Discount': add_cond2 += " and ifnull(master_name,'') = ''"
+      appr = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and company = '%s' and docstatus != 2 %s %s" % (doctype_name, total, based_on, company, cond, add_cond2))
+      if not appr:
+        appr = sql("select value from `tabAuthorization Rule` where transaction = '%s' and value <= '%s' and based_on = '%s' and ifnull(company,'') = '' and docstatus != 2 %s %s" % (doctype_name, total, based_on, cond, add_cond2))
+      self.get_appr_user_role(appr, doctype_name, total, based_on, cond+add_cond2, item, company)
+      
+      
+  # Bifurcate Authorization based on type
+  # --------------------------------------
+  def bifurcate_based_on_type(self, doctype_name, total, av_dis, based_on, doc_obj, val, company):
+    add_cond = ''
+    auth_value = av_dis
+    if val == 1: add_cond += " and system_user = '"+session['user']+"'"
+    elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(webnotes.user.get_roles())+"')")
+    else: add_cond += " and ifnull(system_user,'') = '' and ifnull(system_role,'') = ''"
+    if based_on == 'Grand Total': auth_value = total
+    elif based_on == 'Customerwise Discount':
+      if doc_obj:
+        if doc_obj.doc.doctype == 'Receivable Voucher': customer = doc_obj.doc.customer
+        else: customer = doc_obj.doc.customer_name
+        add_cond = " and master_name = '"+cstr(customer)+"'"
+    if based_on == 'Itemwise Discount':
+      if doc_obj:
+        for t in getlist(doc_obj.doclist, doc_obj.fname):
+          self.validate_auth_rule(doctype_name, t.adj_rate, based_on, add_cond, company,t.item_code )
+    else:
+      self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company)
+
+
+  # Check Approving Authority for transactions other than expense voucher and Appraisal
+  # -------------------------
+  def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''):
+    if doctype_name == 'Payable Voucher': doctype_name = 'Purchase Invoice'
+    elif doctype_name == 'Receivable Voucher': doctype_name = 'Sales Invoice'
+    av_dis = 0
+    if doc_obj:
+      ref_rate, basic_rate = 0, 0
+      for d in getlist(doc_obj.doclist, doc_obj.fname):
+        if d.base_ref_rate and d.basic_rate:
+          ref_rate += flt(d.base_ref_rate)
+          basic_rate += flt(d.basic_rate)
+      if ref_rate: av_dis = 100 - flt(basic_rate * 100 / ref_rate)
+
+    final_based_on = ['Grand Total','Average Discount','Customerwise Discount','Itemwise Discount']
+    # Individual User
+    # ================
+    # Check for authorization set for individual user
+   
+    based_on = [x[0] for x in sql("select distinct based_on from `tabAuthorization Rule` where transaction = '%s' and system_user = '%s' and (company = '%s' or ifnull(company,'')='') and docstatus != 2" %(doctype_name, session['user'], company))]
+        
+    for d in based_on:
+      self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 1, company)
+    
+    # Remove user specific rules from global authorization rules
+    for r in based_on:
+      if r in final_based_on and r != 'Itemwise Discount': final_based_on.remove(r)
+    
+    # Specific Role
+    # ===============
+    # Check for authorization set on particular roles
+    #based_on = [x[0] for x in sql("select based_on from `tabAuthorization Rule` where transaction = '%s' and system_role IN %s and based_on IN %s and docstatus != 2" %(doctype_name, "('"+"','".join(session['data']['profile']['roles'])+"')", "('"+"','".join(final_based_on)+"')"))]
+    based_on = [x[0] for x in sql("select based_on from `tabAuthorization Rule` where transaction = '%s' and system_role IN %s and based_on IN %s and (company = '%s' or ifnull(company,'')='') and docstatus != 2" %(doctype_name, "('"+"','".join(webnotes.user.get_roles())+"')", "('"+"','".join(final_based_on)+"')",company))]
+    for d in based_on:
+      self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 2, company)
+    
+    # Remove role specific rules from global authorization rules
+    for r in based_on:
+      if r in final_based_on and r != 'Itemwise Discount': final_based_on.remove(r)
+      
+    # Global Rule
+    # =============
+    # Check for global authorization
+    for g in final_based_on:
+      self.bifurcate_based_on_type(doctype_name, total, av_dis, g, doc_obj, 0, company)
+  
+  #========================================================================================================================
+  # payroll related check
+  def get_value_based_rule(self,doctype_name,employee,total_claimed_amount,company):
+    val_lst =[]
+    val = sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and company = %s and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount,company))
+    if not val:
+      val = sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and ifnull(company,'') = '' and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount))
+
+    
+    if val:
+      val_lst = [y[0] for y in val]
+    else:
+      val_lst.append(0)
+    
+    max_val = max(val_lst)
+    rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and company = %s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,company,employee,employee,flt(max_val)), as_dict=1)
+    if not rule:
+      rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and ifnull(company,'') = '' and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,employee,employee,flt(max_val)), as_dict=1)
+
+    return rule
+  
+  #---------------------------------------------------------------------------------------------------------------------
+  # related to payroll module only
+  def get_approver_name(self, doctype_name, total, doc_obj=''):
+    app_user=[]
+    app_specific_user =[]
+    rule ={}
+    
+    if doc_obj:
+      if doctype_name == 'Expense Voucher':
+        rule = self.get_value_based_rule(doctype_name,doc_obj.doc.employee,doc_obj.doc.total_claimed_amount, doc_obj.doc.company)
+      elif doctype_name == 'Appraisal':
+        rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and company = %s and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee, doc_obj.doc.company),as_dict=1)        
+        if not rule:
+          rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(company,'') = '' and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee),as_dict=1)        
+      
+      if rule:
+        for m in rule:
+          if m['to_emp'] or m['to_designation']:
+            if m['approving_user']:
+              app_specific_user.append(m['approving_user'])
+            elif m['approving_role']:
+              user_lst = [z[0] for z in sql("select distinct t1.name from `tabProfile` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])]
+              for x in user_lst:
+                if not x in app_user:
+                  app_user.append(x)
+      
+      if len(app_specific_user) >0:
+        return app_specific_user
+      else:
+        return app_user
diff --git a/settings/doctype/authorization_control/authorization_control.txt b/settings/doctype/authorization_control/authorization_control.txt
new file mode 100644
index 0000000..3c81797
--- /dev/null
+++ b/settings/doctype/authorization_control/authorization_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-06-15 13:11:09', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 255, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Authorization Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-08 14:33:07', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/settings/doctype/authorization_rule/__init__.py b/settings/doctype/authorization_rule/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/authorization_rule/__init__.py
diff --git a/settings/doctype/authorization_rule/authorization_rule.js b/settings/doctype/authorization_rule/authorization_rule.js
new file mode 100644
index 0000000..27d97bc
--- /dev/null
+++ b/settings/doctype/authorization_rule/authorization_rule.js
@@ -0,0 +1,109 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+// Settings Module
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+
+  if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable') hide_field('master_name');
+  else  unhide_field('master_name');
+  
+  if(doc.based_on == 'Not Applicable') hide_field('value');
+  else unhide_field('value');
+  
+  if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
+    hide_field(['master_name','system_role', 'system_user']);
+    unhide_field(['to_emp','to_designation']);
+    if(doc.transaction == 'Appraisal') hide_field('value');
+    else unhide_field('value');
+  }
+  else {
+    unhide_field(['master_name','system_role', 'system_user','value']);
+    hide_field(['to_emp','to_designation']);
+  }
+}
+
+cur_frm.cscript.based_on = function(doc){
+  if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable'){
+    doc.master_name = '';
+    refresh_field('master_name');
+    hide_field('master_name');
+  }
+  else{
+    unhide_field('master_name');
+  }
+  
+  if(doc.based_on == 'Not Applicable') {
+      doc.value =0;
+      refresh_field('value');
+      hide_field('value');
+    }
+    else unhide_field('value');
+}
+
+cur_frm.cscript.transaction = function(doc,cdt,cdn){
+  if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
+    doc.master_name = doc.system_role = doc.system_user = '';
+    refresh_many(['master_name','system_role', 'system_user']);
+    hide_field(['master_name','system_role', 'system_user']);
+    unhide_field(['to_emp','to_designation']);
+    if(doc.transaction == 'Appraisal') {
+      doc.value =0;
+      refresh_many('value');
+      hide_field('value');
+    }
+    else unhide_field('value');
+  }
+  else {
+    unhide_field(['master_name','system_role', 'system_user','value']);
+    hide_field(['to_emp','to_designation']);
+  }
+  
+  if(doc.transaction == 'Expense Voucher') doc.based_on = 'Total Claimed Amount';
+  if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable';
+}
+
+
+// System User Trigger
+// -------------------
+cur_frm.fields_dict['system_user'].get_query = function(doc) {
+  return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
+}
+
+
+// System Role Trigger
+// -----------------------
+cur_frm.fields_dict['system_role'].get_query = function(doc) {
+  return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50'
+}
+
+
+// Approving User Trigger
+// -----------------------
+cur_frm.fields_dict['approving_user'].get_query = function(doc) {
+  return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
+}
+
+
+// Approving Role Trigger
+// -----------------------
+cur_frm.fields_dict['approving_role'].get_query = function(doc) {
+  return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50'
+}
+
+
+// Master Name Trigger
+// --------------------
+cur_frm.fields_dict['master_name'].get_query = function(doc){
+  if(doc.based_on == 'Customerwise Discount')
+    return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50';
+  else if(doc.based_on == 'Itemwise Discount')
+    return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50';
+  else
+    return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50';
+}
\ No newline at end of file
diff --git a/settings/doctype/authorization_rule/authorization_rule.py b/settings/doctype/authorization_rule/authorization_rule.py
new file mode 100644
index 0000000..60e1d45
--- /dev/null
+++ b/settings/doctype/authorization_rule/authorization_rule.py
@@ -0,0 +1,91 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+
+  # Duplicate Entry
+  # ----------------
+  def check_duplicate_entry(self):
+    exists = sql("select name, docstatus from `tabAuthorization Rule` where transaction = %s and based_on = %s and system_user = %s and system_role = %s and approving_user = %s and approving_role = %s and to_emp =%s and to_designation=%s and name != %s", (self.doc.transaction, self.doc.based_on, cstr(self.doc.system_user), cstr(self.doc.system_role), cstr(self.doc.approving_user), cstr(self.doc.approving_role), cstr(self.doc.to_emp), cstr(self.doc.to_designation), self.doc.name))
+    auth_exists = exists and exists[0][0] or ''
+    if auth_exists:
+      if cint(exists[0][1]) == 2:
+        msgprint("Duplicate Entry. Please remove from trash Authorization Rule : %s." %(auth_exists))
+        raise Exception
+      else:
+        msgprint("Duplicate Entry. Please check Authorization Rule : %s." % (auth_exists))
+        raise Exception
+
+
+  # Validate Master Name
+  # ---------------------
+  def validate_master_name(self):
+    if self.doc.based_on == 'Customerwise Discount' and not sql("select name from tabCustomer where name = '%s' and docstatus != 2" % (self.doc.master_name)):
+      msgprint("Please select valid Customer Name for Customerwise Discount.")
+      raise Exception
+    elif self.doc.based_on == 'Itemwise Discount' and not sql("select name from tabItem where name = '%s' and docstatus != 2" % (self.doc.master_name)):
+      msgprint("Please select valid Item Name for Itemwise Discount.")
+      raise Exception
+    elif (self.doc.based_on == 'Grand Total' or self.doc.based_on == 'Average Discount') and self.doc.master_name:
+      msgprint("Please remove Customer / Item Name for %s." % (self.doc.based_on))
+      raise Exception
+
+
+  # Validate Rule
+  # --------------
+  def validate_rule(self):
+    if not self.doc.transaction == 'Expense Voucher' and not self.doc.transaction == 'Appraisal':
+      if not self.doc.approving_role and not self.doc.approving_user:
+        msgprint("Please enter Approving Role or Approving User")
+        raise Exception
+      elif self.doc.system_user and self.doc.system_user == self.doc.approving_user:
+        msgprint("Approving User cannot be same as user the rule is Applicable To (User).")
+        raise Exception
+      elif self.doc.system_role and self.doc.system_role == self.doc.approving_role:
+        msgprint("Approving Role cannot be same as user the rule is Applicable To (Role).")
+        raise Exception
+      elif self.doc.system_user and self.doc.approving_role and has_common([self.doc.approving_role],[x[0] for x in sql("select role from `tabUserRole` where parent = '%s'" % (self.doc.system_user))]):
+        msgprint("System User : %s is assigned role : %s. So rule does not make sense." % (self.doc.system_user,self.doc.approving_role))
+        raise Exception
+      elif (self.doc.transaction == 'Purchase Order' or self.doc.transaction == 'Purchase Receipt' or self.doc.transaction == 'Purchase Invoice' or self.doc.transaction == 'Stock Entry') and (self.doc.based_on == 'Average Discount' or self.doc.based_on == 'Customerwise Discount' or self.doc.based_on == 'Itemwise Discount'):
+        msgprint("You cannot set authorization on basis of Discount for %s." % (self.doc.transaction))
+        raise Exception
+      elif self.doc.based_on == 'Average Discount' and flt(self.doc.value) > 100.00:
+        msgprint("Discount cannot given for more than 100 %s." % ('%'))
+        raise Exception
+      elif self.doc.based_on == 'Customerwise Discount' and not self.doc.master_name:
+        msgprint("Please enter Customer Name for 'Customerwise Discount'")
+        raise Exception
+    else:
+      if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
+        msgprint("Based on is 'Not Applicable' while setting authorization rule for 'Appraisal'")
+        raise Exception
+      if self.doc.transaction == 'Expense Voucher' and self.doc.based_on != 'Total Claimed Amount':
+        msgprint("Authorization rule should be based on 'Total Calimed Amount' while setting authorization rule for 'Expense Voucher'")
+        raise Exception
+
+
+  def validate(self):
+    self.check_duplicate_entry()
+    self.validate_rule()
+    self.validate_master_name()
+    if not self.doc.value: self.doc.value = flt(0)
\ No newline at end of file
diff --git a/settings/doctype/authorization_rule/authorization_rule.txt b/settings/doctype/authorization_rule/authorization_rule.txt
new file mode 100644
index 0000000..ca0d69f
--- /dev/null
+++ b/settings/doctype/authorization_rule/authorization_rule.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-09 12:53:05', 'search_fields': 'transaction,based_on,value,system_user,system_role,approving_user,approving_role', 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 84, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'AR.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': 'Master', 'name': 'Authorization Rule', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01034', 'parent': 'Authorization Rule', 'read': 1, 'create': 1, 'creation': '2010-06-09 12:53:05', 'modified': '2010-12-09 17:09:12', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01049', 'parent': 'Authorization Rule', 'read': 1, 'create': 1, 'creation': '2010-06-25 13:44:28', 'modified': '2010-12-09 17:09:12', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-11-08 10:33:52', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'harshada@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06393', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-09 12:53:05', 'doctype': 'DocField', 'oldfieldname': 'transaction', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Transaction', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05301', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'transaction', 'fieldtype': 'Select', 'options': '\nDelivery Note\nPurchase Invoice\nPurchase Order\nPurchase Receipt\nQuotation\nSales Invoice\nSales Order\nStock Entry\nExpense Voucher\nAppraisal', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-10 16:10:36', 'doctype': 'DocField', 'oldfieldname': 'based_on', 'owner': 'saumil@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Based On', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05326', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'based_on', 'fieldtype': 'Select', 'options': '\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nTotal Claimed Amount\nNot Applicable', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-09 12:53:05', 'doctype': 'DocField', 'oldfieldname': 'value', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Above Value', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05305', 'idx': 4, 'default': '0.00', 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'value', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-11 10:07:55', 'doctype': 'DocField', 'oldfieldname': 'master_name', 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer / Item Name', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05329', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'master_name', 'fieldtype': 'Link', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-07-05 09:14:31', 'doctype': 'DocField', 'oldfieldname': 'system_role', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Applicable To (Role)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05516', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'system_role', 'fieldtype': 'Link', 'options': 'Role', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-09 12:53:05', 'doctype': 'DocField', 'oldfieldname': 'system_user', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Applicable To (User)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05302', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'system_user', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-26 11:26:50', 'doctype': 'DocField', 'oldfieldname': 'to_emp', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Applicable To (Employee)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'This will be used for setting rule in HR module', 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06040', 'idx': 8, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'to_emp', 'fieldtype': 'Link', 'options': 'Employee', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-26 11:26:50', 'doctype': 'DocField', 'oldfieldname': 'to_designation', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Applicable To (Designation)', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'This will be used for setting rule in HR module', 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06041', 'idx': 9, 'default': None, 'colour': 'White:FFF', 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'to_designation', 'fieldtype': 'Link', 'options': 'Designation', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-09 12:53:05', 'doctype': 'DocField', 'oldfieldname': 'approving_role', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Approving Role', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05303', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'approving_role', 'fieldtype': 'Link', 'options': 'Role', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-09 12:53:05', 'doctype': 'DocField', 'oldfieldname': 'approving_user', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Approving User', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05304', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'approving_user', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-06-15 12:40:51', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Authorization Rule', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05344', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-12-09 17:09:12', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/email_settings/__init__.py b/settings/doctype/email_settings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/email_settings/__init__.py
diff --git a/settings/doctype/email_settings/email_settings.js b/settings/doctype/email_settings/email_settings.js
new file mode 100644
index 0000000..cbc6a44
--- /dev/null
+++ b/settings/doctype/email_settings/email_settings.js
@@ -0,0 +1,5 @@
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+  if(!doc.outgoing_mail_server || !doc.mail_login || !doc.mail_password || !doc.auto_email_id || !doc.mail_port || !doc.use_ssl){
+    get_server_fields('set_vals','','',doc, cdt, cdn, 1);
+  }
+}
\ No newline at end of file
diff --git a/settings/doctype/email_settings/email_settings.py b/settings/doctype/email_settings/email_settings.py
new file mode 100644
index 0000000..12c2464
--- /dev/null
+++ b/settings/doctype/email_settings/email_settings.py
@@ -0,0 +1,44 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist):
+    self.doc,self.doclist = doc,doclist
+
+  def set_vals(self):
+    res = sql("select field, value from `tabSingles` where doctype = 'Control Panel' and field IN ('outgoing_mail_server','mail_login','mail_password','auto_email_id','mail_port','use_ssl')")
+    ret = {}
+    for r in res:
+      ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
+        
+    return str(ret)
+
+  def on_update(self):
+    if self.doc.outgoing_mail_server:
+      sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'outgoing_mail_server'"%self.doc.outgoing_mail_server)
+    if self.doc.mail_login:
+      sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_login'"%self.doc.mail_login)
+    if self.doc.mail_password:
+      sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_password'"%self.doc.mail_password)
+    if self.doc.auto_email_id:
+      sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'auto_email_id'"%self.doc.auto_email_id)
+    if self.doc.mail_port:
+      sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'mail_port'"%self.doc.mail_port)
+    if self.doc.use_ssl:
+      sql("update `tabSingles` set value ='%s' where doctype = 'Control Panel' and field = 'use_ssl'"%self.doc.use_ssl)
\ No newline at end of file
diff --git a/settings/doctype/email_settings/email_settings.txt b/settings/doctype/email_settings/email_settings.txt
new file mode 100644
index 0000000..70ef8d9
--- /dev/null
+++ b/settings/doctype/email_settings/email_settings.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-07-19 15:18:50', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': 1, 'in_create': 1, 'read_only': None, 'allow_email': 1, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 32, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Email Settings', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-26 10:38:37', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01073', 'parent': 'Email Settings', 'read': 1, 'create': 1, 'creation': '2010-07-19 15:18:50', 'modified': '2010-10-26 10:38:37', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01114', 'parent': 'Email Settings', 'read': 1, 'create': 1, 'creation': '2010-08-07 18:57:34', 'modified': '2010-10-26 10:38:37', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-19 15:18:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Outgoing Mail Server', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Email Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05646', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-26 10:38:37', 'parenttype': 'DocType', 'fieldname': 'outgoing_mail_server', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-25 12:38:58', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Mail Port', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Email Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06001', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-26 10:38:37', 'parenttype': 'DocType', 'fieldname': 'mail_port', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-25 12:38:58', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Use SSL', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Email Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06000', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-26 10:38:37', 'parenttype': 'DocType', 'fieldname': 'use_ssl', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-19 15:18:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Login Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Email Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05647', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-26 10:38:37', 'parenttype': 'DocType', 'fieldname': 'mail_login', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-19 15:18:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Mail Password', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Email Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05648', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-26 10:38:37', 'parenttype': 'DocType', 'fieldname': 'mail_password', 'fieldtype': 'Password', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-19 15:18:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Auto Email Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Email Settings', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05649', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-26 10:38:37', 'parenttype': 'DocType', 'fieldname': 'auto_email_id', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/naming_series/__init__.py b/settings/doctype/naming_series/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/naming_series/__init__.py
diff --git a/settings/doctype/naming_series/naming_series.js b/settings/doctype/naming_series/naming_series.js
new file mode 100644
index 0000000..a0216e2
--- /dev/null
+++ b/settings/doctype/naming_series/naming_series.js
@@ -0,0 +1,19 @@
+// Settings
+cur_frm.cscript.onload = function(doc, cdt, cdn){
+  var callback = function(r, rt){
+    set_field_options('select_doc_for_series', r.message);
+  }
+  $c_obj([doc],'get_transactions','',callback);
+  
+  // add page head
+  var ph = new PageHeader(cur_frm.fields_dict['Head HTML'].wrapper, 'Setup Series', 'Set prefix for numbering series on your transactions');
+}
+
+cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) {
+  var callback = function(r, rt){
+    locals[cdt][cdn].set_options = r.message;
+    refresh_field('set_options');
+  }
+
+  $c_obj([doc],'get_options','',callback)
+}
\ No newline at end of file
diff --git a/settings/doctype/naming_series/naming_series.py b/settings/doctype/naming_series/naming_series.py
new file mode 100644
index 0000000..c2594e3
--- /dev/null
+++ b/settings/doctype/naming_series/naming_series.py
@@ -0,0 +1,90 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cint, cstr
+from webnotes import msgprint, errprint
+
+sql = webnotes.conn.sql
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def get_transactions(self):
+		return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.module !='Recycle Bin' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")])
+	
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def get_options_for(self, doctype):
+		sr = sql("select options from `tabDocField` where parent='%s' and fieldname='naming_series'" % (doctype))
+		if sr and sr[0][0]:
+			return sr[0][0].split("\n")
+		else:
+			return []
+	
+	def scrub_options_list(self, ol):
+		options = filter(lambda x: x, [cstr(n.upper()).strip() for n in ol])
+		return options
+	
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def set_series_for(self, doctype, ol):
+		options = self.scrub_options_list(ol)
+		
+		# validate names
+		[self.validate_series_name(i) for i in options]
+		
+		if self.doc.user_must_always_select:
+			options = [''] + options
+			default = ''
+		else:
+			default = options[0]
+		
+		# update
+		sql("update tabDocField set `options`=%s, `default`=%s where parent=%s and fieldname='naming_series'", ("\n".join(options), default, doctype))
+		self.doc.set_options = "\n".join(options)
+	
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def update_series(self):
+			self.check_duplicate()
+			self.set_series_for(self.doc.select_doc_for_series, self.doc.set_options.split("\n"))
+			msgprint('Series Updated')			
+			
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def check_duplicate(self):
+		from core.doctype.doctype.doctype import DocType
+		dt = DocType()
+	
+		sr = sql("select options, parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series)
+		options = self.scrub_options_list(self.doc.set_options.split("\n"))
+		for series in options:
+			dt.validate_series(series, self.doc.select_doc_for_series)
+			for i in sr:
+				if i[0]:
+					if series in i[0].split("\n"):
+						msgprint("Oops! Series name %s is already in use in %s. Please select a new one" % (series, i[1]), raise_exception=1)
+			
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def validate_series_name(self, n):
+		import re
+		if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n):
+			msgprint('Special Characters except "-" and "/" not allowed in naming series')
+			raise Exception
+		
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def get_options(self, arg=''):
+		so = sql("select options from `tabDocField` where parent=%s and fieldname='naming_series'", self.doc.select_doc_for_series)
+		if so:
+			return so[0][0] or ''
+
+
+	#-----------------------------------------------------------------------------------------------------------------------------------
+	def update_series_start(self):
+		ser_det = sql("select name from `tabSeries` where name = %s", self.doc.prefix)
+		if ser_det:
+			sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.starts_from-1,self.doc.prefix))
+		else:
+			sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1))
+		msgprint("Series Updated Successfully")
diff --git a/settings/doctype/naming_series/naming_series.txt b/settings/doctype/naming_series/naming_series.txt
new file mode 100644
index 0000000..1c33da3
--- /dev/null
+++ b/settings/doctype/naming_series/naming_series.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-09-23 18:20:39', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': 1, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 76, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Naming Series', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-26 18:45:26', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00441', 'parent': 'Naming Series', 'read': 1, 'create': 1, 'creation': '2009-09-23 18:24:22', 'modified': '2010-11-26 18:45:26', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00442', 'parent': 'Naming Series', 'read': 1, 'create': 1, 'creation': '2009-09-23 18:24:22', 'modified': '2010-11-26 18:45:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00443', 'parent': 'Naming Series', 'read': 1, 'create': None, 'creation': '2009-09-23 18:24:22', 'modified': '2010-11-26 18:45:26', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 3, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00444', 'parent': 'Naming Series', 'read': 1, 'create': 0, 'creation': '2009-09-23 18:24:22', 'modified': '2010-11-26 18:45:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01170', 'parent': 'Naming Series', 'read': 1, 'create': None, 'creation': '2010-09-07 18:16:46', 'modified': '2010-11-26 18:45:26', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'Guest', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-16 12:09:36', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Head HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04661', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-26 18:45:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': '', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06465', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-17 10:30:43', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Setup Series', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Set prefix for numbering series on your transactions', 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06412', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-23 18:20:39', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Select Transaction', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03066', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': 'select_doc_for_series', 'fieldtype': 'Select', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-26 11:55:21', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Help HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06350', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<div style="padding: 8px; background-color: #FFD; margin: 8px 0px;">\nWrite the list of series options in the list below. Each on a new line<br>\nAllowed special characters are "/" and "-"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-25 11:14:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Set Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06332', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': 'set_options', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-27 14:03:36', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'User must always select', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Check this if you want to force the user to select a series before saving. There will be no default if you check this.', 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06371', 'idx': 7, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': 'user_must_always_select', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-23 18:20:39', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03069', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_series', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-17 10:26:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update Series', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Set starting number for series of your transactions', 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06406', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-17 10:26:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Prefix', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06407', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': 'prefix', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-17 10:26:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Starts From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06408', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': 'starts_from', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-11-17 10:26:14', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'saumil@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Update Series Start', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06409', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-11-26 18:45:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_series_start', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/notification_control/__init__.py b/settings/doctype/notification_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/notification_control/__init__.py
diff --git a/settings/doctype/notification_control/notification_control.js b/settings/doctype/notification_control/notification_control.js
new file mode 100644
index 0000000..f18e38d
--- /dev/null
+++ b/settings/doctype/notification_control/notification_control.js
@@ -0,0 +1,10 @@
+cur_frm.cscript.select_transaction = function(doc, dt, dn) {
+  if(doc.select_transaction) {
+    var callback = function(r,rt) {
+      var doc = locals[dt][dn];
+      doc.custom_message = r.message;
+      refresh_field('custom_message');
+    }
+    $c_obj('Notification Control','get_message',doc.select_transaction, callback)
+  }
+}
\ No newline at end of file
diff --git a/settings/doctype/notification_control/notification_control.py b/settings/doctype/notification_control/notification_control.py
new file mode 100644
index 0000000..70d863d
--- /dev/null
+++ b/settings/doctype/notification_control/notification_control.py
@@ -0,0 +1,104 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import validate_email_add, cint, cstr
+from webnotes.model.doc import Document
+from webnotes import msgprint
+
+sql = webnotes.conn.sql
+	
+# -----------------------------------------------------------------------------------------
+
+def get_formatted_message(head, body):
+	if head:
+		head = '<div style="font-size: 19px; margin-bottom: 13px; color: #333; font-family: Arial;">%s</div>' % head
+	else:
+		head = ''
+
+	return '''
+	<div style="margin: 13px">
+	%(head)s
+	<p style="font-size: 14px; line-height: 1.7em; color: #555; font-family: Arial;">
+	%(body)s
+	</p>
+	</div>
+	''' % {'head':head, 'body':body.replace('\n', '<br>')}
+
+# Notification control
+class DocType:
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d,dl
+
+	# get message to load in custom text
+	# ----------------------------------
+	def get_message(self, arg):
+		fn = arg.lower().replace(' ', '_') + '_message'
+		v = sql("select value from tabSingles where field=%s and doctype=%s", (fn, 'Notification Control'))
+		return v and v[0][0] or ''
+
+	# set custom text
+	# ---------------
+	def set_message(self, arg=''):
+		fn = self.doc.select_transaction.lower().replace(' ', '_') + '_message'
+		webnotes.conn.set(self.doc, fn, self.doc.custom_message)
+		msgprint("Custom Message for %s updated!" % self.doc.select_transaction)
+
+	# notify contact
+	# --------------
+	def notify_contact(self, key, dt, dn, contact_email, contact_nm):
+
+		if contact_email:
+			dt_small = dt.replace(' ','_').lower()
+
+			if cint(self.doc.fields.get(dt_small)):
+				self.send_notification(key, dt, dn, contact_email, contact_nm)
+			
+	# send notification
+	def send_notification(self, key, dt, dn, contact_email, contact_nm):
+		import webnotes.utils.encrypt
+		import os
+		from webnotes.utils.email_lib import sendmail
+		
+		cp = Document('Control Panel', 'Control Panel')
+		
+		banner = cp.client_name
+
+		sender_nm = sql("select concat_ws(' ', first_name, last_name) from tabProfile where name = %s", webnotes.session['user'])[0][0] or ''
+		
+		if contact_nm:
+			contact_nm = ' ' + contact_nm
+		else:
+			contact_nm = ''
+		
+		msg = '''
+		<div style="margin-bottom: 13px;">%(company_banner)s</div>
+		Hi%(contact)s,
+
+		%(message)s
+
+		<a href="http://%(domain)s/v170/index.cgi?page=Form/%(dt)s/%(dn)s&ac_name=%(account)s&akey=%(akey)s">Click here to see the document.</a></p>
+
+		Thanks,
+		%(sent_by)s
+		%(company_name)s
+		''' % {
+			'company_banner': banner, 
+			'contact': contact_nm, 
+			'message': self.doc.fields[key.lower().replace(' ','_')+'_message'],
+			'sent_by': sender_nm, 
+			'company_name':cp.company_name,
+			'dt': dt.replace(' ', '%20'),
+			'dn': dn.replace('/', '%2F'),
+			'domain': os.environ.get('HTTP_HOST'),
+			'account': cp.account_id,
+			'akey': webnotes.utils.encrypt.encrypt(dn)
+		}
+
+		if not validate_email_add(webnotes.session['user']):
+			sender = "automail@webnotestech.com"
+		else:
+			sender = webnotes.session['user']
+		
+		rec_lst = [contact_email, sender]
+		subject = cp.company_name + ' - ' + dt
+		sendmail(rec_lst, sender, get_formatted_message(None, msg), subject)
diff --git a/settings/doctype/notification_control/notification_control.txt b/settings/doctype/notification_control/notification_control.txt
new file mode 100644
index 0000000..421d2fc
--- /dev/null
+++ b/settings/doctype/notification_control/notification_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-20 16:36:59', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': 1, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 117, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Notification Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-14 10:48:02', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01123', 'parent': 'Notification Control', 'read': 1, 'create': 1, 'creation': '2010-08-20 16:38:27', 'modified': '2010-10-14 10:48:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM01124', 'parent': 'Notification Control', 'read': 1, 'create': 1, 'creation': '2010-08-20 16:38:27', 'modified': '2010-10-14 10:48:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:36:59', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Send Auto-notification for', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05954', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:51:31', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Sales', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05961', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:36:59', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Enquiry', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05955', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'enquiry', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:36:59', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Quotation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05956', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'quotation', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:36:59', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Sales Order', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05957', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'sales_order', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:36:59', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Delivery Note', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05959', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'delivery_note', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 18:14:05', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Sales Invoice', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05967', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'receivable_voucher', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:51:31', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Purchase', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05962', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:51:31', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Purchase Order', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05963', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'purchase_order', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:51:31', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Purchase Receipt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05964', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'purchase_receipt', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-08-20 16:51:31', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Purchase Invoice', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05965', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'payable_voucher', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-14 08:16:24', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Expense Voucher', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06303', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'expense_voucher', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Customize the Notification', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06089', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Select Transaction', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06090', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'select_transaction', 'fieldtype': 'Select', 'options': '\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPayment Received\nPurchase Order\nPurchase Receipt\nPayment Sent\nExpense Voucher Approved\nExpense Voucher Rejected', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Custom Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06091', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'custom_message', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06092', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'set_message', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Quotation Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06093', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'quotation_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Sales Order Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06094', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'sales_order_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Delivery Note Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06095', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'delivery_note_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Sales Invoice Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06096', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'sales_invoice_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Payment Received Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06097', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'payment_received_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Purchase Order Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06098', 'idx': 22, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'purchase_order_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Purchase Receipt Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06099', 'idx': 23, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'purchase_receipt_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-09-02 11:25:33', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'rushabh@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Payment Sent Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06100', 'idx': 24, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'payment_sent_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-14 08:16:24', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Expense Voucher Approved Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06302', 'idx': 25, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'expense_voucher_approved_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-10-14 08:16:24', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Expense Voucher Rejected Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Notification Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06304', 'idx': 26, 'default': None, 'colour': None, 'modified': '2010-10-14 10:48:02', 'parenttype': 'DocType', 'fieldname': 'expense_voucher_rejected_message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/permission_control/__init__.py b/settings/doctype/permission_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/permission_control/__init__.py
diff --git a/settings/doctype/permission_control/permission_control.py b/settings/doctype/permission_control/permission_control.py
new file mode 100644
index 0000000..a24c756
--- /dev/null
+++ b/settings/doctype/permission_control/permission_control.py
@@ -0,0 +1,186 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist):
+		self.doc = doc
+		self.doclist = doclist
+		
+	
+	# Get Roles and Modules on loading Permission Engine
+	# ----------------------------------------------------- 
+	def get_doctype_list(self):
+		ret = sql("""SELECT `name` FROM tabDocType 
+			WHERE ifnull(docstatus,0)=0 
+			AND ifnull(istable,0)=0
+			AND ifnull(issingle,0)=0
+			AND `module` NOT IN ('System','Utilities','Setup Masters','Roles','Recycle Bin','Mapper','Application Internal','Development')
+			ORDER BY `name` ASC""")
+		
+		rl = [''] + [a[0] for a in sql("select name from tabRole where ifnull(docstatus,0)=0")]
+		
+		return {'doctypes': [r[0] for r in ret], 'roles': rl}
+		
+
+	# Get Perm Level, Perm type of Doctypes of Module and Role Selected
+	# -------------------------------------------------------------------
+	def get_permissions(self,doctype):
+		ret = []
+			
+		# Get permtype for the role selected
+		ptype = sql("select `role`,`permlevel`,`read`,`write`,`create`,`submit`,`cancel`,`amend` from tabDocPerm where `parent` = %s order by `permlevel` ASC",doctype,as_dict = 1)
+
+		# to convert 0L in 0 in values of dictionary
+		for p in ptype:
+			for key in p:
+				if key!='role':
+					p[key] = cint(p[key])
+			ret.append(p)
+						
+		# fields list
+		fl = ['', 'owner'] + [l[0] for l in sql("select fieldname from tabDocField where parent=%s and fieldtype='Link' and ifnull(options,'')!=''", doctype)]
+						
+		return {'perms':ret, 'fields':fl}
+		
+	# get default values
+	# ------------------
+	def get_defaults(self, arg):
+		match_key, with_profiles = arg.split('~~~')
+		
+		pl = ol = []
+	
+		# defaults
+		dl = [a for a in sql("select parent, ifnull(parenttype,'') as parenttype, ifnull(defvalue,'') as defvalue from tabDefaultValue where defkey=%s order by parenttype desc, parent asc", match_key, as_dict=1)]
+
+		# options
+		tn = sql("select options from tabDocField where fieldname=%s and fieldtype='Link' and docstatus=0 limit 1", match_key)[0][0]
+		ol = [''] + [a[0] for a in sql("select name from `tab%s` where ifnull(docstatus,0)=0" % tn)]
+
+		# roles
+		if with_profiles=='Yes':			
+			# profiles
+			pl = [''] + [a[0] for a in sql("select name from tabProfile where ifnull(enabled,0)=1")]
+	
+
+		return {'dl':dl, 'pl':pl, 'ol':ol}
+
+	# delete default
+	# ----------------------
+	def delete_default(self, arg):
+		parent, defkey, defvalue = arg.split('~~~')
+		sql("delete from tabDefaultValue where parent=%s and defkey=%s and defvalue=%s", (parent, defkey, defvalue))
+
+	# add default
+	# ----------------------
+	def add_default(self, arg):
+		parent, parenttype, defkey, defvalue = arg.split('~~~')
+
+		if sql("select name from tabDefaultValue where parent=%s and defkey=%s and defvalue=%s", (parent, defkey, defvalue)):
+			msgprint("This rule already exists!")
+			return
+					
+		dv = Document('DefaultValue')
+		dv.parent = parent
+		dv.parenttype = parenttype
+		dv.parentfield = 'defaults'
+		dv.defkey = defkey
+		dv.defvalue = defvalue
+		dv.save(1)
+		return dv.fields
+
+	# Add Permissions
+	# ----------------------
+	def add_permission(self,args=''):
+		parent, role, level = eval(args)
+		if sql("select name from tabDocPerm where parent=%s and role=%s and permlevel=%s", (parent, role, level)):
+			msgprint("This permission rule already exists!")
+			return
+		
+		d = Document('DocPerm')
+		d.parent = parent
+		d.parenttype = 'DocType'
+		d.parentfield = 'permissions'
+		d.role = role
+		d.permlevel = cint(level)
+		d.docstatus = 0
+		d.save(1)
+		
+		sql("update tabDocType set modified = %s where name = %s",(now(), parent))
+
+
+	# Update Permissions
+	# ----------------------
+	def update_permissions(self,args=''):
+		args = eval(args)
+		di = args['perm_dict']
+		doctype_keys = di.keys()	# ['Enquiry','Competitor','Zone','State']
+		for parent in doctype_keys:
+			for permlevel in di[parent].keys():
+				for role in di[parent][permlevel].keys(): 
+				
+					if role:
+				
+						# check if Permissions for that perm level and Role exists
+						exists = sql("select name from tabDocPerm where parent = %s and role = %s and ifnull(permlevel, 0) = %s",(parent, role, cint(permlevel)))
+	
+						# Get values of dictionary of Perm Level
+						pd = di[parent][permlevel][role]
+
+						# update
+						if exists and (1 in pd.values()):
+							sql("update tabDocPerm set `read` = %s, `write` = %s, `create` = %s, `submit` = %s, `cancel` = %s, `amend` = %s, `match`=%s where parent = %s and role = %s and permlevel = %s",(pd['read'],pd['write'],pd['create'],pd['submit'],pd['cancel'],pd['amend'], pd.get('match'), parent, role, permlevel))
+							
+						# new
+						elif not exists and (1 in pd.values()):
+
+							ch = Document('DocPerm')
+							ch.parentfield = 'permissions'
+							ch.parenttype = 'DocType'
+							ch.parent = parent
+							ch.role = role
+							ch.permlevel = cint(permlevel)
+							for key in pd.keys():
+								ch.fields[key] = pd.get(key, None)
+							ch.save(1)
+	
+						# delete
+						elif exists and (1 not in pd.values()):
+							sql("delete from tabDocPerm where parent = %s and role = %s and ifnull(permlevel,0) = %s",(parent, role, cint(permlevel)))
+						
+						sql("update tabDocType set modified = %s where name = %s",(now(), parent))
+		msgprint("Permissions Updated")
+				
+	# Get Fields based on DocType and Permlevel
+	# ----------------------------------------------
+	def get_fields(self, args = ''):
+		ret = {}
+		args = eval(args)
+		table_fields_dict = {}
+		table_exists = sql("Select options from tabDocField where fieldtype = 'Table' and parent = %s",args['dt'])
+		if table_exists:
+			for d in table_exists:
+				table_fields_dict[d[0]]= sql("select label,fieldtype,fieldname,options from tabDocField where parent = %s and permlevel = %s",(d[0],args['permlevel']),as_dict = 1)
+			
+		parent_fields_dict = sql("select label, fieldtype, fieldname, options from tabDocField where parent = %s and permlevel = %s and fieldtype not in ('Section Break','Column Break')",(args['dt'],args['permlevel']),as_dict = 1)
+		
+		ret['parent_fields_dict'] = parent_fields_dict
+		ret['table_fields_dict'] = table_fields_dict
+	 
+		return ret
+		
diff --git a/settings/doctype/permission_control/permission_control.txt b/settings/doctype/permission_control/permission_control.txt
new file mode 100644
index 0000000..0aae67c
--- /dev/null
+++ b/settings/doctype/permission_control/permission_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-07 10:42:02', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'saumil@webnotestech.com', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 47, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': '', 'name': 'Permission Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-18 20:24:33', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/settings/doctype/print_heading/__init__.py b/settings/doctype/print_heading/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/print_heading/__init__.py
diff --git a/settings/doctype/print_heading/print_heading.js b/settings/doctype/print_heading/print_heading.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/settings/doctype/print_heading/print_heading.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/settings/doctype/print_heading/print_heading.py b/settings/doctype/print_heading/print_heading.py
new file mode 100644
index 0000000..1b15025
--- /dev/null
+++ b/settings/doctype/print_heading/print_heading.py
@@ -0,0 +1,22 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc, self.doclist = doc,doclist
\ No newline at end of file
diff --git a/settings/doctype/print_heading/print_heading.txt b/settings/doctype/print_heading/print_heading.txt
new file mode 100644
index 0000000..4832e18
--- /dev/null
+++ b/settings/doctype/print_heading/print_heading.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-28 16:08:11', 'search_fields': 'print_heading', 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 28, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:print_heading', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Print Heading', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01019', 'parent': 'Print Heading', 'read': 1, 'create': 1, 'creation': '2010-05-31 09:51:59', 'modified': '2010-09-20 10:32:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-05-31 09:08:23', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Print Heading', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05127', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 10:32:30', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-28 16:08:11', 'doctype': 'DocField', 'oldfieldname': 'print_heading', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Print Heading', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Print Heading', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05110', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 10:32:30', 'parenttype': 'DocType', 'fieldname': 'print_heading', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-06 18:26:35', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Print Heading', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05844', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 10:32:30', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/series_detail/__init__.py b/settings/doctype/series_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/series_detail/__init__.py
diff --git a/settings/doctype/series_detail/series_detail.txt b/settings/doctype/series_detail/series_detail.txt
new file mode 100644
index 0000000..a195870
--- /dev/null
+++ b/settings/doctype/series_detail/series_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-06-12 17:10:41', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Series Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Read Only', 'creation': '2009-06-12 17:10:41', 'doctype': 'DocField', 'oldfieldname': 'series', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Series Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02330', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:05:22', 'parenttype': 'DocType', 'fieldname': 'series', 'fieldtype': 'Read Only', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-06-12 17:10:41', 'doctype': 'DocField', 'oldfieldname': 'remove', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Remove', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Series Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02331', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:05:22', 'parenttype': 'DocType', 'fieldname': 'remove', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/setup_wizard_control/__init__.py b/settings/doctype/setup_wizard_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/setup_wizard_control/__init__.py
diff --git a/settings/doctype/setup_wizard_control/setup_wizard_control.py b/settings/doctype/setup_wizard_control/setup_wizard_control.py
new file mode 100644
index 0000000..d1e1f9e
--- /dev/null
+++ b/settings/doctype/setup_wizard_control/setup_wizard_control.py
@@ -0,0 +1,64 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+  #=======================================================================================================
+  def get_master_lists(self):
+    ret = convert_to_lists(sql("select name from `tabWarehouse Type`"))
+    ret = ret and ret or []
+    return ret
+      
+  #=======================================================================================================
+  def create_record(self,dict_val):
+    obj_dict = eval(dict_val)
+    
+    for d in obj_dict:
+      if not obj_dict[d] == '' and not d =='Doctype':
+        
+        ret =sql("select name from `tab%s` where name = '%s'" %(obj_dict['Doctype'],obj_dict[d]))
+        if ret:
+          return "Record already exist."
+          raise Exception
+        rec = Document(obj_dict['Doctype'])
+    for i in obj_dict:
+      if not obj_dict[i] == '' and not i == 'Doctype':
+        rec.fields[i] = obj_dict[i]
+      
+    rec.save(1)
+    return "Record created."
+
+  #=======================================================================================================
+  def get_page_lst(self,nm):
+    
+    r1 = cstr(webnotes.user.get_roles()).replace('[','').replace(']','')
+
+    ret = sql("select parent from `tabPage Role` where role in (%s) and parent = '%s'"%(r1,nm))
+
+    return ret and True or False
+    
+  #=======================================================================================================
+  #------------------------get contry--------------------------------
+  def get_country(self):
+    cty = sql("select value from `tabSingles` where field = 'country' and doctype = 'Control Panel'")
+
+    return cty and cty[0][0] or ''
\ No newline at end of file
diff --git a/settings/doctype/setup_wizard_control/setup_wizard_control.txt b/settings/doctype/setup_wizard_control/setup_wizard_control.txt
new file mode 100644
index 0000000..ab9a03d
--- /dev/null
+++ b/settings/doctype/setup_wizard_control/setup_wizard_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-13 15:32:04', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 108, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Setup Wizard Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/settings/doctype/sms_settings/__init__.py b/settings/doctype/sms_settings/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/sms_settings/__init__.py
diff --git a/settings/doctype/sms_settings/sms_settings.txt b/settings/doctype/sms_settings/sms_settings.txt
new file mode 100755
index 0000000..7a84ae4
--- /dev/null
+++ b/settings/doctype/sms_settings/sms_settings.txt
@@ -0,0 +1,320 @@
+[
+	{
+		'_last_update': '1306301711',
+		'allow_attach': None,
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 18:21:16',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'module': 'Settings',
+		'name': 'SMS Settings',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 0,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 16
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-05-24 18:21:16',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'PERM00846',
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2011-05-24 18:21:16',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'PERM00847',
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-24 18:21:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'FL05444',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 18:21:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Eg. smsgateway.com/api/send_sms.cgi',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sms_gateway_url',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'SMS Gateway URL',
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'FL05440',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 18:21:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter url parameter for message',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'message_parameter',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Message Parameter',
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'FL05441',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 18:21:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter url parameter for receiver nos',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'receiver_parameter',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Receiver Parameter',
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'FL05442',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 18:21:16',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Static Parameters',
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'FL05445',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-24 18:21:16',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter static url parameters here (Eg. sender=ERPNext, username=ERPNext, password=1234 etc.)',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'static_parameter_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Static Parameter Details',
+		'modified': '2011-05-25 11:59:34',
+		'modified_by': 'Administrator',
+		'name': 'FL05443',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Static Parameter Detail',
+		'owner': 'Administrator',
+		'parent': 'SMS Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/settings/doctype/static_parameter_detail/__init__.py b/settings/doctype/static_parameter_detail/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/static_parameter_detail/__init__.py
diff --git a/settings/doctype/static_parameter_detail/static_parameter_detail.txt b/settings/doctype/static_parameter_detail/static_parameter_detail.txt
new file mode 100755
index 0000000..fc029d7
--- /dev/null
+++ b/settings/doctype/static_parameter_detail/static_parameter_detail.txt
@@ -0,0 +1,131 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 11:26:05',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-24 18:42:30',
+		'modified_by': 'Administrator',
+		'module': 'Settings',
+		'name': 'Static Parameter Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 4
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 11:26:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'parameter',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Parameter',
+		'modified': '2011-05-25 11:26:05',
+		'modified_by': 'Administrator',
+		'name': 'FL05012',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Static Parameter Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 11:26:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'value',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Value',
+		'modified': '2011-05-25 11:26:05',
+		'modified_by': 'Administrator',
+		'name': 'FL05013',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Static Parameter Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	}
+]
\ No newline at end of file
diff --git a/settings/doctype/update_series/__init__.py b/settings/doctype/update_series/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/update_series/__init__.py
diff --git a/settings/doctype/update_series/update_series.txt b/settings/doctype/update_series/update_series.txt
new file mode 100644
index 0000000..27a9bf5
--- /dev/null
+++ b/settings/doctype/update_series/update_series.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-04-13 14:48:50', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': 1, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': 'class DocType:\n  def __init__(self, doc, doclist=[]):\n    self.doc = doc\n    self.doclist = doclist\n\n  def update_series(self):\n    series = sql("select name,current from `tabSeries` where name = %s", self.doc.prefix,as_dict = 1)\n    if series:\n      msgprint("This is going to update Series with Prefix : " + series[0][\'name\'] + " from Current : " + cstr(series[0][\'current\']) + " to Current : "+ cstr(self.doc.current))\n      sql("update `tabSeries` set current = \'%s\' where name = \'%s\'" % (self.doc.current,series[0][\'name\']))\n      msgprint("Series Updated Successfully")\n    else:\n      msgprint("Please Check Prefix as there is no such Prefix : "+ self.doc.prefix +" Or Try Insert Button")\n\n  def insert_series(self):\n    #sql("start transaction")\n    series = sql("select name,current from `tabSeries` where name = %s", self.doc.prefix, as_dict = 1)\n    if series:\n      msgprint("Series with Prefix : " + series[0][\'name\'] + "already in the system . Try Update Button")\n    else:\n      msgprint("This is going to Insert Series with Prefix : " + cstr(self.doc.prefix) + " Current: " + cstr(self.doc.current))\n      sql("insert into `tabSeries` (name,current) values (\'%s\',\'%s\')" % (self.doc.prefix, self.doc.current))\n      msgprint("Series Inserted Successfully")', 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Update Series', 'idx': None, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00280', 'parent': 'Update Series', 'read': 1, 'create': 0, 'creation': '2009-04-13 14:48:50', 'modified': '2010-03-30 13:55:09', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-13 14:48:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Prefix', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01891', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-30 13:55:09', 'parenttype': 'DocType', 'fieldname': 'prefix', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-13 14:48:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Current', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01892', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-30 13:55:09', 'parenttype': 'DocType', 'fieldname': 'current', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-13 14:48:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01893', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-30 13:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'update_series', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-04-13 14:48:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Insert', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Update Series', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01894', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-30 13:55:09', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'insert_series', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/workflow_action_detail/__init__.py b/settings/doctype/workflow_action_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/workflow_action_detail/__init__.py
diff --git a/settings/doctype/workflow_action_detail/workflow_action_detail.txt b/settings/doctype/workflow_action_detail/workflow_action_detail.txt
new file mode 100644
index 0000000..e1520ec
--- /dev/null
+++ b/settings/doctype/workflow_action_detail/workflow_action_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-23 13:52:22', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'swarnalata@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Workflow Action Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-23 13:52:22', 'doctype': 'DocField', 'oldfieldname': 'action_field', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03385', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:54', 'parenttype': 'DocType', 'fieldname': 'action_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-23 13:52:22', 'doctype': 'DocField', 'oldfieldname': 'action_value', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Value', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03386', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:54', 'parenttype': 'DocType', 'fieldname': 'action_value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/settings/doctype/workflow_engine/__init__.py b/settings/doctype/workflow_engine/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/workflow_engine/__init__.py
diff --git a/settings/doctype/workflow_engine/workflow_engine.py b/settings/doctype/workflow_engine/workflow_engine.py
new file mode 100644
index 0000000..bf9b1ef
--- /dev/null
+++ b/settings/doctype/workflow_engine/workflow_engine.py
@@ -0,0 +1,47 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc, self.doclist = doc, doclist
+    
+  
+  def apply_rule(self,form_obj):
+    #msgprint("hello")
+    rule_list = sql("select rule_name from `tabWorkflow Rule` where select_form = '%s' and rule_status='Active' order by rule_priority asc" % (form_obj.doc.doctype))
+    for rl in rule_list:
+      #msgprint(rl[0])
+      autho_obj=get_obj("Workflow Rule",rl[0],with_children=1)   
+      cond_hold = autho_obj.evalute_rule(form_obj)
+      #msgprint("cond_hold:" + cond_hold)
+      if cond_hold =='Yes':
+        self.apply_action(rl[0],form_obj)
+    return
+      
+ 
+  #if rule holds true then the following action will be taken
+  def apply_action(self,rule_no,form_obj):
+    rule_obj=get_obj('Workflow Rule',rule_no,with_children=1)
+    #msgprint("action")
+    for d in getlist(rule_obj.doclist,'workflow_action_details'):
+      field_name=sql("select fieldname from tabDocField where parent='%s' and label='%s'" %(form_obj.doc.doctype,d.action_field))[0][0]
+      if field_name:
+        #msgprint(field_name)
+        form_obj.doc.fields[field_name] = d.action_value
+    return
\ No newline at end of file
diff --git a/settings/doctype/workflow_engine/workflow_engine.txt b/settings/doctype/workflow_engine/workflow_engine.txt
new file mode 100644
index 0000000..99b58ef
--- /dev/null
+++ b/settings/doctype/workflow_engine/workflow_engine.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-23 14:28:25', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'swarnalata@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Workflow Engine', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/settings/doctype/workflow_rule/__init__.py b/settings/doctype/workflow_rule/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/workflow_rule/__init__.py
diff --git a/settings/doctype/workflow_rule/workflow_rule.js b/settings/doctype/workflow_rule/workflow_rule.js
new file mode 100644
index 0000000..bed927e
--- /dev/null
+++ b/settings/doctype/workflow_rule/workflow_rule.js
@@ -0,0 +1,44 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+// Show Label name of fields for selected Doctype 
+// ---------------------------
+
+cur_frm.cscript.select_form = function(doc, cdt, cdn){
+  var mydoc = doc
+  
+  var call_back_action = function(mydoc){
+    $c('runserverobj', args={'method':'field_label_list', 'docs':compress_doclist (make_doclist (mydoc.doctype,mydoc.name))},
+    function(r, rt) {
+      var doc = locals[mydoc.doctype][mydoc.name];
+      cur_frm.fields_dict.workflow_action_details.grid.get_field("action_field").df.options = r.message;
+    }
+    );
+  }
+  
+  var call_back_rule = function(mydoc){
+    $c('runserverobj', args={'method':'compare_field', 'docs':compress_doclist (make_doclist (mydoc.doctype,mydoc.name))},
+    function(r, rt) {
+      var doc = locals[mydoc.doctype][mydoc.name];
+      cur_frm.fields_dict.workflow_rule_details.grid.get_field("comparing_field").df.options = r.message;
+      call_back_action(mydoc)
+    }
+    );
+  }
+  
+  $c('runserverobj', args={'method':'maindoc_field', 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
+    function(r, rt) {
+     var doc = locals[mydoc.doctype][mydoc.name];
+     cur_frm.fields_dict.workflow_rule_details.grid.get_field("rule_field").df.options = r.message;
+     call_back_rule(mydoc)
+    }
+  );
+}
\ No newline at end of file
diff --git a/settings/doctype/workflow_rule/workflow_rule.py b/settings/doctype/workflow_rule/workflow_rule.py
new file mode 100644
index 0000000..3a8cc82
--- /dev/null
+++ b/settings/doctype/workflow_rule/workflow_rule.py
@@ -0,0 +1,284 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc, self.doclist = doc, doclist  
+    
+    self.field_list=[]
+    field_info = sql("select label,fieldtype,options,fieldname from `tabDocField` where parent='%s' and fieldtype not in('Section Break','Column Break','Text','Small Text','Text Editor', 'Time', 'Check', 'Button','Code','HTML','Image','Blob','Password')"%self.doc.select_form)
+    for f in field_info:
+      sl=[]
+      for x in f:
+        sl.append(x)
+      self.field_list.append(sl)
+ 
+#list of labels
+  def field_label_list(self):
+    label= ''
+    for fi in self.field_list:
+      if fi[1] !='Table':
+        label += "\n" + fi[0]
+    
+    return label
+  
+ 
+  def compare_field(self):
+    ret1=''
+    for fi in self.field_list:
+      if fi[1] =='Table':
+        flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%fi[2])
+        for x in flist:
+          ret1 += "\n" + fi[2] + ':' + x[0]
+      else:
+        ret1 += "\n" + cstr(self.doc.select_form) + ':' + fi[0]
+   
+    return cstr(ret1)
+  
+#list of all fields for which conditions can be set
+  def maindoc_field(self):
+    ret = ''
+    for fi in self.field_list:
+      if fi[1] !='Select' or fi[1] !='Link' or fi[1] !='Table':
+        ret += "\n" + cstr(self.doc.select_form) + ':' + fi[0]
+      elif fi[1] =='Select':
+        op = fi[2].split(':')
+        if op[0] != 'link':
+          ret += "\n" + cstr(self.doc.select_form) + ':' +fi[0]
+
+    #child table field list
+    for fi in self.field_list:    
+      if fi[1] == 'Table':
+        flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%fi[2])
+        for x in flist:
+          ret += "\n" + fi[2] + ':' + x[0]
+    
+    # linked doctype field list
+    for fi in self.field_list:    
+      if fi[1] == 'Link':
+        flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Int', 'Select','Currency','Float','Link')"%fi[2])
+        for f in flist:
+          ret += "\n" + fi[0] + ':' +f[0]
+      elif fi[1] == 'Select':
+        op = fi[2].split(':')
+        if op[0] == 'link':
+          flist=sql("select label from tabDocField where parent='%s' and fieldtype in ('Data', 'Select', 'Int','Currency','Float','Link')"%op[1])
+          for f in flist:
+            ret += "\n" + fi[0] + ':' +f[0]
+
+    return cstr(ret)
+    
+  #table name of the selected doctype
+  def child_doc(self):
+    lst=[]
+    for fi in self.field_list:    
+      if fi[1] == 'Table':
+        lst.append(fi[2])
+    
+    return lst
+  
+  # function for finding fieldname,datatype of mentioned label
+  def field_info(self,label,parent):
+    field_name=sql("select fieldname from tabDocField where parent='%s' and label='%s'" %(parent,label))[0][0]
+    if field_name: 
+      datatype=sql("select fieldtype from `tabDocField` where fieldname='%s' and parent='%s'" %(field_name,parent))[0][0]
+      ret={'fieldnm':field_name,'datatype':datatype}
+    
+    return ret
+  
+  def compare_string(self,first,second):
+    if first.lower()==second.lower():
+      return 'true'
+    else:
+      return 'false'
+  
+#evalute operator
+  def eval_operator(self,op):
+    op_sign =''
+    if op=='Equals':
+      op_sign='=='
+    elif op=='Not Equals':
+      op_sign='!='
+    elif op=='Greater than':
+      op_sign='>'
+    elif op=='Greater than or Equals':
+      op_sign='>='
+    elif op=='Less than':
+      op_sign='<'
+    elif op=='Less than or Equals':
+      op_sign='<='
+    
+    return op_sign
+    
+#evaluation condition
+  def eval_condition(self,field_dict,form_val,value,operator):
+  
+    if field_dict['datatype']=='Data' or field_dict['datatype']=='Select' or field_dict['datatype'] =='Link':
+      #msgprint("not eval")
+      if self.compare_string(cstr(form_val),cstr(value))=='false':
+        cond_hold='No'
+      else:
+        cond_hold='Yes'
+    else:
+      #msgprint("eval")
+      op_sign = self.eval_operator(operator)
+      chk_cond=str(form_val) + str(op_sign) + str(value)
+      #msgprint(chk_cond)
+      if eval(chk_cond):
+        cond_hold='Yes'
+      else:
+        cond_hold='No'
+    #msgprint(cond_hold)
+    return cond_hold
+  
+  
+# fetching the value from the form
+  def find_value(self,fld_nm,tab_nm,rec_nm,child=0):
+    if child == 0:
+      form_val=sql("select %s from `tab%s` where name='%s'"%(fld_nm,tab_nm,rec_nm))
+    
+    elif child == 1:
+      form_val=sql("select %s from `tab%s` where parent='%s'"%(fld_nm,tab_nm,rec_nm))
+    
+    return form_val and form_val[0][0]
+  
+# if the comparing value is not entered manually but fetching from some other field
+  def compare_field_not_manual(self,comparing_field):
+    chk_with_value =''
+    temp_val = comparing_field.split(':')
+    if temp_val[0] == self.doc.select_form:
+      field_cf = self.field_info(temp_val[1],self.doc.select_form) 
+      val_cf=self.find_value(field_cf['fieldnm'],self.doc.select_form,form_obj.doc.name)     
+      chk_with_value = val_cf
+    elif temp_val[0] in child_list:
+      field_cf = self.field_info(second_label,first_label)
+      val_cf=self.find_value(field_cf['fieldnm'],first_label,form_obj.doc.name,1) 
+      chk_with_value = val_cf
+    
+    return chk_with_value
+# checking with main doctype  
+  def chk_from_main_dt(self,label1,value,operator,form_obj):
+    cond_hold = ''
+    field_dict = self.field_info(label1,self.doc.select_form) #getting fieldname info
+    form_val=self.find_value(field_dict['fieldnm'],self.doc.select_form,form_obj.doc.name) # find value
+    #msgprint(cstr(form_val))
+    if form_val :
+      cond_hold = self.eval_condition(field_dict,form_val,value,operator)
+    elif not form_val and field_dict['datatype'] =='Currency' or field_dict['datatype'] =='Float' or field_dict['datatype'] =='Int':
+      #msgprint("1") 
+      form_val = 0.0
+      cond_hold = self.eval_condition(field_dict,form_val,value,operator)
+    return cond_hold
+
+#checking with child doctype
+  def chk_from_child_dt(self,first_label,second_label,value,operator,form_obj):
+    cond_hold = ''
+    field_dict = self.field_info(second_label,first_label)
+    form_val=self.find_value(field_dict['fieldnm'],first_label,form_obj.doc.name,1) #fetching the value in current form from a table
+    if form_val or form_val==0:
+      cond_hold = self.eval_condition(field_dict,form_val,value,operator)
+    
+    return cond_hold
+
+  
+# if checking is with any linked doctype means first_label field from the doctype for which rule is given and second_label field from the doctype with which first_label is linked  
+  def chk_from_link_dt(self,first_label,second_label,form_obj,value,operator):
+    cond_hold=''
+    field_dict_first = self.field_info(first_label,self.doc.select_form)
+    for x in self.field_list:
+      if x[3] == field_dict_first['fieldnm']:
+        linked_to = x[2]
+    
+    lt = linked_to.split(':')
+    if lt[0] == 'link':
+      field_dict_second = self.field_info(second_label,lt[1])
+      link_val=sql("select %s from `tab%s` where name='%s'"%(field_dict_first['fieldnm'],self.doc.select_form,form_obj.doc.name))
+      if link_val and link_val[0][0]:
+        form_val = self.find_value(field_dict_second['fieldnm'],lt[1],link_val[0][0])
+        if form_val :
+          cond_hold = self.eval_condition(field_dict_second,form_val,value,operator)
+      
+    else:
+      field_dict_second = self.field_info(second_label,lt[0])
+      link_val=sql("select %s from `tab%s` where name='%s'"%(field_dict_first['fieldnm'],self.doc.select_form,form_obj.doc.name))
+      if link_val and link_val[0][0]:
+        form_val = self.find_value(field_dict_second['fieldnm'],lt[0],link_val[0][0])
+        if form_val :
+          cond_hold = self.eval_condition(field_dict_second,form_val,value,operator)
+    
+    return cond_hold
+
+  
+  def evalute_rule(self,form_obj):
+    #msgprint(form_obj.doc.name)
+    child_list = self.child_doc()
+    all_cond_hold=''
+    for d in getlist(self.doclist,'workflow_rule_details'):
+      label = d.rule_field.split(':')  #break up checking condition
+      
+      #findout the value with which condition will be checked
+      if d.value:
+        chk_with_value = d.value
+      elif d.comparing_field:
+        chk_with_value = self.compare_field_not_manual(d.comparing_field)  
+      
+      #msgprint(label)
+      # label[0] is doctype name for which rule is given, label[1] field name of that doctype
+      if label[0] == self.doc.select_form:
+        cond_hold = self.chk_from_main_dt(label[1],chk_with_value,d.operator,form_obj) 
+        if cond_hold =='No':
+          if d.exception == 'Yes':
+            msgprint(d.message)
+            raise Exception
+          elif d.exception=='No' or d.exception=='':
+            msgprint(d.message)
+          all_cond_hold = 'No'
+          break
+        elif cond_hold =='Yes':
+          all_cond_hold ='Yes'
+      	
+      #label[0] is child doctype name , label[1] is child doctype field name
+      elif label[0] in child_list:
+        cond_hold = self.chk_from_child_dt(label[0],label[1],chk_with_value,d.operator,form_obj) 
+        if cond_hold =='No':
+          if d.exception == 'Yes':
+            msgprint(d.message)
+            raise Exception
+          elif d.exception=='No' or d.exception=='':
+            msgprint(d.message)
+          all_cond_hold = 'No'
+          break
+        elif cond_hold =='Yes':
+          all_cond_hold ='Yes'
+       
+      # if checking is with any linked doctype means label[0] field from the doctype for which rule is given and label[1] field from the doctype with which label[0] is linked
+      else:
+        cond_hold=self.chk_from_link_dt(label[0],label[1],form_obj,chk_with_value,d.operator)
+        if cond_hold =='No':
+          if d.exception == 'Yes':
+              msgprint(d.message)
+              raise Exception
+          elif d.exception=='No' or d.exception=='':
+              msgprint(d.message)
+          all_cond_hold = 'No'
+          break
+        elif cond_hold =='Yes':
+          all_cond_hold ='Yes'
+   
+    return all_cond_hold
\ No newline at end of file
diff --git a/settings/doctype/workflow_rule/workflow_rule.txt b/settings/doctype/workflow_rule/workflow_rule.txt
new file mode 100644
index 0000000..bf5d9a0
--- /dev/null
+++ b/settings/doctype/workflow_rule/workflow_rule.txt
@@ -0,0 +1,710 @@
+[
+	{
+		'_last_update': '1300960468',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'field:rule_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:45:39',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'last_update': '1294161037',
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-09-20 14:06:57',
+		'modified_by': 'Administrator',
+		'module': 'Settings',
+		'name': 'Workflow Rule',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'select_form,rule_status',
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 31
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Rule Definition',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': '000006338',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Intro HTML',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': '000006339',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>Select form for which you want to define rules,set priority & status.</b>',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rule_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Rule Name',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL02596',
+		'no_copy': None,
+		'oldfieldname': 'rule_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rule_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Rule Name',
+		'modified': '2010-11-30 22:45:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03601',
+		'no_copy': None,
+		'oldfieldname': 'rule_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rule_status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Rule Status',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL03602',
+		'no_copy': None,
+		'oldfieldname': 'rule_status',
+		'oldfieldtype': 'Select',
+		'options': '\nActive\nInactive',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_form',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Select Form',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL03603',
+		'no_copy': None,
+		'oldfieldname': 'select_form',
+		'oldfieldtype': 'Link',
+		'options': 'DocType',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:42:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rule_priority',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Rule Priority',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL02597',
+		'no_copy': None,
+		'oldfieldname': 'rule_priority',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rule_priority',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Rule Priority',
+		'modified': '2010-11-30 22:45:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03604',
+		'no_copy': None,
+		'oldfieldname': 'rule_priority',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-03-24 15:58:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Define Rule',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': '000006340',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'workflow_rule_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Workflow Rule Details',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL03606',
+		'no_copy': None,
+		'oldfieldname': 'workflow_rule_details',
+		'oldfieldtype': 'Table',
+		'options': 'Workflow Rule Detail',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'extra_condition',
+		'fieldtype': 'Code',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Extra Condition',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL03607',
+		'no_copy': None,
+		'oldfieldname': 'extra_condition',
+		'oldfieldtype': 'Code',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-03-24 15:58:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Action Detail',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': '000006341',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Action html',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': '000006342',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<b>Specify actions to be taken  when conditions hold satisfied</b>',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'workflow_action_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Workflow Action Details',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL03610',
+		'no_copy': None,
+		'oldfieldname': 'workflow_action_details',
+		'oldfieldtype': 'Table',
+		'options': 'Workflow Action Detail',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-03-24 15:58:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': 1,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Reject HTML',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': '000006343',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': "<b>If any condition holds false the following message will be displayed . If you wish to stop rule engine when condition holds false then set 'Raise Exception' as 'Yes' otherwise keep this field blank or 'No'.</b>",
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 17:30:03',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'message',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Enter message',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL00549',
+		'no_copy': 1,
+		'oldfieldname': 'message',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'message',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Enter message',
+		'modified': '2010-11-30 22:45:39',
+		'modified_by': 'Administrator',
+		'name': 'FL03612',
+		'no_copy': 1,
+		'oldfieldname': 'message',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': '',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:45:39',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'raise_exception',
+		'fieldtype': 'Select',
+		'hidden': 1,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Raise Exception',
+		'modified': '2011-03-24 15:58:12',
+		'modified_by': 'Administrator',
+		'name': 'FL03613',
+		'no_copy': 1,
+		'oldfieldname': 'raise_exception',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-11-30 22:45:39',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-11-30 22:45:39',
+		'modified_by': 'Administrator',
+		'name': 'PERM00660',
+		'owner': 'swarnalata@webnotestech.com',
+		'parent': 'Workflow Rule',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	}
+]
\ No newline at end of file
diff --git a/settings/doctype/workflow_rule_detail/__init__.py b/settings/doctype/workflow_rule_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/settings/doctype/workflow_rule_detail/__init__.py
diff --git a/settings/doctype/workflow_rule_detail/workflow_rule_detail.txt b/settings/doctype/workflow_rule_detail/workflow_rule_detail.txt
new file mode 100644
index 0000000..4b1e4a1
--- /dev/null
+++ b/settings/doctype/workflow_rule_detail/workflow_rule_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-23 13:38:38', 'search_fields': None, 'module': 'Settings', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'swarnalata@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Workflow Rule Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-23 13:38:38', 'doctype': 'DocField', 'oldfieldname': 'rule_field', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Rule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03382', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:19', 'parenttype': 'DocType', 'fieldname': 'rule_field', 'fieldtype': 'Select', 'options': '[]', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-11-23 13:38:38', 'doctype': 'DocField', 'oldfieldname': 'operator', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Operator', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Rule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03383', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:19', 'parenttype': 'DocType', 'fieldname': 'operator', 'fieldtype': 'Select', 'options': '\nequal\nnot equal\ngreater than\ngreater than equal\nless than\nless than equal', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-23 13:38:38', 'doctype': 'DocField', 'oldfieldname': 'value', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Value', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Rule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03384', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:19', 'parenttype': 'DocType', 'fieldname': 'value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-12-08 11:40:55', 'doctype': 'DocField', 'oldfieldname': 'comparing_field', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field from other forms', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Rule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03486', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:19', 'parenttype': 'DocType', 'fieldname': 'comparing_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-07 12:51:48', 'doctype': 'DocField', 'oldfieldname': 'message', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Message when Cond. False', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Rule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03481', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:19', 'parenttype': 'DocType', 'fieldname': 'message', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-12-07 12:51:48', 'doctype': 'DocField', 'oldfieldname': 'exception', 'owner': 'swarnalata@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Raise Exception', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Workflow Rule Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03480', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-03-31 09:44:19', 'parenttype': 'DocType', 'fieldname': 'exception', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/Module Def/Setup/Setup.txt b/setup/Module Def/Setup/Setup.txt
new file mode 100644
index 0000000..5a0dcf7
--- /dev/null
+++ b/setup/Module Def/Setup/Setup.txt
@@ -0,0 +1,652 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:43:08',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': 'No',
+		'last_updated_date': '2011-03-21 12:13:39',
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module_desc': None,
+		'module_icon': 'wired.png',
+		'module_label': 'Setup',
+		'module_name': 'Setup',
+		'module_page': 'Setup',
+		'module_seq': 1,
+		'name': 'Setup',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'All important setup items in one place',
+		'display_name': 'Setup Wizard',
+		'doc_name': 'Setup Wizard',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'lightbulb.gif',
+		'idx': 1,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00221',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Personalize settings like company banner, date format, print format header etc.',
+		'display_name': 'Personalize',
+		'doc_name': 'Personalize Page',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'star.gif',
+		'idx': 2,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00222',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Enable / Disable users. Set user roles.',
+		'display_name': 'Manage Users',
+		'doc_name': 'Manage Users',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'group.gif',
+		'idx': 3,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00223',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Set global default values and account settings',
+		'display_name': 'Setup Defaults',
+		'doc_name': 'Manage Account',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'folder.gif',
+		'idx': 4,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00224',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'General Masters',
+		'display_name': 'Setup Masters',
+		'doc_name': 'Setup Masters',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'wrench.gif',
+		'idx': 5,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00225',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': None,
+		'display_name': 'Sales Browser',
+		'doc_name': 'Sales Browser',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00226',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': None,
+		'doc_name': None,
+		'doc_type': 'Separator',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003107',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': "Import data like Customers, Items etc in 'CSV' format",
+		'display_name': 'Import Data',
+		'doc_name': 'Import Data',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'disk.gif',
+		'idx': 8,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00228',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Set series prefix for transactions',
+		'display_name': 'Setup Series',
+		'doc_name': 'Naming Series',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'paperclip.gif',
+		'idx': 9,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00229',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Set approval rights for transactions based on grand total and discount.',
+		'display_name': 'Authorization Rule',
+		'doc_name': 'Authorization Rule',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'transaction\nbased_on\nmaster_name\nsystem_user\nsystem_role\napproving_role\napproving_user\nvalue',
+		'hide': None,
+		'icon': 'accept.gif',
+		'idx': 10,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00230',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Add fields in transactions, masters...',
+		'display_name': 'Custom Field',
+		'doc_name': 'Custom Field',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'dt\nlabel\nfieldtype\noptions',
+		'hide': None,
+		'icon': 'paperclip.gif',
+		'idx': 11,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00231',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:43:08',
+		'description': 'Contains records that you have trashed.',
+		'display_name': 'Trash',
+		'doc_name': 'Trash',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 12,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00232',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Price List',
+		'doc_name': 'Price List',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 13,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003108',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Warehouse Type',
+		'doc_name': 'Warehouse Type',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 14,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003109',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Warehouse',
+		'doc_name': 'Warehouse',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 15,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003110',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'UOM',
+		'doc_name': 'UOM',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 16,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003111',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Term',
+		'doc_name': 'Term',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 17,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003112',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Taxes and Charges',
+		'doc_name': 'Other Charges',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 18,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003113',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Business Letter Type',
+		'doc_name': 'Business Letter Type',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 19,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003114',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Business Letter Template',
+		'doc_name': 'Business Letter Template',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 20,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003115',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-03-24 15:04:47',
+		'description': None,
+		'display_name': 'Mode of Payment',
+		'doc_name': 'Mode of Payment',
+		'doc_type': 'Setup Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 21,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': '000003116',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00042',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00043',
+		'owner': 'Administrator',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'System Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00044',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales User'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00045',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 5,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00046',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 6,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00047',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase User'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 7,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00048',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 8,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00049',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 9,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00050',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material User'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 10,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00051',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 11,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00052',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Manager'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 12,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00053',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts User'
+	},
+	{
+		'creation': '2010-11-30 22:43:08',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 13,
+		'modified': '2010-11-30 22:43:08',
+		'modified_by': 'Administrator',
+		'name': 'MDR00054',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Setup',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts Manager'
+	}
+]
\ No newline at end of file
diff --git a/setup/__init__.py b/setup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/__init__.py
diff --git a/setup/doctype/__init__.py b/setup/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/__init__.py
diff --git a/setup/doctype/brand/__init__.py b/setup/doctype/brand/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/brand/__init__.py
diff --git a/setup/doctype/brand/brand.js b/setup/doctype/brand/brand.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/brand/brand.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/brand/brand.txt b/setup/doctype/brand/brand.txt
new file mode 100644
index 0000000..f7a92d2
--- /dev/null
+++ b/setup/doctype/brand/brand.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-05-26 14:59:10', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:brand', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Brand', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00874', 'parent': 'Brand', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-20 08:57:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00875', 'parent': 'Brand', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-20 08:57:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00899', 'parent': 'Brand', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-20 08:57:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00900', 'parent': 'Brand', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-20 08:57:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00549', 'parent': 'Brand', 'read': 1, 'create': 1, 'creation': '2009-12-30 12:15:49', 'modified': '2010-09-20 08:57:33', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00302', 'parent': 'Brand', 'read': 1, 'create': 1, 'creation': '2009-05-26 14:59:10', 'modified': '2010-09-20 08:57:33', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Brand', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04828', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:33', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-26 14:59:10', 'doctype': 'DocField', 'oldfieldname': 'brand', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Brand Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Brand', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02186', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:33', 'parenttype': 'DocType', 'fieldname': 'brand', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-05-26 14:59:10', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Brand', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02187', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:33', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': '', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/company/__init__.py b/setup/doctype/company/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/company/__init__.py
diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js
new file mode 100644
index 0000000..e27052c
--- /dev/null
+++ b/setup/doctype/company/company.js
@@ -0,0 +1,17 @@
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  if(doc.abbr && !doc.__islocal) set_field_permlevel('abbr',1);
+}
+
+cur_frm.fields_dict.default_bank_account.get_query = function(doc) {    
+  return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';   
+}
+
+
+cur_frm.fields_dict.receivables_group.get_query = function(doc) {  
+  return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
+}
+
+
+cur_frm.fields_dict.payables_group.get_query = function(doc) {  
+  return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
+}
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
new file mode 100644
index 0000000..fe60a2b
--- /dev/null
+++ b/setup/doctype/company/company.py
@@ -0,0 +1,228 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+  
+  # Create default accounts
+  # ---------------------------------------------------
+  def create_default_accounts(self):
+    self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'debit_or_credit':5,'company':6,'tax_rate':7}
+    acc_list_common = [['Application of Funds (Assets)','','Group','No','','Debit',self.doc.name,''],
+                        ['Current Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
+                          ['Accounts Receivable','Current Assets','Group','No','','Debit',self.doc.name,''],
+                          ['Bank Accounts','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
+                          ['Cash In Hand','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
+                            ['Cash','Cash In Hand','Ledger','No','Bank or Cash','Debit',self.doc.name,''],
+                          ['Loans and Advances (Assets)','Current Assets','Group','No','','Debit',self.doc.name,''],
+                          ['Securities and Deposits','Current Assets','Group','No','','Debit',self.doc.name,''],
+                            ['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''],
+                          ['Stock In Hand','Current Assets','Group','No','','Debit',self.doc.name,''],
+                            ['Stock','Stock In Hand','Ledger','No','','Debit',self.doc.name,''],
+                          ['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
+                        ['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
+                          ['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
+                          ['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
+                          ['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
+                          ['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
+                          ['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
+                        ['Investments','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
+                        ['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
+                          ['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Debit',self.doc.name,''],
+                  ['Source of Funds (Liabilities)','','Group','No','','Credit',self.doc.name,''],
+                    ['Capital Account','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
+                      ['Reserves and Surplus','Capital Account','Group','No','','Credit',self.doc.name,''],
+                      ['Shareholders Funds','Capital Account','Group','No','','Credit',self.doc.name,''],
+                    ['Current Liabilities','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
+                      ['Accounts Payable','Current Liabilities','Group','No','','Credit',self.doc.name,''],
+                      ['Duties and Taxes','Current Liabilities','Group','No','','Credit',self.doc.name,''],
+                      ['Loans (Liabilities)','Current Liabilities','Group','No','','Credit',self.doc.name,''],
+                        ['Secured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
+                        ['Unsecured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
+                        ['Bank Overdraft Account','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
+                    ['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
+                      ['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','No','','Credit',self.doc.name,''],
+                  ['Income','','Group','Yes','','Credit',self.doc.name,''],
+                    ['Direct Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
+                      ['Sales','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
+                      ['Service','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
+                    ['Indirect Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
+                  ['Expenses','','Group','Yes','Expense Account','Debit',self.doc.name,''],
+                    ['Direct Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Cost of Goods Sold','Direct Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                    ['Indirect Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Advertising and Publicity','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
+                      ['Bad Debts Written Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Bank Charges','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Books and Periodicals','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Charity and Donations','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Commission on Sales','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Conveyance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Customer Entertainment Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Depreciation Account','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Freight and Forwarding Charges','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
+                      ['Legal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Miscellaneous Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
+                      ['Office Maintenance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Office Rent','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Postal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Print and Stationary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Rounded Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Salary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Sales Promotion Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
+                      ['Service Charges Paid','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Staff Welfare Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Telephone Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Travelling Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
+                      ['Water and Electricity Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,'']
+                  ]
+    
+    acc_list_india = [
+                      ['CENVAT Capital Goods','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
+                      ['CENVAT','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
+                      ['CENVAT Service Tax','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
+                      ['CENVAT Service Tax Cess 1','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
+                      ['CENVAT Service Tax Cess 2','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
+                      ['CENVAT Edu Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
+                      ['CENVAT SHE Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
+                      ['Excise Duty 4','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'4.00'],
+                      ['Excise Duty 8','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'8.00'],
+                      ['Excise Duty 10','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'10.00'],
+                      ['Excise Duty 14','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'14.00'],
+                      ['Excise Duty Edu Cess 2','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'2.00'],
+                      ['Excise Duty SHE Cess 1','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'1.00'],
+                      ['P L A','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
+                      ['P L A - Cess Portion','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
+                      ['Edu. Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
+                      ['Edu. Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
+                      ['Edu. Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
+                      ['Excise Duty @ 4','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'4.00'],
+                      ['Excise Duty @ 8','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'8.00'],
+                      ['Excise Duty @ 10','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.00'],
+                      ['Excise Duty @ 14','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'14.00'],
+                      ['Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.3'],
+                      ['SHE Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
+                      ['SHE Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
+                      ['SHE Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
+                      ['Professional Tax','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['VAT','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['TDS (Advertisement)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['TDS (Commission)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['TDS (Contractor)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['TDS (Interest)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['TDS (Rent)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
+                      ['TDS (Salary)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,'']
+                     ]
+    # load common account heads
+    for d in acc_list_common:
+      self.add_acc(d)
+
+    country = sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
+    country = country and cstr(country[0][0]) or ''
+
+    # load taxes (only for India)
+    if country == 'India':
+      for d in acc_list_india:
+        self.add_acc(d)
+
+  # Create account
+  # ---------------------------------------------------
+  def add_acc(self,lst):
+    ac = Document('Account')
+    for d in self.fld_dict.keys():
+      ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]]
+    ac.old_parent = ''
+    ac_obj = get_obj(doc=ac)
+    ac_obj.validate()
+    ac_obj.doc.save(1)
+    ac_obj.on_update()
+    sql("commit")
+    sql("start transaction")
+
+
+  # Set letter head
+  # ---------------------------------------------------  
+  def set_letter_head(self):
+    if not self.doc.letter_head:
+      if self.doc.address:
+        header = """ 
+<div><h3> %(comp)s </h3> %(add)s </div>
+
+      """ % {'comp':self.doc.name,
+         'add':self.doc.address.replace("\n",'<br>')}
+       
+        self.doc.letter_head = header
+
+  # Set default AR and AP group
+  # ---------------------------------------------------
+  def set_default_groups(self):
+    if not self.doc.receivables_group:
+      set(self.doc, 'receivables_group', 'Accounts Receivable - '+self.doc.abbr)
+    if not self.doc.payables_group:
+      set(self.doc, 'payables_group', 'Accounts Payable - '+self.doc.abbr)
+      
+      
+  # Create default cost center
+  # ---------------------------------------------------
+  def create_default_cost_center(self):
+    glc = get_obj('GL Control')
+    cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Group','parent_cost_center':'','old_parent':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr,'old_parent':''}]
+    for c in cc_list:
+      glc.add_cc(str(c))
+      
+      
+  # On update
+  # ---------------------------------------------------
+  def on_update(self):
+    self.set_letter_head()
+    ac = sql("select name from tabAccount where account_name='Income' and company=%s", self.doc.name)
+    if not ac:
+      self.create_default_accounts()
+    self.set_default_groups()
+    cc = sql("select name from `tabCost Center` where cost_center_name = 'Root' and company_name = '%s'"%(self.doc.name))
+    if not cc:
+      self.create_default_cost_center()
+
+  # Trash accounts and cost centers for this company
+  # ---------------------------------------------------
+  def on_trash(self):
+    acc = sql("select name from tabAccount where company = '%s' and docstatus = 1" % self.doc.name)
+    for each in acc:
+      get_obj('Account', each[0]).on_trash()
+      
+    cc = sql("select name from `tabCost Center` where company_name = '%s' and docstatus = 1" % self.doc.name)
+    for each in cc:
+      get_obj('Cost Center', each[0]).on_trash()
+    
+    msgprint("Company trashed. All the accounts and cost centers related to this company also trashed. You can restore it anytime from Setup -> Manage Trash")
+
+
+  # Restore accounts and cost centers for this company  
+  # ---------------------------------------------------
+  def on_restore(self):
+    acc = sql("select name from tabAccount where company = '%s' and docstatus = 2" % self.doc.name)
+    for each in acc:
+      get_obj('Account', each[0]).on_restore()
+      
+    cc = sql("select name from `tabCost Center` where company_name = '%s' and docstatus = 2" % self.doc.name)
+    for each in cc:
+      get_obj('Cost Center', each[0]).on_restore()
+    
+    msgprint("Company restored. All the accounts and cost centers related to this company also restored.")
diff --git a/setup/doctype/company/company.txt b/setup/doctype/company/company.txt
new file mode 100644
index 0000000..d1664fa
--- /dev/null
+++ b/setup/doctype/company/company.txt
@@ -0,0 +1,930 @@
+[
+	{
+		'_last_update': '1303215455',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:company_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:55',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-20 12:17:16',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'Company',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 86
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:08:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': '',
+		'modified': '2010-08-08 17:08:55',
+		'modified_by': 'Administrator',
+		'name': 'PERM00119',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:08:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': '',
+		'modified': '2010-08-08 17:08:55',
+		'modified_by': 'Administrator',
+		'name': 'PERM00120',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 0,
+		'create': None,
+		'creation': '2010-08-08 17:08:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:08:55',
+		'modified_by': 'Administrator',
+		'name': 'PERM00121',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:28',
+		'default': None,
+		'depends_on': None,
+		'description': 'Please Enter Company Name and Abbr and save the document. Once saved Accounting Settings will be populated automatically',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Details',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': '000000437',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Company',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00695',
+		'no_copy': 1,
+		'oldfieldname': 'company_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': 'Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'abbr',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Abbr',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00696',
+		'no_copy': 1,
+		'oldfieldname': 'abbr',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00697',
+		'no_copy': None,
+		'oldfieldname': 'address',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:28',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Default Currency',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': '000000434',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:28',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': '000000438',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'phone_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Phone No',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00699',
+		'no_copy': None,
+		'oldfieldname': 'phone_no',
+		'oldfieldtype': 'Data',
+		'options': 'Phone',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Email',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00700',
+		'no_copy': None,
+		'oldfieldname': 'email',
+		'oldfieldtype': 'Data',
+		'options': 'Email',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fax',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Fax',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00701',
+		'no_copy': None,
+		'oldfieldname': 'fax',
+		'oldfieldtype': 'Data',
+		'options': 'Phone',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-12-14 10:32:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Trash Company',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL04130',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'website',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Website',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00702',
+		'no_copy': None,
+		'oldfieldname': 'website',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 11:04:28',
+		'default': None,
+		'depends_on': None,
+		'description': 'Company registration numbers for your reference. Example: VAT Registration Numbers etc.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Registration Info',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': '000000439',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': 'Company registration numbers for your reference. Tax numbers etc.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'registration_details',
+		'fieldtype': 'Code',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Registration Details',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00704',
+		'no_copy': None,
+		'oldfieldname': 'registration_details',
+		'oldfieldtype': 'Code',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:28',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Accounting Settings',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': '000000440',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_bank_account',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Default Bank Account',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00706',
+		'no_copy': 1,
+		'oldfieldname': 'default_bank_account',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'receivables_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Receivables Group',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00707',
+		'no_copy': 1,
+		'oldfieldname': 'receivables_group',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'payables_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Payables Group',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00708',
+		'no_copy': 1,
+		'oldfieldname': 'payables_group',
+		'oldfieldtype': 'Link',
+		'options': 'Account',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:28',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': '000000441',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'yearly_bgt_flag',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'If Yearly Budget Exceeded',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00710',
+		'no_copy': None,
+		'oldfieldname': 'yearly_bgt_flag',
+		'oldfieldtype': 'Select',
+		'options': '\nWarn\nIgnore\nStop',
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'monthly_bgt_flag',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'If Monthly Budget Exceeded',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00711',
+		'no_copy': None,
+		'oldfieldname': 'monthly_bgt_flag',
+		'oldfieldtype': 'Select',
+		'options': '\nWarn\nIgnore\nStop',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_days',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Credit Days',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00712',
+		'no_copy': None,
+		'oldfieldname': 'credit_days',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_limit',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Credit Limit',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00713',
+		'no_copy': None,
+		'oldfieldname': 'credit_limit',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-09 11:04:28',
+		'modified_by': 'Administrator',
+		'name': 'FL00716',
+		'no_copy': 1,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Company',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/contact_control/__init__.py b/setup/doctype/contact_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/contact_control/__init__.py
diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js
new file mode 100755
index 0000000..b6825eb
--- /dev/null
+++ b/setup/doctype/contact_control/contact_control.js
@@ -0,0 +1,562 @@
+// common partner functions
+// =========================
+
+/*
+// make shipping list body
+// ------------------------
+cur_frm.cscript.make_sl_body = function(){
+	cur_frm.fields_dict['Shipping HTML'].wrapper.innerHTML = '';
+	cur_frm.shipping_html = $a(cur_frm.fields_dict['Shipping HTML'].wrapper,'div');
+}
+*/
+
+// make history list body
+// -----------------------
+cur_frm.cscript.make_hl_body = function(){
+	cur_frm.fields_dict['History HTML'].wrapper.innerHTML = '';
+	cur_frm.history_html = $a(cur_frm.fields_dict['History HTML'].wrapper,'div');
+}
+
+
+/*
+// set shipping list message
+// --------------------------
+cur_frm.cscript.set_sl_msg = function(doc){
+	cur_frm.shipping_html.innerHTML = 'Shipping Address Details will appear only when you save the ' + doc.doctype.toLowerCase();
+}
+*/
+/*
+// set history list message
+// -------------------------
+cur_frm.cscript.set_hl_msg = function(doc){
+	cur_frm.history_html.innerHTML= 'History Details will appear only when you save the ' + doc.doctype.toLowerCase();
+}
+*/
+
+
+/*
+// make shipping address
+// -------------
+cur_frm.cscript.make_shipping_address = function(doc, dt, dn){
+  	cur_frm.shipping_html.innerHTML = '';
+
+	var dsn = cur_frm.doc.customer_name;
+	var dsa = cur_frm.doc.address;
+	cl = new AddressList(cur_frm.shipping_html,dt,dn,dsn,dsa);
+}
+*/
+
+
+// make history
+// -------------
+cur_frm.cscript.make_history = function(doc,dt,dn){
+	cur_frm.history_html.innerHTML = '';
+	cur_frm.cscript.make_history_list(cur_frm.history_html,doc);
+}
+
+// make history list
+// ------------------
+cur_frm.cscript.make_history_list = function(parent,doc){
+
+	var sel = $a(parent,'select');
+	
+	var ls = ['Select Transaction..'];
+	for(d in cur_frm.history_dict){
+		ls.push(d);
+	}
+	
+	add_sel_options(sel,ls,'Select..');
+	
+	var body = $a(parent,'div');
+	body.innerHTML = '<div class="help_box">Please select a transaction type to see History</div>';
+	
+	sel.body = body;
+	sel.doc = doc;
+	
+	sel.onchange = function(){
+		for(d in cur_frm.history_dict){
+			if(sel_val(this) == d){
+				this.body.innerHTML = '';
+				eval(cur_frm.history_dict[d]);
+				return;
+			}
+			else{
+				// pass
+			}
+		}
+	}
+}
+
+// run list
+// ---------
+cur_frm.cscript.run_list = function(lst,parent,q,q_max,doc,dn,nm){
+	
+	parent.innerHTML = '';
+	$dh(parent);
+	
+	lst.doc = doc;
+	lst.dn = dn;
+	lst.nm = nm;
+	lst.page_len = 10;
+	
+	lst.get_query = function(){
+		this.query = q;
+		this.query_max = q_max;
+	}
+	
+	lst.make(parent);
+	lst.run();
+	
+	lst.onrun = function(){
+		$ds(parent);
+		if(!this.has_data()){
+			parent.innerHTML = '';
+			var dv = $a(parent,'div','help_box');
+			$a(dv,'span').innerHTML = "No " + this.dn + " found. ";
+			
+			var lbl = 'Create the <b>first</b> ' + this.dn + ' for ' + this.doc.name;
+			var sp = $a(dv,'span');
+			sp.nm = this.nm;
+			$(sp).html(lbl).addClass('link_type').click(function(){ newdoc(this.nm); });
+		}
+	}
+}
+
+
+// get sates on country trigger
+// -----------------------------
+cur_frm.cscript.get_states=function(doc,dt,dn){
+   $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
+    function(r,rt){
+      if(r.message) {
+        set_field_options('state', r.message);
+      }
+    }  
+  );
+
+}
+
+cur_frm.cscript.country = function(doc, dt, dn) {
+  cur_frm.cscript.get_states(doc, dt, dn);
+}
+
+// territory help - cutsomer + sales partner
+// -----------------------------------------
+cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
+  var call_back = function(){
+
+    var sb_obj = new SalesBrowser();        
+    sb_obj.set_val('Territory');
+  }
+  loadpage('Sales Browser',call_back);
+}
+
+// get query select Territory
+// ---------------------------
+if(cur_frm.fields_dict['territory']){
+	cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) {
+		return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+	}
+}
+
+
+// =======================================================================================================
+
+// contact list
+// --------------
+ContactList = function(parent,dt,dn,dsn){
+	
+	var me = this;
+	
+	this.dt = dt;
+	this.dn = dn;
+	this.dsn = dsn ? dsn : dn;
+
+	this.wrapper = $a(parent,'div');
+	me.get_list();
+}
+
+// add contact
+// ------------
+ContactList.prototype.add_contact = function(){
+	var me = this;
+	
+	// onload - set default values
+	var cont = LocalDB.create('Contact');
+
+	var c = locals['Contact'][cont];
+	
+	if(me.dt == 'Customer')	{
+		c.is_customer = 1;
+		c.customer = me.dn;
+		c.customer_name = me.dsn;
+	}
+	else if(me.dt == 'Supplier'){
+		c.is_supplier = 1;
+		c.supplier = me.dn;
+		c.supplier_name = me.dsn;
+	}
+	else if(me.dt == 'Sales Partner'){
+		c.is_sales_partner = 1;
+		c.sales_partner = me.dn;
+		//c.sales_partner_name = me.dsn;
+	}
+	
+	loaddoc('Contact',c.name);
+}
+
+// get contact list
+// -----------------
+ContactList.prototype.get_list = function(){
+	var me = this;
+	
+	me.make_list();
+	
+	var dt = me.dt.toLowerCase().split(' ').join('_');
+	
+	// build query
+	me.lst.get_query = function(){
+		this.query = repl("select name, first_name, last_name, concat_ws(' ', first_name, last_name), email_id, contact_no, department, designation, is_primary_contact, has_login, disable_login from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
+
+		this.query_max = repl("select count(name) from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
+	}
+	
+	// render list ui
+	me.lst.show_cell = function(cell,ri,ci,d){
+		me.render_list(cell,ri,ci,d);
+	}
+	
+	// run query
+	me.lst.run();
+	
+	// onrun
+	me.lst.onrun = function(){
+		if(!this.has_data()){
+			this.rec_label.innerHTML = '';
+			
+			$a(this.rec_label,'span').innerHTML = "You do not have any contact. ";
+			$($a(this.rec_label,'span')).html('Add a new contact').addClass('link_type').click(function(){ me.add_contact(); });
+			
+			$dh(this.results);
+		}
+		else{
+			$ds(this.results);
+		}
+	}	
+}
+
+// make list
+// -----------
+ContactList.prototype.make_list = function(){
+	var me = this;
+	
+	var l = new Listing();
+	l.colwidths = ['5%','30%','30%','20%','20%'];
+	l.colnames = ['Sr.','Contact Name','Email Id','Contact No', 'Action'];
+	l.page_len = 10;
+  
+	me.lst = l;
+	
+	l.make(me.wrapper);
+	
+	// Add contact button
+	me.add_btn = $btn(l.btn_area,'+ Add Contact', function(){ me.add_contact();}, {fontWeight:'bold'});
+}
+
+// make contact cell
+// ------------------
+ContactList.prototype.render_list = function(cell,ri,ci,d){
+	var me = this;
+
+	// name
+	if(ci == 0){
+		var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
+		nm.innerHTML = d[ri][3];
+		nm.id = d[ri][0];
+		
+		nm.onclick = function(){
+			loaddoc('Contact', this.id);
+			
+			// on save callback - refresh list
+		}
+
+		// department and designation
+		var des = d[ri][7] ? d[ri][7] : '';
+		var dep = d[ri][6] ? d[ri][6] : '';
+		
+		var sp = $a(cell,'div','comment');
+		sp.innerHTML = des + (dep ? (', ' + dep) : ''); 
+	}
+	
+	// email id, contact no, department, designation
+	// -----------------------------------------------------
+	if(ci == 1) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
+	if(ci == 2) cell.innerHTML = d[ri][5] ? d[ri][5] : '-';
+	
+	// actions
+	// --------------------------------------
+	if(ci== 3) me.make_actions(cell,ri,ci,d);
+}
+
+// make actions
+// ---------------
+ContactList.prototype.make_actions = function(cell,ri,ci,d){
+	var me = this;
+	
+	var tab = make_table(cell,1,2,'100%',['40%','60%']);
+
+	// Edit and Delete
+	var t = make_table($td(tab,0,0),1,2);
+	
+	var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
+	$(edit).click(function(){ loaddoc('Contact',d[ri][0]); });
+	
+	edit.setAttribute('title','Edit');
+
+// Below code should be uncommented once customer/venodr invitation process is stable
+// ===========================================================================
+/* 
+	var del = $a($td(t,0,1),'div','wn-icon ic-trash');
+	$(del).click(function(){ me.delete_contact(d[ri][0],d[ri][4]) });
+
+	set_custom_tooltip(del, 'Delete');
+	
+	//  Invite, Enable and Disable - Integrate after gateway logic incorporated
+
+	if(d[ri][9] == 'Yes')	{
+		if(d[ri][10] == 'Yes'){
+			var enb = $a($td(tab,0,1),'div','wn-icon ic-checkmark');
+			$(enb).click(function(){ me.enable_login(d[ri][0], d[ri][4]); });
+		}
+		else{
+			var dsb = $a($td(tab,0,1),'div','wn-icon ic-delete');
+			$(dsb).click(function(){ me.disable_login(d[ri][0], d[ri][4]) });
+		}
+	}
+	else{
+		var inv = $a($td(tab,0,1),'div','wn-icon ic-mail');
+		$(inv).click(function(){ me.invite_contact(d[ri][0], d[ri][4], d[ri][1], d[ri][2]) });
+	}*/
+}
+
+// enable login
+// ----------------------------------------------------------
+ContactList.prototype.enable_login = function(id, email_id){
+	var me = this;
+	
+	var callback = function(r,rt){
+		me.get_list();
+		
+		if(!r.exc) msgprint('Login for contact enabled',1);
+		else errprint(r.exc);
+	}
+	
+	var args = {};
+	args.contact = id;
+	args.email = email_id;
+	
+	$c_obj('Contact Control','enable_login',JSON.stringify(args),callback);
+}
+
+// disable login
+// -------------------------------------------------------------
+ContactList.prototype.disable_login = function(id, email_id){
+	var me = this;
+	
+	var callback = function(r,rt){
+		me.get_list();
+		
+		if(!r.exc) msgprint('Login for contact disabled',1);
+		else errprint(r.exc);
+	}
+
+	var args = {};
+	args.contact = id;
+	args.email = email_id;
+		
+	$c_obj('Contact Control','disable_login',JSON.stringify(args),callback);
+}
+
+// delete contact
+// -----------------
+ContactList.prototype.delete_contact = function(id,email_id,has_login){
+	var me = this;
+	
+	var callback = function(r,rt){
+		me.get_list();
+		
+		if(!r.exc) msgprint('Contact deleted successfully');
+		else errprint(r.exc);
+	}
+	
+	var args = {};
+	args.contact = id;
+	args.email = email_id;
+	args.has_login = has_login;
+	
+	$c_obj('Contact Control','delete_contact',JSON.stringify(args),callback);
+}
+
+// invite user
+// --------------------------------------------------------
+ContactList.prototype.invite_contact = function(id,email_id,first_name,last_name){
+	var me = this;
+
+	if(!email_id){
+		msgprint("Please add email id and save the contact first. You can then invite contact to view transactions.")
+	}
+	else{
+		var callback = function(r,rt){
+			if(!r.exc) msgprint('Invitation sent');
+			else errprint(r.exc);
+		}
+	
+		var args = {
+			'contact' : id,
+			'email' : email_id,
+			'first_name' : first_name ? first_name : '',
+			'last_name' : last_name ? last_name : '',
+			'usert_type' : 'Partner'
+		};
+		
+		$c_obj('Contact Control','invite_contact',JSON.stringify(args),callback);	
+	}
+}
+
+
+// address list
+// --------------
+AddressList = function(parent,dt,dn,dsn,dsa){
+	
+	var me = this;
+	
+	this.dt = dt;
+	this.dn = dn;
+	this.dsn = dsn ? dsn : dn;
+        this.dsa = dsa ? dsa : '';
+
+	this.wrapper = $a(parent,'div');
+	me.get_addr_list();
+}
+
+
+// add contact
+// ------------
+AddressList.prototype.add_address = function(){
+	var me = this;
+	
+	// onload - set default values
+	var addr = LocalDB.create('Shipping Address');
+
+	var a = locals['Shipping Address'][addr];
+	
+	a.customer = me.dn;
+	a.customer_name = me.dsn;
+        a.customer_address = me.dsa;	
+	loaddoc('Shipping Address',a.name);
+}
+
+
+// get address list
+// -----------------
+AddressList.prototype.get_addr_list = function(){
+	var me = this;
+	
+	me.make_addr_list();
+	
+	var dt = me.dt.toLowerCase().split(' ').join('_');
+	
+	// build query
+	me.lst.get_query = function(){
+		this.query = repl("select name, ship_to, shipping_address, is_primary_address, shipping_details from `tabShipping Address` where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
+
+		this.query_max = repl("select count(name) from `tabShipping Address` where %(dt)s = '%(dn)s'",{'dt':dt, 'dn':me.dn});
+	}
+	
+	// render list ui
+	me.lst.show_cell = function(cell,ri,ci,d){
+		me.render_list(cell,ri,ci,d);
+	}
+	
+	// run query
+	me.lst.run();
+	
+	// onrun
+	me.lst.onrun = function(){
+		if(!this.has_data()){
+			this.rec_label.innerHTML = '';
+			
+			$a(this.rec_label,'span').innerHTML = "You do not have any shipping address.";
+			$($a(this.rec_label,'span')).html('Add a new address').addClass('link_type').click(function(){ me.add_address(); });
+			
+			$dh(this.results);
+		}
+		else{
+			$ds(this.results);
+		}
+	}	
+}
+
+
+// make list
+// -----------
+AddressList.prototype.make_addr_list = function(){
+	var me = this;
+	
+	var l = new Listing();
+	l.colwidths = ['5%', '15%', '25%','10%','35%','10%'];
+	l.colnames = ['Sr.', 'Ship To', 'Shipping Address','Primary Address', 'Shipping Details', 'Action'];
+    l.page_len = 10;
+  
+	me.lst = l;
+	
+	l.make(me.wrapper);
+	
+	// Add address button
+	me.add_btn = $btn(l.btn_area,'+ Add Address', function(){ me.add_address();}, {fontWeight:'bold'});
+}
+
+
+
+// make address cell
+// ------------------
+AddressList.prototype.render_list = function(cell,ri,ci,d){
+	var me = this;
+
+	// name
+	if(ci == 0){
+		var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
+		nm.innerHTML = d[ri][1];
+		nm.id = d[ri][0];
+		
+		nm.onclick = function(){
+			loaddoc('Shipping Address', this.id);
+		}
+	}
+	
+	// shipping address, primary address, shipping details
+	// ----------------------------------------------------
+	if(ci == 1) cell.innerHTML = d[ri][2] ? d[ri][2] : '-';
+	if(ci == 2) cell.innerHTML = d[ri][3] ? d[ri][3] : '-';
+	if(ci == 3) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
+	
+	// actions
+	// --------------------------------------
+	if(ci== 4) me.make_actions(cell,ri,ci,d);
+}
+
+// make actions
+// ---------------
+AddressList.prototype.make_actions = function(cell,ri,ci,d){
+	var me = this;
+	
+	var tab = make_table(cell,1,2,'100%',['40%','60%']);
+
+	// Edit and Delete
+	var t = make_table($td(tab,0,0),1,2);
+	
+	var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
+	$(edit).click(function(){ loaddoc('Shipping Address',d[ri][0]); });
+	
+	edit.setAttribute('title','Edit');
+}
diff --git a/setup/doctype/contact_control/contact_control.py b/setup/doctype/contact_control/contact_control.py
new file mode 100644
index 0000000..3c25d7f
--- /dev/null
+++ b/setup/doctype/contact_control/contact_control.py
@@ -0,0 +1,103 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    
+  def enable_login(self,arg):
+    arg = eval(arg)
+    sql("update tabContact set disable_login = 'No' where name=%s",arg['contact'])
+    sql("update tabProfile set enabled=1 where name=%s",arg['email'])
+    
+  def disable_login(self,arg):
+    arg = eval(arg)
+    sql("update tabContact set disable_login = 'Yes' where name=%s",arg['contact'])
+    sql("update tabProfile set enabled=0 where name=%s",arg['email'])
+    
+  def create_login(self,arg):
+    arg = eval(arg)
+    cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
+    if cont_det[0]['docstatus'] !=0:
+      msgprint('Please save the corresponding contact first')
+      raise Exception
+      
+    if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
+      msgprint('Profile with same name already exist.')
+      raise Exception
+    else:
+      p = Document('Profile')
+      p.name = cont_det[0]['email_id']
+      p.first_name = cont_det[0]['first_name']
+      p.last_name = cont_det[0]['last_name']
+      p.email = cont_det[0]['email_id']
+      p.cell_no = cont_det[0]['contact_no']
+      p.password = 'password'
+      p.enabled = 1
+      p.user_type = 'Partner';
+      p.save(1)
+      
+      get_obj(doc=p).on_update()
+      
+      role = []
+      if cont_det[0]['contact_type'] == 'Individual':
+        role = ['Customer']
+      else:
+        if cont_det[0]['is_customer']:
+          role.append('Customer')
+        if cont_det[0]['is_supplier']:
+          role.append('Supplier')
+        if cont_det[0]['is_sales_partner']:
+          role.append('Partner')
+
+      if role:
+        prof_nm = p.name
+        for i in role:
+          r = Document('UserRole')
+          r.parent = p.name
+          r.role = i
+          r.parenttype = 'Profile'
+          r.parentfield = 'userroles'
+          r.save(1)
+        
+          if i == 'Customer':
+            def_keys = ['from_company','customer_name','customer']
+            def_val = cont_det[0]['customer_name']
+            self.set_default_val(def_keys,def_val,prof_nm)
+
+          if i == 'Supplier':
+            def_keys = ['supplier_name','supplier']
+            def_val = cont_det[0]['supplier_name']
+            self.set_default_val(def_keys,def_val,prof_nm)
+
+      sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
+      sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
+      msgprint('User login is created.')
+      
+ #------set default values---------
+  def set_default_val(self,def_keys,def_val,prof_nm):
+    for d in def_keys:
+      kv = Document('DefaultValue')
+      kv.defkey = d
+      kv.defvalue = def_val
+      kv.parent = prof_nm
+      kv.parenttype = 'Profile'
+      kv.parentfield = 'defaults'
+      kv.save(1)
\ No newline at end of file
diff --git a/setup/doctype/contact_control/contact_control.txt b/setup/doctype/contact_control/contact_control.txt
new file mode 100644
index 0000000..f57d7cf
--- /dev/null
+++ b/setup/doctype/contact_control/contact_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-23 13:32:22', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 25, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Contact Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00411', 'parent': 'Contact Control', 'read': 1, 'create': 0, 'creation': '2009-09-09 12:17:33', 'modified': '2010-08-06 22:02:45', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:02', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Header', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02926', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'header', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:01', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer Intro', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02924', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'customer_intro', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:02', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Supplier Intro', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02925', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'supplier_intro', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/country/__init__.py b/setup/doctype/country/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/country/__init__.py
diff --git a/setup/doctype/country/country.js b/setup/doctype/country/country.js
new file mode 100644
index 0000000..d648a01
--- /dev/null
+++ b/setup/doctype/country/country.js
@@ -0,0 +1,13 @@
+//Tips not required
+/*
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+*/
diff --git a/setup/doctype/country/country.txt b/setup/doctype/country/country.txt
new file mode 100644
index 0000000..ddf0dbd
--- /dev/null
+++ b/setup/doctype/country/country.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-04-24 10:15:27', 'search_fields': '', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:country_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Country', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00501', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2009-11-04 16:20:24', 'modified': '2010-09-20 09:22:06', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00765', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-08 14:09:38', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00829', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:03:22', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00830', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:03:22', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-04-24 10:15:27', 'doctype': 'DocField', 'oldfieldname': 'country_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Country Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Country', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01929', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:22:06', 'parenttype': 'DocType', 'fieldname': 'country_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/currency/__init__.py b/setup/doctype/currency/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/currency/__init__.py
diff --git a/setup/doctype/currency/currency.txt b/setup/doctype/currency/currency.txt
new file mode 100644
index 0000000..25c8c39
--- /dev/null
+++ b/setup/doctype/currency/currency.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-25 10:32:06', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:currency_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Currency', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-18 16:00:32', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00294', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-05-18 12:54:45', 'modified': '2010-11-18 16:00:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00247', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-03-25 10:32:06', 'modified': '2010-11-18 16:00:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00248', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-03-25 10:32:06', 'modified': '2010-11-18 16:00:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01235', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2010-11-18 16:00:32', 'modified': '2010-11-18 16:00:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-25 10:32:06', 'doctype': 'DocField', 'oldfieldname': 'currency_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Currency Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Currency', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01465', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-18 16:00:32', 'parenttype': 'DocType', 'fieldname': 'currency_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/customer_group/__init__.py b/setup/doctype/customer_group/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/customer_group/__init__.py
diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js
new file mode 100644
index 0000000..080b309
--- /dev/null
+++ b/setup/doctype/customer_group/customer_group.js
@@ -0,0 +1,18 @@
+$import(Tips Common)
+
+cur_frm.cscript.onload = function(){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  if(doc.__islocal){
+    doc.parent_customer_group = 'Root';
+    refresh('parent_customer_group');
+  }
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+//get query select Customer Group
+cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY  `tabCustomer Group`.`name` ASC LIMIT 50';
+}
\ No newline at end of file
diff --git a/setup/doctype/customer_group/customer_group.py b/setup/doctype/customer_group/customer_group.py
new file mode 100644
index 0000000..ae74797
--- /dev/null
+++ b/setup/doctype/customer_group/customer_group.py
@@ -0,0 +1,45 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.nsm_parent_field = 'parent_customer_group';
+
+
+  # update Node Set Model
+  def update_nsm_model(self):
+    import webnotes
+    import webnotes.utils.nestedset
+    webnotes.utils.nestedset.update_nsm(self)
+
+  # ON UPDATE
+  #--------------------------------------
+  def on_update(self):
+    # update nsm
+    self.update_nsm_model()   
+
+
+  def validate(self): 
+
+    r = sql("select name from `tabCustomer Group` where name = '%s' and docstatus = 2"%(self.doc.customer_group_name))
+    if r:
+      msgprint("%s record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.customer_group_name))
+      raise Exception
\ No newline at end of file
diff --git a/setup/doctype/customer_group/customer_group.txt b/setup/doctype/customer_group/customer_group.txt
new file mode 100644
index 0000000..989626c
--- /dev/null
+++ b/setup/doctype/customer_group/customer_group.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:56', 'search_fields': 'name,parent_customer_group', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': 1, 'in_create': 1, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 35, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:customer_group_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Customer Group', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00938', 'parent': 'Customer Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:08:32', 'modified': '2010-09-17 14:57:03', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00939', 'parent': 'Customer Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:08:32', 'modified': '2010-09-17 14:57:03', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00955', 'parent': 'Customer Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:10:54', 'modified': '2010-09-17 14:57:03', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00971', 'parent': 'Customer Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:13:26', 'modified': '2010-09-17 14:57:03', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00972', 'parent': 'Customer Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:13:26', 'modified': '2010-09-17 14:57:03', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 5, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00163', 'parent': 'Customer Group', 'read': 1, 'create': 1, 'creation': '2009-03-12 14:13:07', 'modified': '2010-09-17 14:57:03', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Customer Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04837', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:56', 'doctype': 'DocField', 'oldfieldname': 'customer_group_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Customer Group Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Customer Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00768', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'customer_group_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:09:56', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Customer Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00769', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-24 09:32:40', 'doctype': 'DocField', 'oldfieldname': 'parent_customer_group', 'owner': 'nabin@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Parent Customer Group', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Customer Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05420', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'parent_customer_group', 'fieldtype': 'Link', 'options': 'Customer Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-30 10:32:15', 'doctype': 'DocField', 'oldfieldname': 'is_group', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Has Child Node', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Only leaf nodes are allowed in transaction', 'parent': 'Customer Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05496', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'is_group', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2010-06-30 09:55:32', 'doctype': 'DocField', 'oldfieldname': 'lft', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'lft', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Customer Group', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05493', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'lft', 'fieldtype': 'Int', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2010-06-30 09:55:32', 'doctype': 'DocField', 'oldfieldname': 'rgt', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'rgt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Customer Group', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05494', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'rgt', 'fieldtype': 'Int', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-06-30 09:55:32', 'doctype': 'DocField', 'oldfieldname': 'old_parent', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'old_parent', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Customer Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05495', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:03', 'parenttype': 'DocType', 'fieldname': 'old_parent', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/erp_setup/__init__.py b/setup/doctype/erp_setup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/erp_setup/__init__.py
diff --git a/setup/doctype/erp_setup/erp_setup.js b/setup/doctype/erp_setup/erp_setup.js
new file mode 100644
index 0000000..61fd374
--- /dev/null
+++ b/setup/doctype/erp_setup/erp_setup.js
@@ -0,0 +1,3 @@
+cur_frm.cscript['Repost GL'] = function(doc,dt,dn) {
+  $c_obj('GL Control','repost_gl','',function(r,rt) {alert('Done')});
+}
\ No newline at end of file
diff --git a/setup/doctype/erp_setup/erp_setup.py b/setup/doctype/erp_setup/erp_setup.py
new file mode 100644
index 0000000..b0f1474
--- /dev/null
+++ b/setup/doctype/erp_setup/erp_setup.py
@@ -0,0 +1,131 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  def get_bal(self,arg):
+    bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
+    if bal:
+      return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
+    else:
+      return ''
+  
+  def get_series(self):
+    self.doc.clear_table(self.doclist, 'series_details')
+    
+    if self.doc.select_doctype:
+      sr= sql("Select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"%(self.doc.select_doctype))
+      if sr:
+        sr_list=sr[0][0].split("\n")
+        
+        for x in sr_list:
+          if cstr(x)!='':
+            c = addchild(self.doc, 'series_details', 'Series Detail', 1, self.doclist)
+            c.series=cstr(x)
+      
+      else:
+        msgprint("No series is mentioned")
+    else :
+      msgprint("Please select Doctype")
+  
+  def remove_series(self):
+    if not getlist(self.doclist, 'series_details'):
+      msgprint("Please pull already existed series for the selected doctype and check the series that you want to remove")
+    else:
+      sr= sql("Select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"%(self.doc.select_doctype))
+      if sr:
+        sr_list=sr[0][0].split("\n")
+      
+      for d in getlist(self.doclist, 'series_details'):
+        if d.remove == 1:
+          sr_list.remove(d.series)
+      sql("update `tabDocField` set options='%s' where fieldname='voucher_series' and parent='%s'"%("\n".join(sr_list),self.doc.select_doctype))
+      self.get_series()
+
+  def add_series(self):
+    if not self.doc.select_doctype or not self.doc.new_series:
+      msgprint("Please select Doctype and series name for which series will be added")
+      raise Exception
+    else:
+      sr_list = []
+      sr= sql("select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"% (self.doc.select_doctype))
+      if sr[0][0]:
+        sr_list=sr[0][0].split("\n")
+      self.check_duplicate()
+      if not sr_list:
+        sr_list.append('')
+        sr_list.append(self.get_new_series())
+      else:
+        sr_list.append(self.get_new_series())
+      sql("update `tabDocField` set options='%s' where fieldname='voucher_series' and parent='%s'"%("\n".join(sr_list),self.doc.select_doctype))
+      self.get_series()
+      
+  def check_duplicate(self):
+    sr_list = sql("Select options from `tabDocField` where fieldname='voucher_series' group by parent")
+    nw_sr = self.get_new_series()
+    #msgprint(sr_list)
+    for sr in sr_list:
+      if nw_sr in sr[0]:
+        idx=sql("Select current from `tabSeries` where name='%s'"% (nw_sr + '/'))
+        msgprint("Series name already exist with index '%s'" %(idx[0][0]))
+        raise Exception  
+        
+  def get_new_series(self):
+    if 'FY' in cstr((self.doc.new_series).upper()):
+      abb=sql("select abbreviation from `tabFiscal Year` where name='%s'"%(self.doc.current_fiscal_year))
+      if not abb:
+        msgprint("Abbreviation is not mentioned in Fiscal Year")
+        raise Exception
+      else:
+        return cstr((self.doc.new_series).upper()).strip().replace('FY',abb[0][0])
+    else:
+      return cstr((self.doc.new_series).upper()).strip()
+
+  def on_update(self):
+
+    # fiscal year
+    set_default('fiscal_year', self.doc.current_fiscal_year)
+    ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", self.doc.current_fiscal_year, as_dict = 1)
+    set_default('year_start_date', ysd[0]['year_start_date'].strftime('%Y-%m-%d'))
+    set_default('year_end_date', get_last_day(get_first_day(ysd[0]['year_start_date'],0,11)).strftime('%Y-%m-%d'))
+
+    # company
+    set_default('company', self.doc.default_company)
+
+    set_default('stock_valuation', self.doc.stock_valuation or 'Moving Average')
+    set_default('default_currency', self.doc.default_currency or 'INR')
+
+    # Purchase in transit
+    if self.doc.purchase_in_transit_account:
+      set_default('purchase_in_transit_account', self.doc.purchase_in_transit_account)
+  
+  def get_default_bank_account(self, company):
+    return sql("select default_bank_account from tabCompany where name = '%s'" % company)[0][0]
+
+  def get_bank_defaults(self, arg):
+    arg = eval(arg)
+    return {
+      'def_bv_type': self.doc.default_bank_voucher_type or '',
+      'def_bv_series': self.doc.default_bank_voucher_series or '',
+      'def_bank_account': self.get_default_bank_account(arg['company']) or '',
+      'bank_balance': self.get_bal(self.get_default_bank_account(arg['company'])) or 0.0,
+      'acc_balance': self.get_bal(arg['credit_to']) or 0.0
+    }
diff --git a/setup/doctype/erp_setup/erp_setup.txt b/setup/doctype/erp_setup/erp_setup.txt
new file mode 100644
index 0000000..fc7c14f
--- /dev/null
+++ b/setup/doctype/erp_setup/erp_setup.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:04:08', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': 1, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 97, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'ERP Setup', 'idx': None, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00148', 'parent': 'ERP Setup', 'read': 1, 'create': 1, 'creation': '2009-03-12 14:03:17', 'modified': '2010-08-08 15:21:42', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00023', 'parent': 'ERP Setup', 'read': 1, 'create': 1, 'creation': '2009-03-12 12:04:08', 'modified': '2010-08-08 15:21:42', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'nabin@webnotestech.com', 'name': 'PERM00321', 'parent': 'ERP Setup', 'read': 1, 'create': None, 'creation': '2009-06-22 12:28:39', 'modified': '2010-08-08 15:21:42', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 3, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Accounts', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00242', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Default Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00243', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'default_company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Current Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00244', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'current_fiscal_year', 'fieldtype': 'Link', 'options': 'Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Default Bank Account', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00245', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'default_bank_account', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Default Bank Voucher Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00246', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'default_bank_voucher_type', 'fieldtype': 'Select', 'options': 'Bank Voucher\nCash Voucher\nJournal Entry\nCredit Note\nDebit Note\nCredit Card Voucher\nSalary Voucher', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Default Bank Voucher Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00247', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'default_bank_voucher_series', 'fieldtype': 'Select', 'options': 'BV/08-09/\nCV/08-09/\nJV/08-09/\nCN/08-09/\nDN/08-09/\nCC/08-09/\nSV/08-09/', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Default Currency', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00248', 'idx': 7, 'default': 'INR', 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'default_currency', 'fieldtype': 'Select', 'options': 'link:Currency', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Stock Valuation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00249', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'stock_valuation', 'fieldtype': 'Select', 'options': 'Moving Average\nFCFS', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Repost GL', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00250', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-03-12 12:04:08', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': '', 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00251', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Naming Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02322', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Select Doctype', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02323', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'select_doctype', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Get Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02324', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_series', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 17:11:58', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Series Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02332', 'idx': 14, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'series_details', 'fieldtype': 'Table', 'options': 'Series Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Update Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02325', 'idx': 15, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'remove_series', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Add New Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02326', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'New Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02327', 'idx': 17, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': 'new_series', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-06-12 16:42:30', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Add Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ERP Setup', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02328', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-08-08 15:21:42', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'add_series', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/import_data_control/__init__.py b/setup/doctype/import_data_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/import_data_control/__init__.py
diff --git a/setup/doctype/import_data_control/import_data_control.py b/setup/doctype/import_data_control/import_data_control.py
new file mode 100644
index 0000000..b9c98f1
--- /dev/null
+++ b/setup/doctype/import_data_control/import_data_control.py
@@ -0,0 +1,34 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+
+  def get_master_lst(self):
+    
+    return [r[0] for r in sql("select name from `tabDocType` where document_type = 'Master'")]
+
+  def get_child_lst(self,nm):
+    res = [nm]
+    
+    ret=sql("select options from `tabDocField` where parent='%s' and fieldtype = 'Table'"%nm)
+    for r in ret:
+      res.append(r[0])
+    return res
\ No newline at end of file
diff --git a/setup/doctype/import_data_control/import_data_control.txt b/setup/doctype/import_data_control/import_data_control.txt
new file mode 100644
index 0000000..6099670
--- /dev/null
+++ b/setup/doctype/import_data_control/import_data_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-09-17 16:54:59', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Import Data Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-14 12:26:41', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/setup/doctype/item_group/__init__.py b/setup/doctype/item_group/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/item_group/__init__.py
diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js
new file mode 100644
index 0000000..089ba11
--- /dev/null
+++ b/setup/doctype/item_group/item_group.js
@@ -0,0 +1,18 @@
+$import(Tips Common)
+
+cur_frm.cscript.onload = function(){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  if(doc.__islocal){
+    doc.parent_item_group = 'Root';
+    refresh('parent_item_group');
+  }
+}
+
+//get query select item group
+cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND  `tabItem Group`.`docstatus`!= 2 AND (`tabItem Group`.`rgt` > '+doc.rgt+' or `tabItem Group`.`lft` < '+doc.lft+') AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY  `tabItem Group`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py
new file mode 100644
index 0000000..223e53d
--- /dev/null
+++ b/setup/doctype/item_group/item_group.py
@@ -0,0 +1,47 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d,dl
+    self.nsm_parent_field = 'parent_item_group';
+
+  # update Node Set Model
+  def update_nsm_model(self):
+    import webnotes
+    import webnotes.utils.nestedset
+    webnotes.utils.nestedset.update_nsm(self)
+
+  # ON UPDATE
+  #--------------------------------------
+  def on_update(self):
+    # update nsm
+    self.update_nsm_model()   
+
+  def validate(self): 
+    if self.doc.lft and self.doc.rgt:
+      res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name))
+      if not res:
+        msgprint("Please enter proper parent item group.") 
+        raise Exception
+    
+    r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name))
+    if r:
+      msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name))
+      raise Exception
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt
new file mode 100644
index 0000000..f54679b
--- /dev/null
+++ b/setup/doctype/item_group/item_group.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:42', 'search_fields': 'parent_item_group', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 0, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 57, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:item_group_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Item Group', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00876', 'parent': 'Item Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-20 09:45:17', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00877', 'parent': 'Item Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-20 09:45:17', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00901', 'parent': 'Item Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-20 09:45:17', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00902', 'parent': 'Item Group', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-20 09:45:17', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00373', 'parent': 'Item Group', 'read': 1, 'create': 1, 'creation': '2009-08-25 17:00:42', 'modified': '2010-09-20 09:45:17', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00557', 'parent': 'Item Group', 'read': 1, 'create': 1, 'creation': '2009-12-31 12:21:10', 'modified': '2010-09-20 09:45:17', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04850', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:42', 'doctype': 'DocField', 'oldfieldname': 'item_group_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Item Group Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00610', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'item_group_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-09-10 12:08:39', 'doctype': 'DocField', 'oldfieldname': 'show_in_catalogue', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Show in catalogue', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02931', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'show_in_catalogue', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-26 17:09:28', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01479', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-16 10:38:12', 'doctype': 'DocField', 'oldfieldname': 'parent_item_group', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Parent Item Group', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05372', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'parent_item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-17 09:19:13', 'doctype': 'DocField', 'oldfieldname': 'is_group', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Has Child Node', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Only leaf nodes are allowed in transaction', 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05385', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'is_group', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2010-06-16 10:38:12', 'doctype': 'DocField', 'oldfieldname': 'lft', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'lft', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05376', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'lft', 'fieldtype': 'Int', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2010-06-16 10:38:12', 'doctype': 'DocField', 'oldfieldname': 'rgt', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'rgt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05377', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'rgt', 'fieldtype': 'Int', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-06-16 10:38:12', 'doctype': 'DocField', 'oldfieldname': 'old_parent', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'ashwini@webnotestech.com', 'label': 'old_parent', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Item Group', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05378', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-20 09:45:17', 'parenttype': 'DocType', 'fieldname': 'old_parent', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/manage_account/__init__.py b/setup/doctype/manage_account/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/manage_account/__init__.py
diff --git a/setup/doctype/manage_account/manage_account.js b/setup/doctype/manage_account/manage_account.js
new file mode 100644
index 0000000..7c3b193
--- /dev/null
+++ b/setup/doctype/manage_account/manage_account.js
@@ -0,0 +1,6 @@
+// Validate
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+  $c_obj(make_doclist(cdt, cdn), 'update_cp', '', function(r, rt){
+    sys_defaults = r.message;
+  });
+}
\ No newline at end of file
diff --git a/setup/doctype/manage_account/manage_account.py b/setup/doctype/manage_account/manage_account.py
new file mode 100644
index 0000000..a0ed2fa
--- /dev/null
+++ b/setup/doctype/manage_account/manage_account.py
@@ -0,0 +1,65 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cint, cstr, get_defaults, set_default, fmt_money, get_last_day, get_first_day
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+#---------------------------------------------------------------------------------------------------------------------------------------------  
+  def get_bal(self,arg):
+    bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
+    if bal:
+      return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
+
+
+# =========================================================================================================================================
+
+  # Update Default
+  # ---------------
+  def set_system_default(self, defkey, defvalue):
+    set_default(defkey, defvalue)
+
+    if defkey == 'fiscal_year':
+      ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", defvalue)
+      ysd = ysd and ysd[0][0] or ''
+      if ysd:
+        set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
+        set_default('year_end_date', get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
+
+
+  # Update
+  # --------
+  def update_cp(self):
+    def_list = [['fiscal_year',self.doc.current_fiscal_year],
+                ['company',self.doc.default_company],
+                ['currency',self.doc.default_currency],
+                ['price_list_name',self.doc.default_price_list],
+                ['item_group',self.doc.default_item_group],
+                ['customer_group',self.doc.default_customer_group],
+                ['cust_master_name',self.doc.cust_master_name], 
+                ['supplier_type',self.doc.default_supplier_type],
+                ['supp_master_name',self.doc.supp_master_name], 
+                ['territory',self.doc.default_territory],
+                ['stock_uom',self.doc.default_stock_uom],
+                ['fraction_currency',self.doc.default_currency_fraction],
+                ['valuation_method',self.doc.default_valuation_method]]
+
+    for d in def_list:
+      self.set_system_default(d[0],d[1])
+    # Update Currency Format
+	
+    sql("update `tabSingles` set value = '%s' where field = 'currency_format' and doctype = 'Control Panel'" % self.doc.default_currency_format)
+    sql("update `tabSingles` set value = '%s' where field = 'date_format' and doctype = 'Control Panel'" %self.doc.date_format)
+
+
+    return get_defaults()
+
diff --git a/setup/doctype/manage_account/manage_account.txt b/setup/doctype/manage_account/manage_account.txt
new file mode 100644
index 0000000..0332d6b
--- /dev/null
+++ b/setup/doctype/manage_account/manage_account.txt
@@ -0,0 +1,1686 @@
+[
+	{
+		'_last_update': '1305783824',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': 0,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-19 11:16:11',
+		'modified_by': 'Guest',
+		'module': 'Setup',
+		'name': 'Manage Account',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 1,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 514
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': '',
+		'modified': '2010-08-25 12:12:09',
+		'modified_by': 'nabin@webnotestech.com',
+		'name': 'PERM00348',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-25 12:12:09',
+		'modified_by': 'nabin@webnotestech.com',
+		'name': 'PERM00349',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-25 12:12:09',
+		'modified_by': 'nabin@webnotestech.com',
+		'name': 'PERM00350',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-25 12:12:09',
+		'modified_by': 'nabin@webnotestech.com',
+		'name': 'PERM00351',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:09',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-25 12:12:09',
+		'modified_by': 'nabin@webnotestech.com',
+		'name': 'PERM00352',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05014',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Default Company',
+		'modified': '2011-05-25 12:44:24',
+		'modified_by': 'Guest',
+		'name': 'FL01956',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'current_fiscal_year',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Current Fiscal Year',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01957',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'date_format',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Date Format',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01958',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05015',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': 'INR',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Default Currency',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01960',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_currency_format',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Default Currency Format',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01961',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Lacs\nMillions',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-14 11:58:00',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_currency_fraction',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Default Currency Fraction',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': '000002366',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-12-31 17:48:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sms_sender_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'SMS Sender Name',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL04394',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Stock',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05016',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05017',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Default Item Group',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01963',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Item Group',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'IGHelp',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05018',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Item Group\');">To manage Item Groups, click here</a>',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_stock_uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Default Stock UOM',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01965',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'UOM',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_valuation_method',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Default Valuation Method',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01966',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'FIFO\nMoving Average',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_warehouse_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Default Warehouse Type',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01967',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Warehouse Type',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05019',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Percentage you are allowed to receive or deliver more against the quantity ordered. <p>For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units</p>',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tolerance',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Allowance Percent',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01968',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': 'Stock level frozen up to this date, nobody can do / modify entry except authorized person',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_frozen_upto',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Stock Frozen Upto',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05010',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': 'Users with this role are allowed to do / modify stock entry before frozen date',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'stock_auth_role',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Authorized Role (Frozen Entry)',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05011',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Role',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Accounts',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05020',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Accounting entry frozen up to this date, nobody can do / modify entry except authorized person',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'acc_frozen_upto',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Accounts Frozen Upto',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01970',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Users with this role are allowed to do / modify accounting entry before frozen date',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'bde_auth_role',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Authourized Role (Frozen Entry)',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01971',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Role',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_controller',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Credit Controller',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01972',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Role',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Selling',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05021',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-24 14:45:43',
+		'default': 'Customer Name',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cust_master_name',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Customer Master created by ',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL03773',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Name\nNaming Series',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_customer_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Default Customer Group',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01974',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer Group',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'CGHelp',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05022',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Customer Group\');">To manage Customer Groups, click here</a>',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Default Territory',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01976',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'TerritoryHelp',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05023',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_price_list',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Default Price List',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01978',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Price List',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05024',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'so_required',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Sales Order Required',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01980',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'No\nYes',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'dn_required',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Delivery Note Required',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01981',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'No\nYes',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Buying',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05025',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'default_supplier_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Default Supplier Type',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01983',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Supplier Type',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-24 14:45:43',
+		'default': 'Supplier Name',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supp_master_name',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Supplier Master created by ',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL03774',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Supplier Name\nNaming Series',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05026',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_required',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Purchase Order Required',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01985',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'No\nYes',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': 'No',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pr_required',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Purchase Receipt Required',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01986',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'No\nYes',
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'HR',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL05027',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<div style="padding-top: 8px;" class="columnHeading">HR</div>',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:09',
+		'default': None,
+		'depends_on': None,
+		'description': 'Employee record is created using selected field. ',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'emp_created_by',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'Employee Records to be created by ',
+		'modified': '2011-05-25 12:44:25',
+		'modified_by': 'Guest',
+		'name': 'FL01988',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nNaming Series\nEmployee Number',
+		'owner': 'Administrator',
+		'parent': 'Manage Account',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/market_segment/__init__.py b/setup/doctype/market_segment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/market_segment/__init__.py
diff --git a/setup/doctype/market_segment/market_segment.txt b/setup/doctype/market_segment/market_segment.txt
new file mode 100644
index 0000000..e531282
--- /dev/null
+++ b/setup/doctype/market_segment/market_segment.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:00', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:segment_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Market Segment', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': 'Title Case', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04852', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:00', 'doctype': 'DocField', 'oldfieldname': 'segment_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Segment Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00912', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'segment_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:10:00', 'doctype': 'DocField', 'oldfieldname': 'details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00913', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'details', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/naming_series_options/__init__.py b/setup/doctype/naming_series_options/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/naming_series_options/__init__.py
diff --git a/setup/doctype/naming_series_options/naming_series_options.txt b/setup/doctype/naming_series_options/naming_series_options.txt
new file mode 100644
index 0000000..21f3f29
--- /dev/null
+++ b/setup/doctype/naming_series_options/naming_series_options.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-16 12:55:19', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': '__NSO.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Naming Series Options', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01027', 'parent': 'Naming Series Options', 'read': 1, 'create': None, 'creation': '2010-06-03 11:30:14', 'modified': '2010-06-03 11:40:21', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-16 12:55:19', 'doctype': 'DocField', 'oldfieldname': 'doc_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Doc Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series Options', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04662', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-03 11:40:21', 'parenttype': 'DocType', 'fieldname': 'doc_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-16 12:55:19', 'doctype': 'DocField', 'oldfieldname': 'series_options', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series Options', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series Options', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04663', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-03 11:40:21', 'parenttype': 'DocType', 'fieldname': 'series_options', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/order_lost_reason/__init__.py b/setup/doctype/order_lost_reason/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/order_lost_reason/__init__.py
diff --git a/setup/doctype/order_lost_reason/order_lost_reason.js b/setup/doctype/order_lost_reason/order_lost_reason.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/order_lost_reason/order_lost_reason.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/order_lost_reason/order_lost_reason.txt b/setup/doctype/order_lost_reason/order_lost_reason.txt
new file mode 100644
index 0000000..87fcf72
--- /dev/null
+++ b/setup/doctype/order_lost_reason/order_lost_reason.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-07 10:35:41', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:order_lost_reason', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Order Lost Reason', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00344', 'parent': 'Order Lost Reason', 'read': 1, 'create': 1, 'creation': '2009-07-07 10:35:41', 'modified': '2010-09-20 09:51:33', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00555', 'parent': 'Order Lost Reason', 'read': 1, 'create': 1, 'creation': '2009-12-31 12:18:01', 'modified': '2010-09-20 09:51:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Order Lost Reason', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04854', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:33', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-07-07 10:35:41', 'doctype': 'DocField', 'oldfieldname': 'order_lost_reason', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Order Lost Reason', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Order Lost Reason', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02544', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:33', 'parenttype': 'DocType', 'fieldname': 'order_lost_reason', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/other_charges/__init__.py b/setup/doctype/other_charges/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/other_charges/__init__.py
diff --git a/setup/doctype/other_charges/other_charges.comp.js b/setup/doctype/other_charges/other_charges.comp.js
new file mode 100644
index 0000000..403a4ce
--- /dev/null
+++ b/setup/doctype/other_charges/other_charges.comp.js
@@ -0,0 +1,29 @@
+
+cur_frm.cscript.onload=function(doc,cdt,cdn){}
+cur_frm.pformat.other_charges=function(doc){var make_row=function(title,val,bold){var bstart='<b>';var bend='</b>';return'<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
++'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
++'<td style="width:25%;text-align:right;">'+val+'</td>'
++'</tr>'}
+function convert_rate(val){var new_val=flt(val)/flt(doc.conversion_rate);return new_val;}
+out='';if(!doc.print_without_amount){var cl=getchildren('RV Tax Detail',doc.name,'other_charges');var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';out+='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);if(cl.length){for(var i=0;i<cl.length;i++){if(fmt_money(convert_rate(cl[i].tax_amount))!=0)
+out+=make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);}}
+out+=make_row('Grand Total',fmt_money(doc.grand_total_export),1)+make_row('Rounded Total',fmt_money(doc.rounded_total_export),1)
+if(doc.in_words_export){out+='</table></td></tr>';out+='<tr><td colspan = "2">';out+='<table><tr><td style="width:25%;"><b>In Words</b></td>'
+out+='<td style="width:50%;">'+doc.in_words_export+'</td></tr>'}
+out+='</table></td></tr></table></div>';}
+return out;}
+cur_frm.cscript.charge_type=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.idx==1&&(d.charge_type=='On Previous Row Amount'||d.charge_type=='On Previous Row Total')){alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");d.charge_type='';}
+validated=false;refresh_field('charge_type',d.name,'other_charges');cur_frm.cscript.row_id(doc,cdt,cdn);cur_frm.cscript.rate(doc,cdt,cdn);cur_frm.cscript.tax_amount(doc,cdt,cdn);}
+cur_frm.cscript.row_id=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.row_id){alert("Please select Charge Type first");d.row_id='';}
+else if((d.charge_type=='Actual'||d.charge_type=='On Net Total')&&d.row_id){alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");d.row_id='';}
+else if((d.charge_type=='On Previous Row Amount'||d.charge_type=='On Previous Row Total')&&d.row_id){if(d.row_id>=d.idx){alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");d.row_id='';}}
+validated=false;refresh_field('row_id',d.name,'other_charges');}
+cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query=function(doc,cdt,cdn){return'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND  tabAccount.name LIKE "%s"'}
+cur_frm.cscript.account_head=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.account_head){alert("Please select Charge Type first");validated=false;d.account_head='';}
+else if(d.account_head&&d.charge_type){arg="{'charge_type' : '"+d.charge_type+"', 'account_head' : '"+d.account_head+"'}";get_server_fields('get_rate',arg,'other_charges',doc,cdt,cdn,1);}
+refresh_field('account_head',d.name,'other_charges');}
+cur_frm.cscript.rate=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.rate){alert("Please select Charge Type first");d.rate='';}
+validated=false;refresh_field('rate',d.name,'other_charges');}
+cur_frm.cscript.tax_amount=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.tax_amount){alert("Please select Charge Type first");d.tax_amount='';}
+else if(d.charge_type&&d.tax_amount){alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");d.tax_amount='';}
+validated=false;refresh_field('tax_amount',d.name,'other_charges');}
\ No newline at end of file
diff --git a/setup/doctype/other_charges/other_charges.js b/setup/doctype/other_charges/other_charges.js
new file mode 100644
index 0000000..913b75f
--- /dev/null
+++ b/setup/doctype/other_charges/other_charges.js
@@ -0,0 +1,139 @@
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  //cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+/*cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}*/
+
+// For customizing print
+
+cur_frm.pformat.other_charges= function(doc){
+  //function to make row of table
+  var make_row = function(title,val,bold){
+    var bstart = '<b>'; var bend = '</b>';
+    return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+     +'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
+     +'<td style="width:25%;text-align:right;">'+val+'</td>'
+     +'</tr>'
+  }
+
+  function convert_rate(val){
+    var new_val = flt(val)/flt(doc.conversion_rate);
+    return new_val;
+  }
+  out ='';
+  if (!doc.print_without_amount) {
+    var cl = getchildren('RV Tax Detail',doc.name,'other_charges');
+
+    // outer table  
+    var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
+    
+    // main table
+    out +='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
+
+    // add rows
+    if(cl.length){
+      for(var i=0;i<cl.length;i++){
+        if(fmt_money(convert_rate(cl[i].tax_amount))!=0)
+          out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
+      }
+    }
+  
+    // grand total
+    out +=make_row('Grand Total',fmt_money(doc.grand_total_export),1) +make_row('Rounded Total',fmt_money(doc.rounded_total_export),1)
+    if(doc.in_words_export){
+      out +='</table></td></tr>';
+      out += '<tr><td colspan = "2">';
+      out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'
+      out+= '<td style="width:50%;">'+doc.in_words_export+'</td></tr>'
+    }
+    out +='</table></td></tr></table></div>';   
+  }
+  return out;
+}
+
+cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
+    alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
+    d.charge_type = '';
+  }
+  validated = false;
+  refresh_field('charge_type',d.name,'other_charges');
+  cur_frm.cscript.row_id(doc, cdt, cdn);
+  cur_frm.cscript.rate(doc, cdt, cdn);
+  cur_frm.cscript.tax_amount(doc, cdt, cdn);
+}
+
+cur_frm.cscript.row_id = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.row_id){
+    alert("Please select Charge Type first");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
+    alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
+    if(d.row_id >= d.idx){
+      alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
+      d.row_id = '';
+    }
+  }
+  validated = false;
+  refresh_field('row_id',d.name,'other_charges');
+}
+
+/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
+
+cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND  tabAccount.name LIKE "%s"'
+}
+
+//--------------------filter other charges master company-wise-----------------------------------------
+/*
+cur_frm.fields_dict.charge.get_query = function(doc) {
+  return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.name LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
+}
+*/
+
+cur_frm.cscript.account_head = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.account_head){
+    alert("Please select Charge Type first");
+    validated = false;
+    d.account_head = '';
+  }
+  else if(d.account_head && d.charge_type) {
+    arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
+    get_server_fields('get_rate', arg, 'other_charges', doc, cdt, cdn, 1);
+  }
+  refresh_field('account_head',d.name,'other_charges');
+}
+
+cur_frm.cscript.rate = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.rate) {
+    alert("Please select Charge Type first");
+    d.rate = '';
+  }
+  validated = false;
+  refresh_field('rate',d.name,'other_charges');
+}
+
+cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.tax_amount){
+    alert("Please select Charge Type first");
+    d.tax_amount = '';
+  }
+  else if(d.charge_type && d.tax_amount) {
+    alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
+    d.tax_amount = '';
+  }
+  validated = false;
+  refresh_field('tax_amount',d.name,'other_charges');
+}
diff --git a/setup/doctype/other_charges/other_charges.py b/setup/doctype/other_charges/other_charges.py
new file mode 100644
index 0000000..b8b9189
--- /dev/null
+++ b/setup/doctype/other_charges/other_charges.py
@@ -0,0 +1,34 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Get Tax Rate if account type is Tax
+  # ===================================================================
+  def get_rate(self, arg):
+    get_obj('Sales Common').get_rate(arg, self)
+
+  def update_other_default_charges(self):
+    sql("update `tabOther Charges` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company))
+
+  def on_update(self):
+    self.update_other_default_charges()
diff --git a/setup/doctype/other_charges/other_charges.txt b/setup/doctype/other_charges/other_charges.txt
new file mode 100644
index 0000000..17d3e4d
--- /dev/null
+++ b/setup/doctype/other_charges/other_charges.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2010-12-08 15:42:09', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': None, 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 68, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Other Charges', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2011-01-07 11:04:07', 'server_code_error': ' ', 'name_case': None, 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00264', 'parent': 'Other Charges', 'read': 1, 'create': 0, 'creation': '2010-12-08 15:42:09', 'modified': '2011-01-07 11:04:07', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00265', 'parent': 'Other Charges', 'read': 1, 'create': 0, 'creation': '2010-12-08 15:42:09', 'modified': '2011-01-07 11:04:07', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00266', 'parent': 'Other Charges', 'read': 1, 'create': 0, 'creation': '2010-12-08 15:42:09', 'modified': '2011-01-07 11:04:07', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00267', 'parent': 'Other Charges', 'read': 1, 'create': 1, 'creation': '2010-12-08 15:42:09', 'modified': '2011-01-07 11:04:07', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00268', 'parent': 'Other Charges', 'read': 1, 'create': 1, 'creation': '2010-12-08 15:42:09', 'modified': '2011-01-07 11:04:07', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00269', 'parent': 'Other Charges', 'read': 1, 'create': 1, 'creation': '2010-12-08 15:42:09', 'modified': '2011-01-07 11:04:07', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-12-08 15:42:09', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Other Charges', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01785', 'idx': 1, 'default': None, 'colour': None, 'modified': '2011-01-07 11:04:07', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-12-08 15:42:09', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Other Charges Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Charges', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01786', 'idx': 2, 'default': None, 'colour': None, 'modified': '2011-01-07 11:04:07', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-12-08 15:42:09', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Charges', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01787', 'idx': 3, 'default': None, 'colour': None, 'modified': '2011-01-07 11:04:07', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-06 14:27:42', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Default', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Charges', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03934', 'idx': 4, 'default': None, 'colour': None, 'modified': '2011-01-07 11:04:07', 'parenttype': 'DocType', 'fieldname': 'is_default', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-12-08 15:42:09', 'doctype': 'DocField', 'oldfieldname': 'other_charges', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Other Charges', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Charges', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01789', 'idx': 5, 'default': None, 'colour': None, 'modified': '2011-01-07 11:04:07', 'parenttype': 'DocType', 'fieldname': 'other_charges', 'fieldtype': 'Table', 'options': 'RV Tax Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-12-08 15:42:09', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Other Charges', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01788', 'idx': 6, 'default': None, 'colour': None, 'modified': '2011-01-07 11:04:07', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/period/__init__.py b/setup/doctype/period/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/period/__init__.py
diff --git a/setup/doctype/period/period.js b/setup/doctype/period/period.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/period/period.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/period/period.txt b/setup/doctype/period/period.txt
new file mode 100644
index 0000000..c1ec071
--- /dev/null
+++ b/setup/doctype/period/period.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-27 12:39:33', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', 'in_dialog': None, 'in_create': 1, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:period_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Period', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01015', 'parent': 'Period', 'read': 1, 'create': None, 'creation': '2010-05-27 12:39:33', 'modified': '2010-09-20 09:52:50', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01016', 'parent': 'Period', 'read': 1, 'create': None, 'creation': '2010-05-27 12:39:33', 'modified': '2010-09-20 09:52:50', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-27 12:46:35', 'doctype': 'DocField', 'oldfieldname': 'period_name', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Period Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05083', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:52:50', 'parenttype': 'DocType', 'fieldname': 'period_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-05-27 12:46:35', 'doctype': 'DocField', 'oldfieldname': 'start_date', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Start Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05084', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:52:50', 'parenttype': 'DocType', 'fieldname': 'start_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-05-27 12:46:35', 'doctype': 'DocField', 'oldfieldname': 'end_date', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'End Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05085', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:52:50', 'parenttype': 'DocType', 'fieldname': 'end_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-27 12:46:35', 'doctype': 'DocField', 'oldfieldname': 'period_type', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Period Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05086', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-20 09:52:50', 'parenttype': 'DocType', 'fieldname': 'period_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-05-27 12:46:35', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Period', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05087', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-20 09:52:50', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/period_control/__init__.py b/setup/doctype/period_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/period_control/__init__.py
diff --git a/setup/doctype/period_control/period_control.py b/setup/doctype/period_control/period_control.py
new file mode 100644
index 0000000..a14f133
--- /dev/null
+++ b/setup/doctype/period_control/period_control.py
@@ -0,0 +1,61 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc, self.doclist = d, dl
+    
+  # Generate Periods
+  #------------------		
+  def generate_periods(self, fy):
+    ml = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')    
+
+    import webnotes.utils
+    from dateutil.relativedelta import relativedelta
+    
+    
+    if not sql("select name from `tabPeriod` where fiscal_year = '%s'" % fy):
+      ysd = sql("select year_start_date from `tabFiscal Year` where name = '%s'"%fy)[0][0]
+      
+      #create period as fiscal year record name
+      #----------------------------------------------
+      arg = {'pn':fy,'sd':ysd,'ed':webnotes.utils.get_last_day(ysd + relativedelta(months=11)).strftime('%Y-%m-%d'),'pt':'Year','fy':fy}
+      self.create_period(arg)
+            
+      for i in range(12):    
+        msd = ysd + relativedelta(months=i)
+
+        arg = {'pn':ml[cint(msd.strftime('%m'))-1] + ' ' + msd.strftime('%Y'),'sd':msd.strftime('%Y-%m-%d'),'ed':webnotes.utils.get_last_day(msd).strftime('%Y-%m-%d'),'pt':'Month','fy':fy}
+        self.create_period(arg)
+          
+  #---------------------------------------------------------
+  #create period common function        
+  def create_period(self,arg):
+    p = Document('Period')
+    p.period_name = arg['pn']
+    p.start_date = arg['sd']
+    p.end_date = arg['ed']
+    p.period_type = arg['pt']
+    p.fiscal_year = arg['fy']
+
+    try:        
+      p.save(1)  
+    except NameError, e:
+      msgprint('Period %s already exists' % p.period_name)
+      raise Exception
\ No newline at end of file
diff --git a/setup/doctype/period_control/period_control.txt b/setup/doctype/period_control/period_control.txt
new file mode 100644
index 0000000..c4cf440
--- /dev/null
+++ b/setup/doctype/period_control/period_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-27 12:47:10', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 36, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Period Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/setup/doctype/personalize/__init__.py b/setup/doctype/personalize/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/personalize/__init__.py
diff --git a/setup/doctype/personalize/personalize.py b/setup/doctype/personalize/personalize.py
new file mode 100644
index 0000000..6a15102
--- /dev/null
+++ b/setup/doctype/personalize/personalize.py
@@ -0,0 +1,31 @@
+import webnotes
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+	
+	#
+	# load current banner
+	#
+	def onload(self):
+		self.doc.header_html = webnotes.conn.get_value('Control Panel', None, 'client_name')
+	
+	#
+	# on update
+	#
+	def validate(self):
+		if self.doc.file_list and self.doc.set_from_attachment:
+			self.set_html_from_image()
+
+		# update control panel - so it loads new letter directly
+		webnotes.conn.set_value('Control Panel', None, 'client_name', self.doc.header_html)
+		 
+		# clear the cache so that the new letter head is uploaded
+		webnotes.conn.sql("delete from __SessionCache")
+
+	#
+	# set html for image
+	#
+	def set_html_from_image(self):
+		file_name = self.doc.file_list.split(',')[0]
+		self.doc.header_html = '<div><img src="cgi-bin/getfile.cgi?name=' + file_name + '"/></div>'
diff --git a/setup/doctype/personalize/personalize.txt b/setup/doctype/personalize/personalize.txt
new file mode 100644
index 0000000..4270c47
--- /dev/null
+++ b/setup/doctype/personalize/personalize.txt
@@ -0,0 +1,196 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': 1,
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 10:50:47',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Other',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': 1,
+		'menu_index': None,
+		'modified': '2011-03-17 12:20:29',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'Personalize',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': None,
+		'smallicon': None,
+		'use_template': None,
+		'version': 4
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Help HTML',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000158',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<div class="help_box">You can edit HTML for your banner or add an attachment and click on "Set from Attachment"</div>',
+		'owner': 'Administrator',
+		'parent': 'Personalize',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'header_html',
+		'fieldtype': 'Code',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Banner HTML',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000159',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Personalize',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'set_from_attachment',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Set from attachment',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000160',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Personalize',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 10:50:47',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2011-05-09 10:50:47',
+		'modified_by': 'Administrator',
+		'name': '000000161',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Personalize',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/price_list/__init__.py b/setup/doctype/price_list/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/price_list/__init__.py
diff --git a/setup/doctype/price_list/price_list.js b/setup/doctype/price_list/price_list.js
new file mode 100644
index 0000000..2eeab84
--- /dev/null
+++ b/setup/doctype/price_list/price_list.js
@@ -0,0 +1,21 @@
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+	if(doc.__islocal) {
+		set_field_options('Price Help', ''); return;
+	}
+	if(!doc.file_list) {
+		set_field_options('Price Help', '<div class="help_box">To upload a price list, please attach a (.csv) file with 3 columns - <b>Item Code, Price and Currency</b> (no headings necessary). See attachments box in the right column</div>')
+	} else {
+		set_field_options('Price Help', '<div class="help_box">To update prices from the attachment, please click on "Update Prices"</div>')
+	}
+}
+
+cur_frm.cscript['Clear Prices'] = function(doc, cdt, cdn) {
+	if(confirm("This action will clear all rates for '"+ doc.name +"' from the Item Master and cannot be un-done. Are you sure you want to continue?")) {
+		$c_obj([doc], 'clear_prices', '', function(r, rt) { });
+	}
+}
diff --git a/setup/doctype/price_list/price_list.py b/setup/doctype/price_list/price_list.py
new file mode 100644
index 0000000..23a43e7
--- /dev/null
+++ b/setup/doctype/price_list/price_list.py
@@ -0,0 +1,92 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+		self.cl = []
+	
+	# validate currency
+	def is_currency_valid(self, currency):
+		if currency in self.cl:
+			return 1
+			
+		if sql("select name from tabCurrency where name=%s", currency):
+			self.cl.append(currency)
+			return 1
+		else:
+			return 0
+	
+	# update prices in Price List
+	def update_prices(self):
+		import csv 
+		data = csv.reader(self.get_csv_data().splitlines())
+				
+		updated = 0
+		
+		for line in data:
+			if len(line)==3:
+				# if item exists
+				if sql("select name from tabItem where name=%s", line[0]):
+					if self.is_currency_valid(line[2]):
+						# if price exists
+						ref_ret_detail = sql("select name from `tabRef Rate Detail` where parent=%s and price_list_name=%s and ref_currency=%s", \
+							(line[0], self.doc.name, line[2]))
+						if ref_ret_detail:
+							sql("update `tabRef Rate Detail` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
+						else:
+							d = Document('Ref Rate Detail')
+							d.parent = line[0]
+							d.parentfield = 'ref_rate_details'
+							d.parenttype = 'Item'
+							d.price_list_name = self.doc.name
+							d.ref_rate = line[1]
+							d.ref_currency = line[2]
+							d.save(1)
+						updated += 1
+					else:
+						msgprint("[Ignored] Unknown currency '%s' for Item '%s'" % (line[2], line[0]))
+				else:
+					msgprint("[Ignored] Did not find Item '%s'" % line[1])
+			else:
+				msgprint("[Ignored] Incorrect format: %s" % str(line))
+		
+		msgprint("<b>%s</b> items updated" % updated)
+
+	# clear prices
+	def clear_prices(self):
+		cnt = sql("select count(*) from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
+		sql("delete from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
+		msgprint("%s prices cleared" % cnt[0][0])
+
+	# Update CSV data
+	def get_csv_data(self):
+		if not self.doc.file_list:
+		  msgprint("File not attached!")
+		  raise Exception
+
+		fid = self.doc.file_list.split(',')[1]
+		  
+		from webnotes.utils import file_manager
+		fn, content = file_manager.get_file(fid)
+		
+		if not type(content) == str:
+		  content = content.tostring()
+
+		return content	
\ No newline at end of file
diff --git a/setup/doctype/price_list/price_list.txt b/setup/doctype/price_list/price_list.txt
new file mode 100644
index 0000000..e303d51
--- /dev/null
+++ b/setup/doctype/price_list/price_list.txt
@@ -0,0 +1,380 @@
+[
+	{
+		'allow_attach': 1,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:price_list_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:13',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-18 10:01:48',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'Price List',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 6
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:13',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00392',
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:13',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00393',
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:13',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00394',
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:13',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00395',
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:13',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': '',
+		'modified': '2010-08-08 17:09:13',
+		'modified_by': 'Administrator',
+		'name': 'PERM00396',
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-04-18 13:55:33',
+		'modified_by': 'Administrator',
+		'name': 'FL02242',
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'price_list_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Price List Name',
+		'modified': '2011-04-18 13:55:33',
+		'modified_by': 'Administrator',
+		'name': 'FL02243',
+		'no_copy': None,
+		'oldfieldname': 'price_list_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-18 13:55:34',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Price Help',
+		'modified': '2011-04-18 13:55:34',
+		'modified_by': 'Administrator',
+		'name': '000000143',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-18 13:55:33',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': 'Click on this button to clear prices for this list in all items',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Clear Prices',
+		'modified': '2011-04-18 13:55:33',
+		'modified_by': 'Administrator',
+		'name': '000000140',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-18 13:55:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2011-04-18 13:55:34',
+		'modified_by': 'Administrator',
+		'name': '000000141',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-18 13:55:34',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': 'Update prices from the attachment',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Update Prices',
+		'modified': '2011-04-18 13:55:34',
+		'modified_by': 'Administrator',
+		'name': '000000142',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'update_prices',
+		'owner': 'Administrator',
+		'parent': 'Price List',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Server',
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/sales_browser_control/__init__.py b/setup/doctype/sales_browser_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/sales_browser_control/__init__.py
diff --git a/setup/doctype/sales_browser_control/sales_browser_control.py b/setup/doctype/sales_browser_control/sales_browser_control.py
new file mode 100644
index 0000000..d4c4a13
--- /dev/null
+++ b/setup/doctype/sales_browser_control/sales_browser_control.py
@@ -0,0 +1,215 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+ 
+  #=============================================================================================
+  def get_record_list(self,arg):
+
+    parent, type = arg.split(',')
+    pt_col = "parent_"+type.replace(' ','_').lower()
+   
+    cl = sql("select name,is_group from `tab%s` where docstatus != 2 and %s ='%s' order by is_group desc"%(type,pt_col,parent),as_dict=1)
+
+    return {'parent':parent, 'cl':cl}
+
+  #=============================================================================================  
+  # --------get root level records like all territories, all sales person etc---------  
+  def get_fl_node(self,arg):
+
+    pt_col = "parent_"+arg.replace(' ','_').lower()
+    cl = sql("select name,is_group from `tab%s` where docstatus !=2 and %s=''"%(arg,pt_col),as_dict=1)
+    return {'cl':cl}
+
+  #=============================================================================================
+  def add_node(self,arg):
+    arg = eval(arg)
+    node_title = arg['node_title']
+    n = Document(node_title)
+    for d in arg.keys():
+      if d != 'node_title':
+        n.fields[d]=arg[d]
+    n.old_parent = ''      
+    n_obj = get_obj(doc=n)
+
+    n_obj.validate()
+
+    n_obj.doc.save(1)
+
+    n_obj.on_update()
+
+    return n_obj.doc.name
+      
+  #=============================================================================================
+  def trash_record(self,arg):  
+    name,type = arg.split(',')
+    
+    #validation for trash of default record
+    if not type == 'Sales Person':
+      field = 'default_'+type.lower().replace(' ','_')
+      chk = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s' and value = '%s'"%(field,name))
+      if chk:
+        msgprint("'%s' record is set as a default %s in Global Defaults. Please change default %s then try to trash '%s' record."%(name,type.lower(), type.lower(), name))
+        raise Exception
+    
+    
+    res = sql("select t1.name from `tab%s` t1, `tab%s` t2 where t1.lft > t2.lft and t1.rgt < t2.rgt and t1.docstatus != 2 and t2.name = '%s'"%(type,type,name))
+    if res:
+      msgprint("You can not trashed %s as it contains other nodes."%name)
+      raise Exception
+      
+
+    sql("update `tab%s` set docstatus = 2 where name = '%s'"%(type,name))
+
+  #=============================================================================================    
+  def get_parent_lst(self,type):
+    par_lst = [r[0] for r in sql("select name from `tab%s` where is_group = 'Yes' and docstatus != 2"%type)]
+    return par_lst
+ 
+  #=============================================================================================
+  def get_record(self,arg):
+
+    name, type = arg.split(',')
+
+    dict1 = {'Territory':'parent_territory','Customer Group':'parent_customer_group','Item Group':'parent_item_group','Sales Person':'parent_sales_person'}
+    
+    parent_name = dict1[type]
+    
+    query ="select name,"+dict1[type]+",is_group,rgt,lft from `tab"+cstr(type)+"` where name = '%s'"
+  
+    sv = sql(query%(cstr(name)))
+ 
+ 
+    par_lst = [r[0] for r in sql("select distinct name from `tab"+cstr(type)+"` where docstatus !=2 and (rgt > %s or lft < %s) and is_group='Yes'"%(sv[0][3],sv[0][4]))]
+ 
+    dict2 = {}
+    dict2['name']=sv[0][0]
+    dict2['parent']=cstr(sv[0][1])
+    dict2['parent_lst']=par_lst
+    dict2['is_group']=sv[0][2]
+
+    return dict2
+    
+  #=============================================================================================
+  def edit_node(self,arg):
+    arg = eval(arg)
+    nt = arg['node_title']
+
+    nm = nt == 'Territory' and arg['territory_name'] or nt == 'Sales Person' and arg['sales_person_name'] or nt=='Item Group' and arg['item_group_name'] or nt =='Customer Group' and arg['customer_group_name'] or ''
+    
+    n_obj = get_obj(nt,nm) 
+    for d in arg.keys():
+      if d != 'node_title':
+        n_obj.doc.fields[d]=arg[d]
+   
+    n_obj.doc.save()
+    n_obj.on_update()
+   
+  
+  #=============== validation ======================================================================================
+
+  def mvalidate(self,args):
+
+    r = eval(args)
+    
+    if r['lft'] == 0:
+      n = sql("select lft,rgt from `tab%s` where name = '%s'"%(r['node_title'],r['nm']))
+      r['lft'] = n[0][0]
+      r['rgt'] = n[0][1]
+    
+    if r['action'] == 'Update':
+      #-----------------validate if current node has child node----------------------------------
+      v1 = self.val_group(r) 
+      if v1 == 'true': return 'true' 
+
+      
+      #-------------------validation for parent sales person cannot be his child node------------
+      v1 = self.val_prt(r) 
+      if v1 == 'true': return 'true'     
+      
+      #--------if current record has set as default record in manage account then should not allow to change 'has child node' to 'yes'
+      v1 = self.group_changed(r) 
+      if v1 == 'true': return 'true'     
+      
+    elif r['action'] == 'Create':
+      #-------------------validation - record is already exist--------------------------------
+      v1 = self.duplicate_rcd(r)
+
+      if v1 == 'true': return 'true' 
+      
+      #-------------------------------------------------
+      v1 = self.trash_rcd(r)
+      if v1 == 'true': return 'true' 
+
+    return 'false'     
+  #-----------------validate if current node has child node----------------------------------
+  #------------------if yes then cannot change current node from group to leaf
+  #ON EDIT
+  def val_group(self,r):
+    if r['is_group'] == 'No':
+      ch = sql("select name from `tab%s` where lft>%s and rgt<%s and docstatus != 2"%(r['node_title'],r['lft'],r['rgt']))
+      if ch:
+        msgprint("You can not changed %s from group to leaf node as it contains other nodes."%r['nm'])    
+        return 'true'
+    return 'false'  
+    
+   #-------------------validation for parent sales person cannot be his child node-------------               
+   #ON EDIT
+  def val_prt(self,r):
+    res = sql("select name from `tab%s` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(r['node_title'],r['rgt'],r['lft'],r['parent_nm'],r['nm']))
+
+    if not res:
+      msgprint("Please enter parent %s."%(r['node_title'])) 
+      return 'true'
+    return 'false'
+      
+  #--------if current record has set as default record then not allowed to changed 'has child node' to 'yes'--------------------      
+  #--------------------------------------------------------
+  #ON EDIT
+  def group_changed(self,r):
+
+    if r['node_title']  != 'Sales Person' and r['is_group'] == 'Yes':
+      field = 'default_'+r['node_title'].lower().replace(' ','_')
+      res = sql("select value from `tabSingles` where field = '%s' and value = '%s'"%(field,r['nm']))
+      if res:
+        msgprint("'%s' record is set as default record in Global Defaults.'Has Child Node' field cannot be changed to 'Yes' as only leaf nodes are allowed in transaction."%(r['nm']))
+        return 'true'
+      
+    return 'false'
+  #-------------------validation - record is already exist--------------------------------
+  #ON CREATE
+  def trash_rcd(self,r):
+    res = sql("select name from `tab%s` where name = '%s' and docstatus = 2"%(r['node_title'],r['nm']))
+    if res:
+      msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(r['nm']))
+      return 'true'
+
+    return 'false'
+
+  #----------------------------------------------------------------  
+  #ON CREATE
+  def duplicate_rcd(self,r):
+    res = sql("select name from `tab%s` where name = '%s' and docstatus != 2"%(r['node_title'],r['nm']))
+    if res:
+      msgprint("'%s' record is already exist."%(r['nm']))
+      return 'true'
+    return 'false'      
\ No newline at end of file
diff --git a/setup/doctype/sales_browser_control/sales_browser_control.txt b/setup/doctype/sales_browser_control/sales_browser_control.txt
new file mode 100644
index 0000000..8ab44e1
--- /dev/null
+++ b/setup/doctype/sales_browser_control/sales_browser_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-17 15:07:09', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 157, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Sales Browser Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/setup/doctype/sales_partner/__init__.py b/setup/doctype/sales_partner/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/sales_partner/__init__.py
diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js
new file mode 100644
index 0000000..e829e29
--- /dev/null
+++ b/setup/doctype/sales_partner/sales_partner.js
@@ -0,0 +1,148 @@
+$import(Contact Control)
+
+cur_frm.cscript.onload = function(doc,dt,dn){
+	// history doctypes and scripts
+	cur_frm.history_dict = {
+		'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)',
+		'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)',
+		'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)'
+	}
+	
+	// make contact, history list body
+	//cur_frm.cscript.make_cl_body();
+	cur_frm.cscript.make_hl_body();
+}
+
+cur_frm.cscript.refresh = function(doc,dt,dn){  
+  
+	if(doc.__islocal){
+		hide_field(['Address HTML','Contact HTML']);
+		//cur_frm.cscript.set_cl_msg(doc);
+		//cur_frm.cscript.set_hl_msg(doc);		
+	}
+	else{
+		unhide_field(['Address HTML','Contact HTML']);
+		// make lists
+		cur_frm.cscript.make_address(doc,dt,dn);
+		cur_frm.cscript.make_contact(doc,dt,dn);
+		cur_frm.cscript.make_history(doc,dt,dn);
+	}
+}
+
+
+cur_frm.cscript.make_address = function() {
+	if(!cur_frm.address_list) {
+		cur_frm.address_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Address HTML'].wrapper,
+			page_length: 2,
+			new_doctype: "Address",
+			new_doc_onload: function(dn) {
+				ndoc = locals["Address"][dn];
+				ndoc.sales_partner = cur_frm.doc.name;
+				ndoc.address_type = 'Office';				
+			},
+			new_doc_onsave: function(dn) {				
+				cur_frm.address_list.run()
+			},			
+			get_query: function() {
+				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
+			},
+			as_dict: 1,
+			no_results_message: 'No addresses created',
+			render_row: function(wrapper, data) {
+				$(wrapper).css('padding','5px 0px');
+				var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
+				link.dn = data.name
+				
+				$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));				
+				$a(wrapper,'div','',{marginTop:'5px', color:'#555'}, data.address_line1 + '<br />' + (data.address_line2 ? data.address_line2 + '<br />' : '') + data.city + '<br />' + (data.state ? data.state + ', ' : '') + data.country + '<br />' + (data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.fax ? 'Fax: ' + data.fax + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
+			}
+		});
+	}
+	cur_frm.address_list.run();
+}
+
+cur_frm.cscript.make_contact = function() {
+	if(!cur_frm.contact_list) {
+		cur_frm.contact_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
+			page_length: 2,
+			new_doctype: "Contact",
+			new_doc_onload: function(dn) {
+				ndoc = locals["Contact"][dn];
+				ndoc.sales_partner = cur_frm.doc.name;				
+			},
+			new_doc_onsave: function(dn) {				
+				cur_frm.contact_list.run()
+			},
+			get_query: function() {
+				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
+			},
+			as_dict: 1,
+			no_results_message: 'No contacts created',
+			render_row: function(wrapper, data) {
+				$(wrapper).css('padding', '5px 0px');
+				var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
+				link.dn = data.name
+
+				$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
+				$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
+			}
+		});
+	}
+	cur_frm.contact_list.run();
+
+}
+
+// ******************** ITEM Group ******************************** 
+cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) {
+  return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
+}
+
+// make sales order list
+cur_frm.cscript.make_so_list = function(parent, doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','15%','20%','20%'];
+	lst.colnames = ['Sr.','Id','Status','SO Date','Total Commission','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
+	lst.coloptions = ['','Sales Order','','','','',''];
+
+	cur_frm.cscript.set_list_opts(lst);
+	
+	var q = repl("select name,status,transaction_date, total_commission,grand_total from `tabSales Order` where sales_partner='%(sp)s'", {'sp':doc.name});
+	var q_max = repl("select count(name) from `tabSales Order` where sales_partner='%(cust)s'", {'sp':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Order','Sales Order');
+}
+
+// make delivery note list
+cur_frm.cscript.make_dn_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','15%','20%','20%'];
+	lst.colnames = ['Sr.','Id','Status','Date','Total Commission','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
+	lst.coloptions = ['','Delivery Note','','','','',''];
+
+	cur_frm.cscript.set_list_opts(lst);
+
+	var q = repl("select name,status,transaction_date, total_commission,grand_total from `tabDelivery Note` where sales_partner='%(sp)s'", {'sp':doc.name});
+	var q_max = repl("select count(name) from `tabDelivery Note` where sales_partner='%(cust)s'", {'sp':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Delivery Note','Delivery Note');	
+}
+
+// make sales invoice list
+cur_frm.cscript.make_si_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','25%','20%','25%','25%'];
+	lst.colnames = ['Sr.','Id','Invoice Date','Total Commission','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
+	lst.coloptions = ['','Receivable Voucher','','','',''];
+
+	cur_frm.cscript.set_list_opts(lst);
+
+	var q = repl("select name,posting_date, total_commission,grand_total from `tabReceivable Voucher` where sales_partner='%(sp)s'", {'sp':doc.name});
+	var q_max = repl("select count(name) from `tabReceivable Voucher` where sales_partner='%(cust)s'", {'sp':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');	
+}
diff --git a/setup/doctype/sales_partner/sales_partner.py b/setup/doctype/sales_partner/sales_partner.py
new file mode 100644
index 0000000..7258611
--- /dev/null
+++ b/setup/doctype/sales_partner/sales_partner.py
@@ -0,0 +1,48 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.prefix = is_testing and 'test' or 'tab'
+
+  def validate(self):
+    import string
+  
+    if not (self.doc.address_line1)  and not (self.doc.address_line2) and not (self.doc.city) and not (self.doc.state) and not (self.doc.country) and not (self.doc.pincode):
+      return "Please enter address"
+      
+    else:
+      address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
+      comp_address=''
+      for d in address:
+        if self.doc.fields[d]:
+          comp_address += self.doc.fields[d] + "\n"
+      self.doc.address = comp_address
+
+  def check_state(self):
+    return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
+    
+  def get_contacts(self,nm):
+    if nm:
+      contact_details =convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm))
+      return contact_details
+    else:
+      return ''
\ No newline at end of file
diff --git a/setup/doctype/sales_partner/sales_partner.txt b/setup/doctype/sales_partner/sales_partner.txt
new file mode 100644
index 0000000..f4c2857
--- /dev/null
+++ b/setup/doctype/sales_partner/sales_partner.txt
@@ -0,0 +1,927 @@
+[
+	{
+		'_last_update': '1305622930',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:partner_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:22',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 14:32:10',
+		'modified_by': 'Guest',
+		'module': 'Setup',
+		'name': 'Sales Partner',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 0,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 72
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00504',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00505',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00506',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00507',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00508',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00509',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00510',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 0,
+		'creation': '2010-08-08 17:09:22',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2010-08-08 17:09:22',
+		'modified_by': 'Administrator',
+		'name': 'PERM00511',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 0
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05429',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'partner_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Sales Partner Name',
+		'modified': '2011-05-25 12:45:32',
+		'modified_by': 'Guest',
+		'name': 'FL03128',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'partner_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'partner_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Partner Type',
+		'modified': '2011-05-25 12:45:32',
+		'modified_by': 'Guest',
+		'name': 'FL03129',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'partner_type',
+		'oldfieldtype': 'Select',
+		'options': '\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05430',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'commission_rate',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Commission Rate',
+		'modified': '2011-05-25 12:45:32',
+		'modified_by': 'Guest',
+		'name': 'FL03130',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'commission_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2011-05-25 12:45:32',
+		'modified_by': 'Guest',
+		'name': 'FL03143',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Address & Contacts',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05431',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Address Desc',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05432',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<em>Addresses will appear only when you save the customer</em>',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Address HTML',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05433',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05434',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Desc',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05435',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<em>Contact Details will appear only when you save the customer</em>',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Contact HTML',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05436',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Partner Target Details',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05437',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'distribution_id',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Distribution Id',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL03148',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'distribution_id',
+		'oldfieldtype': 'Link',
+		'options': 'Budget Distribution',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'partner_target_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Partner Target Detail',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL03149',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'partner_target_details',
+		'oldfieldtype': 'Table',
+		'options': 'Target Detail',
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': 1,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Manage HTML',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05438',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Transaction History',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05439',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'yogesh@webnotestech.com',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:33',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'History HTML',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL05440',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'yogesh@webnotestech.com',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:22',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-25 12:45:33',
+		'modified_by': 'Guest',
+		'name': 'FL03124',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Partner',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/sales_person/__init__.py b/setup/doctype/sales_person/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/sales_person/__init__.py
diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js
new file mode 100644
index 0000000..aef79a3
--- /dev/null
+++ b/setup/doctype/sales_person/sales_person.js
@@ -0,0 +1,48 @@
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+}
+
+cur_frm.cscript.onload = function(){
+  if(doc.__islocal){
+    doc.parent_sales_person = 'Root';
+    refresh('parent_sales_person');
+  }
+}
+cur_frm.cscript.country = function(doc, cdt, cdn) {
+  var mydoc=doc;
+  $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
+    function(r,rt){
+      if(r.message) {
+        var doc = locals[mydoc.doctype][mydoc.name];
+        doc.state = '';
+        get_field(doc.doctype, 'state' , doc.name).options = r.message;
+        refresh_field('state');
+      }
+    }  
+  );
+}
+
+cur_frm.cscript.TreePage = function(nm){
+  var call_back = function(){
+    var sb_obj = new SalesBrowser();        
+    sb_obj.set_val(nm);
+
+  }
+  loadpage('Sales Browser',call_back);
+
+}
+
+//get query select sales person
+cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND (`tabSales Person`.`rgt` > '+doc.rgt+' or `tabSales Person`.`lft` < '+doc.lft+') AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY  `tabSales Person`.`name` ASC LIMIT 50';
+}
+
+//get query select Territory
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+// ******************** ITEM Group ******************************** 
+cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabItem Group`.name FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
+}
diff --git a/setup/doctype/sales_person/sales_person.py b/setup/doctype/sales_person/sales_person.py
new file mode 100644
index 0000000..f085376
--- /dev/null
+++ b/setup/doctype/sales_person/sales_person.py
@@ -0,0 +1,67 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.model.doc import Document
+from webnotes.model.doclist import getlist
+from webnotes.model.code import get_obj
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.nsm_parent_field = 'parent_sales_person';
+
+  def check_state(self):
+    return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
+
+
+  # update Node Set Model
+  def update_nsm_model(self):
+    import webnotes
+    import webnotes.utils.nestedset
+    webnotes.utils.nestedset.update_nsm(self)
+
+  # ON UPDATE
+  #--------------------------------------
+  def on_update(self):
+    # update nsm
+    self.update_nsm_model()   
+
+
+  def validate(self): 
+
+    for d in getlist(self.doclist, 'target_details'):
+      if not flt(d.target_qty) and not flt(d.target_amount):
+        msgprint("Either target qty or target amount is mandatory.")
+        raise Exception
+        
+    #self.sync_with_contact()
+    
+  def sync_with_contact(self):
+    cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name)
+    if cid:
+      d = Document('Contact', cid[0][0])
+    else:
+      d = Document('Contact')
+    
+    name_split = self.doc.sales_person_name.split()
+    d.contact_name = self.doc.sales_person_name
+    d.first_name = name_split[0]
+    d.last_name = len(name_split) > 1 and name_split[1] or ''
+    d.email_id = self.doc.email_id
+    d.contact_no = d.mobile_no = self.doc.mobile_no
+    d.designation = self.doc.designation
+    d.department = self.doc.department
+    d.sales_person_id = self.doc.name
+    d.is_sales_person = 1
+    
+    d.save(new = (not d.name))
+    
+    
diff --git a/setup/doctype/sales_person/sales_person.txt b/setup/doctype/sales_person/sales_person.txt
new file mode 100644
index 0000000..f99653c
--- /dev/null
+++ b/setup/doctype/sales_person/sales_person.txt
@@ -0,0 +1,1420 @@
+[
+	{
+		'_last_update': '1300960454',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'field:sales_person_name',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:43:05',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'last_update': '1294161036',
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-11-18 12:16:35',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'Sales Person',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'name,parent_sales_person',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 133
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:25:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00443',
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03156',
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'General Info',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': '000006299',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_person_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Sales Person Name',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL03158',
+		'no_copy': None,
+		'oldfieldname': 'sales_person_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select company name first.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'parent_sales_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Parent Sales Person',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL03159',
+		'no_copy': None,
+		'oldfieldname': 'parent_sales_person',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Person',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'SPHelp',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': '000006300',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Sales Person\');">To manage Sales Person, click here</a>',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_group',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Has Child Node',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL03042',
+		'no_copy': None,
+		'oldfieldname': 'is_group',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_group',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Has Child Node',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03161',
+		'no_copy': None,
+		'oldfieldname': 'is_group',
+		'oldfieldtype': 'Select',
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:41:52',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Department',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL02338',
+		'no_copy': None,
+		'oldfieldname': 'department',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Department',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03162',
+		'no_copy': None,
+		'oldfieldname': 'department',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Designation',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00728',
+		'no_copy': None,
+		'oldfieldname': 'designation',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Designation',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03163',
+		'no_copy': None,
+		'oldfieldname': 'designation',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:31:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mobile_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL01300',
+		'no_copy': None,
+		'oldfieldname': 'mobile_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mobile_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03164',
+		'no_copy': None,
+		'oldfieldname': 'mobile_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': '000006301',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:31:13',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Email Id',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL01157',
+		'no_copy': None,
+		'oldfieldname': 'email_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Email Id',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03166',
+		'no_copy': None,
+		'oldfieldname': 'email_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2009-05-12 11:19:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'country',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Country',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00177',
+		'no_copy': None,
+		'oldfieldname': 'country',
+		'oldfieldtype': 'Select',
+		'options': 'link:Country',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'country',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Country',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03167',
+		'no_copy': None,
+		'oldfieldname': 'country',
+		'oldfieldtype': 'Select',
+		'options': 'link:Country',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2009-05-12 11:19:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'state',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'State',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00176',
+		'no_copy': None,
+		'oldfieldname': 'state',
+		'oldfieldtype': 'Select',
+		'options': 'link:State',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'state',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'State',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03168',
+		'no_copy': None,
+		'oldfieldname': 'state',
+		'oldfieldtype': 'Select',
+		'options': 'link:State',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2009-05-12 11:19:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'city',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'City',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00174',
+		'no_copy': None,
+		'oldfieldname': 'city',
+		'oldfieldtype': 'Select',
+		'options': 'link:City',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'city',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'City',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03169',
+		'no_copy': None,
+		'oldfieldname': 'city',
+		'oldfieldtype': 'Select',
+		'options': 'link:City',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'territory',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Territory',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL03170',
+		'no_copy': None,
+		'oldfieldname': 'territory',
+		'oldfieldtype': 'Link',
+		'options': 'Territory',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Territory Help',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': '000006302',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lft',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'lft',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00618',
+		'no_copy': 1,
+		'oldfieldname': 'lft',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lft',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 17,
+		'in_filter': 1,
+		'label': 'lft',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03172',
+		'no_copy': 1,
+		'oldfieldname': 'lft',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rgt',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'rgt',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00619',
+		'no_copy': 1,
+		'oldfieldname': 'rgt',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rgt',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 18,
+		'in_filter': 1,
+		'label': 'rgt',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03173',
+		'no_copy': 1,
+		'oldfieldname': 'rgt',
+		'oldfieldtype': 'Int',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:32',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'old_parent',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'old_parent',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00617',
+		'no_copy': 1,
+		'oldfieldname': 'old_parent',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'old_parent',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'old_parent',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03174',
+		'no_copy': 1,
+		'oldfieldname': 'old_parent',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 17:30:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'distribution_id',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Distribution Id',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL00673',
+		'no_copy': None,
+		'oldfieldname': 'distribution_id',
+		'oldfieldtype': 'Link',
+		'options': 'Budget Distribution',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:05',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'distribution_id',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Distribution Id',
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'FL03175',
+		'no_copy': None,
+		'oldfieldname': 'distribution_id',
+		'oldfieldtype': 'Link',
+		'options': 'Budget Distribution',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-24 15:58:01',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Target Details',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': '000006303',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-11-30 22:43:06',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'target_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Target Details1',
+		'modified': '2011-03-24 15:58:01',
+		'modified_by': 'Administrator',
+		'name': 'FL03177',
+		'no_copy': None,
+		'oldfieldname': 'target_details',
+		'oldfieldtype': 'Table',
+		'options': 'Target Detail',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 22:43:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00558',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 22:43:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00559',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 22:43:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00560',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 22:43:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00561',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-11-30 22:43:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00562',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-11-30 22:43:05',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-11-30 22:43:05',
+		'modified_by': 'Administrator',
+		'name': 'PERM00563',
+		'owner': 'Administrator',
+		'parent': 'Sales Person',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 0
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/setup_control/__init__.py b/setup/doctype/setup_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/setup_control/__init__.py
diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py
new file mode 100644
index 0000000..9712860
--- /dev/null
+++ b/setup/doctype/setup_control/setup_control.py
@@ -0,0 +1,177 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+  
+  #Default Naming Series
+  #---------------------------------------------------
+  def naming_series(self):
+    ns = [['TDS Payment', 'TDSP'], ['Payable Voucher', 'BILL'], ['Journal Voucher', 'JV'], ['Receivable Voucher', 'INV'], ['Lead', 'Lead'], ['Indent', 'IDT'], ['Enquiry', 'Enquiry'], ['Purchase Order', 'PO'], ['Quotation', 'QTN'], ['Purchase Receipt', 'GRN'], ['Stock Entry', 'STE'], ['Sales Order', 'SO'], ['Delivery Note', 'DN'], ['Employee', 'EMP/']]
+    for r in ns: 
+      rec = Document('Naming Series')
+      rec.select_doc_for_series = r[0]
+      rec.new_series = r[1]
+      rec_obj = get_obj(doc=rec)
+      rec_obj.add_series()
+
+  # set account details
+  #-----------------------
+  def set_account_details(self, args):
+    args = eval(args)
+    
+    self.set_cp_defaults(args['company_name'], args['industry'], args['time_zone'], args['country'], args['account_name'])
+    self.create_profile(args['user'], args['first_name'], args['last_name'])  
+    self.update_client_control()
+    
+  
+  # Account Setup
+  # ---------------
+  def setup_account(self, args):
+    company_name, comp_abbr, fy_start, currency = eval(args)
+    curr_fiscal_year,fy_start_date = self.get_fy_details(fy_start)
+    self.currency = currency
+    
+    # Fiscal Year
+    master_dict = {'Fiscal Year':{'year':curr_fiscal_year,
+                                  'year_start_date':fy_start_date}}
+    self.create_records(master_dict)
+    
+    # Company
+    master_dict = {'Company':{'company_name':company_name,
+                              'abbr':comp_abbr                              
+                              }}
+    self.create_records(master_dict)
+    
+    def_args = {'current_fiscal_year':curr_fiscal_year,
+                'default_currency': currency,
+                'default_company':company_name,
+                'default_valuation_method':'FIFO',
+                'date_format':'dd-mm-yyyy',
+                'default_currency_format':'Lacs',
+                'so_required':'No',
+                'dn_required':'No',
+                'po_required':'No',
+                'pr_required':'No',
+                'emp_created_by':'Naming Series',
+                'cust_master_name':'Customer Name', 
+                'supp_master_name':'Supplier Name'}
+
+    # Set 
+    self.set_defaults(def_args)
+
+    # Set Registration Complete
+    set_default('registration_complete','1')
+
+    import webnotes.utils
+    return webnotes.utils.get_defaults()
+
+    
+  # Get Fiscal year Details
+  # ------------------------
+  def get_fy_details(self, fy_start):
+    st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
+    curr_year = getdate(nowdate()).year
+    if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
+      curr_year = getdate(nowdate()).year - 1
+    stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
+    #eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
+    if(fy_start == '1st Jan'):
+      fy = cstr(getdate(nowdate()).year)
+    else:
+      fy = cstr(curr_year) + '-' + cstr(curr_year+1)
+    return fy,stdt
+
+
+  # Create Company and Fiscal Year
+  # ------------------------------- 
+  def create_records(self, master_dict):
+    for d in master_dict.keys():
+      rec = Document(d)
+      for fn in master_dict[d].keys():
+        rec.fields[fn] = master_dict[d][fn]
+      # add blank fields
+      for fn in rec.fields:
+        if fn not in master_dict[d].keys()+['name','owner','doctype']:
+          rec.fields[fn] = ''
+      rec_obj = get_obj(doc=rec)
+      rec_obj.doc.save(1)
+      if hasattr(rec_obj, 'on_update'):
+        rec_obj.on_update()
+
+
+  # Set System Defaults
+  # --------------------
+  def set_defaults(self, def_args):
+    ma_obj = get_obj('Manage Account','Manage Account')
+    for d in def_args.keys():
+      ma_obj.doc.fields[d] = def_args[d]
+    ma_obj.doc.save()
+    ma_obj.update_cp()
+
+
+  # Set Control Panel Defaults
+  # --------------------------
+  def set_cp_defaults(self, cname, industry, timezone, country, acc_name):
+    cp = Document('Control Panel','Control Panel')
+    cp.account_id = acc_name
+    cp.company_name = cname
+    cp.industry = industry
+    cp.time_zone = timezone
+    cp.country = country
+    cp.client_name = '<div style="padding:4px; font-size:20px;">'+cname+'</div>'
+    cp.save()
+      
+  # Create Profile
+  # --------------
+  def create_profile(self, user_email, user_fname, user_lname):
+    roles_list = ['System Manager','Sales Manager','Sales User','Purchase Manager','Purchase User','Material Manager','Material User','Accounts Manager','Accounts User','HR Manager','HR User','Production Manager','Production User','Sales Master Manager','Purchase Master Manager','Material Master Manager','Quality Manager','Maintenance User','Maintenance Manager']
+    pr = Document('Profile')
+    pr.first_name = user_fname
+    pr.last_name = user_lname
+    pr.email = user_email
+    pr.enabled = 1
+    pr.save(1)
+    for r in roles_list:
+      d = addchild(pr, 'userroles', 'UserRole', 1)
+      d.role = r
+      d.save()
+    # Add roles to Administrator profile
+    pr_obj = get_obj('Profile','Administrator')
+    for r in roles_list:
+      d = addchild(pr_obj.doc,'userroles', 'UserRole', 1)
+      d.role = r
+      d.save()
+  
+  # Update WN ERP Client Control
+  # -----------------------------
+  def update_client_control(self):
+    cl = Document('WN ERP Client Control','WN ERP Client Control')
+    cl.account_start_date = nowdate()
+    cl.total_users = 1
+    cl.is_trial_account = 1
+    cl.save()
+
+  # Sync DB
+  # -------
+  def sync_db(arg=''):
+    import webnotes.model.db_schema
+    sql("delete from `tabDocType Update Register`")
+    webnotes.model.db_schema.sync_all()
\ No newline at end of file
diff --git a/setup/doctype/setup_control/setup_control.txt b/setup/doctype/setup_control/setup_control.txt
new file mode 100644
index 0000000..85d27f4
--- /dev/null
+++ b/setup/doctype/setup_control/setup_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-03 13:32:18', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 87, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Setup Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/setup/doctype/state/__init__.py b/setup/doctype/state/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/state/__init__.py
diff --git a/setup/doctype/state/state.js b/setup/doctype/state/state.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/state/state.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/state/state.txt b/setup/doctype/state/state.txt
new file mode 100644
index 0000000..72384ea
--- /dev/null
+++ b/setup/doctype/state/state.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-31 16:47:00', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:state_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'State', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00533', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2009-12-15 16:10:15', 'modified': '2010-09-20 11:03:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00582', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2010-01-12 16:42:57', 'modified': '2010-09-20 11:03:36', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00759', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2010-04-08 13:47:15', 'modified': '2010-09-20 11:03:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-31 16:47:00', 'doctype': 'DocField', 'oldfieldname': 'state_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'State Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'State', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01598', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 11:03:36', 'parenttype': 'DocType', 'fieldname': 'state_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-31 16:47:00', 'doctype': 'DocField', 'oldfieldname': 'country', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Country', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'State', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01599', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 11:03:36', 'parenttype': 'DocType', 'fieldname': 'country', 'fieldtype': 'Select', 'options': 'link:Country', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/supplier_type/__init__.py b/setup/doctype/supplier_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/supplier_type/__init__.py
diff --git a/setup/doctype/supplier_type/supplier_type.js b/setup/doctype/supplier_type/supplier_type.js
new file mode 100644
index 0000000..c7c01af
--- /dev/null
+++ b/setup/doctype/supplier_type/supplier_type.js
@@ -0,0 +1,11 @@
+$import(Tips Common)
+
+// ONLOAD
+// ===================================================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/supplier_type/supplier_type.txt b/setup/doctype/supplier_type/supplier_type.txt
new file mode 100644
index 0000000..0190faf
--- /dev/null
+++ b/setup/doctype/supplier_type/supplier_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:22', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:supplier_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Supplier Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00917', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:54:46', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00918', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:54:46', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00919', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:00:26', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00920', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:00:26', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00224', 'parent': 'Supplier Type', 'read': 1, 'create': 1, 'creation': '2009-03-12 16:40:23', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04863', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:24', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:22', 'doctype': 'DocField', 'oldfieldname': 'supplier_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Supplier Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01322', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:24', 'parenttype': 'DocType', 'fieldname': 'supplier_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/support_email_settings/__init__.py b/setup/doctype/support_email_settings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/support_email_settings/__init__.py
diff --git a/setup/doctype/support_email_settings/support_email_settings.py b/setup/doctype/support_email_settings/support_email_settings.py
new file mode 100644
index 0000000..98d680e
--- /dev/null
+++ b/setup/doctype/support_email_settings/support_email_settings.py
@@ -0,0 +1,18 @@
+import webnotes
+from webnotes.utils import cint
+
+class DocType:
+	def __init__(self,dt,dn):
+		self.doc, self.doctype = dt,dn
+		
+	def on_update(self):
+		"""
+			Sets or cancels the event in the scheduler
+		"""
+		if cint(self.doc.integrate_incoming):
+			from webnotes.utils.scheduler import set_event
+			set_event('maintenance.doctype.support_ticket.get_support_mails', 60*5, 1)
+		else:
+			from webnotes.utils.scheduler import cancel_event
+			cancel_event('maintenance.doctype.support_ticket.get_support_mails')
+			
\ No newline at end of file
diff --git a/setup/doctype/support_email_settings/support_email_settings.txt b/setup/doctype/support_email_settings/support_email_settings.txt
new file mode 100644
index 0000000..46a3d0f
--- /dev/null
+++ b/setup/doctype/support_email_settings/support_email_settings.txt
@@ -0,0 +1,369 @@
+[
+	{
+		'_last_update': '1306554355',
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-17 14:04:30',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': 1,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'Support Email Settings',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 1,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 8
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2011-05-17 14:04:30',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000798',
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-19 12:41:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'The full email id of your incoming support emails',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Email',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000811',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Email',
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-20 11:34:49',
+		'default': None,
+		'depends_on': None,
+		'description': 'By checking this, your incoming mails will automatically be integrated with the Support Ticket',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'integrate_incoming',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Integrate Incoming',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000824',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-28 09:15:55',
+		'default': None,
+		'depends_on': None,
+		'description': 'Signature appended to the outgoing email (Text / HTML)',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'signature',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Signature',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': 'FL05195',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-20 11:34:49',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000823',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-17 14:04:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'use_ssl',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Use SSL',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000799',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-17 14:04:30',
+		'default': None,
+		'depends_on': None,
+		'description': 'eg. pop.gmail.com',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'host',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Host',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000800',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-17 14:04:30',
+		'default': None,
+		'depends_on': None,
+		'description': 'Support Email Id',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'username',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Username',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000801',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-17 14:04:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'password',
+		'fieldtype': 'Password',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Password',
+		'modified': '2011-05-28 09:25:53',
+		'modified_by': 'Administrator',
+		'name': '000000802',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Support Email Settings',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/target_detail/__init__.py b/setup/doctype/target_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/target_detail/__init__.py
diff --git a/setup/doctype/target_detail/target_detail.txt b/setup/doctype/target_detail/target_detail.txt
new file mode 100644
index 0000000..f3bbc58
--- /dev/null
+++ b/setup/doctype/target_detail/target_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-16 18:17:59', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Target Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-22 13:08:10', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02123', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-16 18:17:59', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01419', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-22 12:03:16', 'doctype': 'DocField', 'oldfieldname': 'target_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Target Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05403', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'target_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-16 18:17:59', 'doctype': 'DocField', 'oldfieldname': 'target_amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Target  Amount', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01420', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'target_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/term/__init__.py b/setup/doctype/term/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/term/__init__.py
diff --git a/setup/doctype/term/term.js b/setup/doctype/term/term.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/term/term.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/term/term.txt b/setup/doctype/term/term.txt
new file mode 100644
index 0000000..d8bdb54
--- /dev/null
+++ b/setup/doctype/term/term.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-19 13:38:59', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 11, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Term', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00953', 'parent': 'Term', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:10:54', 'modified': '2010-09-20 11:05:27', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00954', 'parent': 'Term', 'read': 1, 'create': 1, 'creation': '2010-04-26 17:10:54', 'modified': '2010-09-20 11:05:27', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00966', 'parent': 'Term', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:13:26', 'modified': '2010-09-20 11:05:27', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00834', 'parent': 'Term', 'read': 1, 'create': 0, 'creation': '2010-04-19 13:38:59', 'modified': '2010-09-20 11:05:27', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00835', 'parent': 'Term', 'read': 1, 'create': None, 'creation': '2010-04-19 13:38:59', 'modified': '2010-09-20 11:05:27', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00837', 'parent': 'Term', 'read': 1, 'create': 1, 'creation': '2010-04-20 09:39:56', 'modified': '2010-09-20 11:05:27', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00838', 'parent': 'Term', 'read': 1, 'create': 1, 'creation': '2010-04-20 09:39:56', 'modified': '2010-09-20 11:05:27', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 7, 'parenttype': 'DocType', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Term', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04864', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 11:05:27', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-19 13:38:59', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Term', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL04672', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 11:05:27', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2010-04-19 13:38:59', 'doctype': 'DocField', 'oldfieldname': 'terms', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Terms', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Term', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04673', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 11:05:27', 'parenttype': 'DocType', 'fieldname': 'terms', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/territory/__init__.py b/setup/doctype/territory/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/territory/__init__.py
diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js
new file mode 100644
index 0000000..7692b83
--- /dev/null
+++ b/setup/doctype/territory/territory.js
@@ -0,0 +1,35 @@
+$import(Tips Common)
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.onload = function(){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  if(doc.__islocal){
+    doc.parent_territory = 'All Territories';
+    refresh('parent_territory');
+  }
+}
+
+
+//get query select territory
+cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
+  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND (`tabTerritory`.`rgt` > '+doc.rgt+' or `tabTerritory`.`lft` < '+doc.lft+') AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+}
+
+
+// ******************** ITEM Group ******************************** 
+cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
+}
+
+cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
+  var call_back = function(){
+    var sb_obj = new SalesBrowser();        
+    sb_obj.set_val('Territory');
+
+  }
+  loadpage('Sales Browser',call_back);
+  
+}
\ No newline at end of file
diff --git a/setup/doctype/territory/territory.py b/setup/doctype/territory/territory.py
new file mode 100644
index 0000000..26805be
--- /dev/null
+++ b/setup/doctype/territory/territory.py
@@ -0,0 +1,61 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.nsm_parent_field = 'parent_territory'
+
+  def check_state(self):
+    return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
+
+       
+
+  # update Node Set Model
+  def update_nsm_model(self):
+    import webnotes
+    import webnotes.utils.nestedset
+    webnotes.utils.nestedset.update_nsm(self)
+
+  # ON UPDATE
+  #--------------------------------------
+  def on_update(self):
+  
+    # update nsm
+    self.update_nsm_model()  
+    
+
+
+  def validate(self): 
+    if self.doc.lft and self.doc.rgt:
+      res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_territory,self.doc.territory_name))
+      if not res:
+        msgprint("Please enter proper parent territory.") 
+        raise Exception
+
+    r = sql("select name from `tabTerritory` where name = '%s' and docstatus = 2"%(self.doc.territory_name))
+    if r:
+      msgprint("%s record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.territory_name))
+      raise Exception
+
+    for d in getlist(self.doclist, 'target_details'):
+      if not flt(d.target_qty) and not flt(d.target_amount):
+        msgprint("Either target qty or target amount is mandatory.")
+        raise Exception
\ No newline at end of file
diff --git a/setup/doctype/territory/territory.txt b/setup/doctype/territory/territory.txt
new file mode 100644
index 0000000..52ca9c4
--- /dev/null
+++ b/setup/doctype/territory/territory.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:06', 'search_fields': 'name,parent_territory,territory_manager', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': 1, 'in_create': 1, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 91, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:territory_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': 'Master', 'name': 'Territory', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-22 16:00:26', 'server_code_error': ' ', 'name_case': 'Title Case', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00930', 'parent': 'Territory', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:08:32', 'modified': '2010-09-22 16:00:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00931', 'parent': 'Territory', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:08:32', 'modified': '2010-09-22 16:00:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00952', 'parent': 'Territory', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:10:54', 'modified': '2010-09-22 16:00:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00962', 'parent': 'Territory', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:13:26', 'modified': '2010-09-22 16:00:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00963', 'parent': 'Territory', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:13:26', 'modified': '2010-09-22 16:00:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 5, 'parenttype': 'DocType', 'role': 'Sales User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00658', 'parent': 'Territory', 'read': 1, 'create': 1, 'creation': '2010-02-01 10:10:16', 'modified': '2010-09-22 16:00:26', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04865', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:06', 'doctype': 'DocField', 'oldfieldname': 'territory_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Territory Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01154', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'territory_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:06', 'doctype': 'DocField', 'oldfieldname': 'territory_manager', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Territory Manager', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01161', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'territory_manager', 'fieldtype': 'Link', 'options': 'Sales Person', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': 'parent_territory', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Parent Territory', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05445', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'parent_territory', 'fieldtype': 'Link', 'options': 'Territory', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-07-19 13:05:00', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'TerritoryHelp', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05643', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': 'is_group', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Has Child Node', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Only leaf nodes are allowed in transaction', 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05446', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'is_group', 'fieldtype': 'Select', 'options': '\nYes\nNo', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': 'lft', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'lft', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05447', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'lft', 'fieldtype': 'Int', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Int', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': 'rgt', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'rgt', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL05448', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'rgt', 'fieldtype': 'Int', 'options': None, 'report_hide': 0, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': 'old_parent', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'old_parent', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05449', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'old_parent', 'fieldtype': 'Data', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-06-28 12:46:46', 'doctype': 'DocField', 'oldfieldname': 'distribution_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Distribution Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05457', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'distribution_id', 'fieldtype': 'Link', 'options': 'Budget Distribution', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Target Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05450', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-06-28 09:18:58', 'doctype': 'DocField', 'oldfieldname': 'target_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Target Details1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Territory', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05451', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-09-22 16:00:26', 'parenttype': 'DocType', 'fieldname': 'target_details', 'fieldtype': 'Table', 'options': 'Target Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/uom/__init__.py b/setup/doctype/uom/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/uom/__init__.py
diff --git a/setup/doctype/uom/uom.js b/setup/doctype/uom/uom.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/uom/uom.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/uom/uom.txt b/setup/doctype/uom/uom.txt
new file mode 100644
index 0000000..51423b9
--- /dev/null
+++ b/setup/doctype/uom/uom.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:44', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:uom_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'UOM', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00872', 'parent': 'UOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-20 11:07:40', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00873', 'parent': 'UOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-20 11:07:40', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00897', 'parent': 'UOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-20 11:07:40', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00898', 'parent': 'UOM', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-20 11:07:40', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00223', 'parent': 'UOM', 'read': 1, 'create': 1, 'creation': '2009-03-12 15:59:30', 'modified': '2010-09-20 11:07:40', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'UOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04866', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 11:07:40', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-03-17 15:16:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'UOM Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'UOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04114', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 11:07:40', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'uom_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'UOM Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'UOM', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00659', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 11:07:40', 'parenttype': 'DocType', 'fieldname': 'uom_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/doctype/warehouse_type/__init__.py b/setup/doctype/warehouse_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/warehouse_type/__init__.py
diff --git a/setup/doctype/warehouse_type/warehouse_type.js b/setup/doctype/warehouse_type/warehouse_type.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/setup/doctype/warehouse_type/warehouse_type.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/setup/doctype/warehouse_type/warehouse_type.txt b/setup/doctype/warehouse_type/warehouse_type.txt
new file mode 100644
index 0000000..9a05c2b
--- /dev/null
+++ b/setup/doctype/warehouse_type/warehouse_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:09:44', 'search_fields': '', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:warehouse_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Warehouse Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-22 10:52:43', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00878', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00879', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:48:34', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Material Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00903', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00904', 'parent': 'Warehouse Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:52:07', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Material User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00212', 'parent': 'Warehouse Type', 'read': 1, 'create': 1, 'creation': '2009-03-12 15:13:34', 'modified': '2010-09-22 10:52:43', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Material Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Warehouse Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04868', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-22 10:52:43', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:09:44', 'doctype': 'DocField', 'oldfieldname': 'warehouse_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Warehouse Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Warehouse Type', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL00676', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-22 10:52:43', 'parenttype': 'DocType', 'fieldname': 'warehouse_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/setup/page/__init__.py b/setup/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/__init__.py
diff --git a/setup/page/import_data/__init__.py b/setup/page/import_data/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/import_data/__init__.py
diff --git a/setup/page/import_data/import_data.html b/setup/page/import_data/import_data.html
new file mode 100644
index 0000000..a4b30f4
--- /dev/null
+++ b/setup/page/import_data/import_data.html
@@ -0,0 +1,55 @@
+<div class="layout_wrapper">
+<div id="di_header"></div>
+<div style="margin: 8px">
+<table style="border-collapse: collapse;" border="0">
+<tbody>
+<tr>
+<td style="border: 1px solid #aaaaaa; padding: 4px; width: 60%;">
+	
+<form action="index.cgi" enctype="multipart/form-data" method="POST" target="ImportIFrame"> <input name="cmd" type="hidden" value="import_csv" /> 
+<h3 style="background-color: #EEF; padding: 2px;">Step 1. Download Template</h3>
+<select id="import_template" style="margin: 10px;"> <option>Select Master...</option> </select>
+
+<div style="margin: 10px; margin-top: 0px;"><input name="overwrite" type="checkbox"/> Over-write records with same name?</div>
+<div id="child_tab_lst"></div>
+<h3 style="background-color: #EEF; padding: 2px;">Step 2. Upload and Import</h3>
+<table style="width: 480px;" border="0" cellspacing="10px">
+<tbody>
+<tr>
+<td width="200px">Select CSV File to be imported</td>
+<td><input name="csv_file" type="file" /></td>
+</tr>
+<tr>
+<td width="200px">Date format in source CSV</td>
+<td><select name="dateformat"> <option value="yyyy-mm-dd">yyyy-mm-dd</option> <option value="mm/dd/yyyy">mm/dd/yyyy</option> <option value="mm/dd/yy">mm/dd/yy</option> <option value="dd-mm-yyyy">dd-mm-yyyy</option> <option value="dd/mm/yyyy">dd/mm/yyyy</option> </select></td>
+</tr>
+<tr>
+<td>&nbsp;</td>
+<td>
+<div id="import_btn"><input type="submit" value="Import" /></div>
+</td>
+</tr>
+</tbody>
+</table>
+</form>
+<div style="background-color: #FFE; padding: 10px; margin: 10px;">
+<h3>Data Import Guide</h3>
+<ol>
+<li>Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.</li>
+<li>Fill in the data in the template. You can remove columns that are not relevant</li>
+<li>Save the template in CSV format</li>
+<li>Select the saved CSV file, identify the date format if any</li>
+<li>Click on "Import"</li>
+</ol></div>
+</td>
+<td style="border: 1px solid #AAA; padding: 4px;">
+<h3>Import Log:</h3>
+<div id="import_result_area">
+<iframe src="blank1.html" name="ImportIFrame" style="border: 0px; height: 500px; width: 100%"></iframe>
+</div>
+</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
\ No newline at end of file
diff --git a/setup/page/import_data/import_data.js b/setup/page/import_data/import_data.js
new file mode 100644
index 0000000..aa0bdbd
--- /dev/null
+++ b/setup/page/import_data/import_data.js
@@ -0,0 +1,45 @@
+pscript['onload_Import Data'] = function() {
+  
+  //alert(profile.can_get_report);
+
+  callback = function(r,rt) {
+    var h = new PageHeader('di_header','Import Data','Tool to download template and upload data');
+    var sel = $i('import_template');
+    if(r.message){
+      add_sel_options(sel, r.message);
+      sel.onchange=function(){
+        $i('child_tab_lst').innerHTML ='';
+        if(sel.value != 'Select Master...'){
+          $c_obj('Import Data Control','get_child_lst',sel.value,
+            function(r,rt){
+              var me = this;
+              $y($i('child_tab_lst'),{backgroundColor:'#EEEEEE'})
+              var desc = $a($i('child_tab_lst'), 'div', '', {padding:'8px'});
+              
+              desc.innerHTML = "<h4>Please click on following link(s) to download template.</h4>";
+ 
+              
+              var parent = $a($i('child_tab_lst'), 'div');
+              var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'8px',fontSize:'15px',borderCollapse: 'collapse'});
+              
+              for(var i=0;i<r.message.length;i++){
+                var dt= $a($td(tab,i,0), 'span', 'link_type');
+                dt.innerHTML = r.message[i];
+                dt.nm = r.message[i];
+                
+
+                dt.onclick = function(){ 
+					var ovr = $('input[name="overwrite"]:checked').length;
+                    window.location = outUrl + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
+                }
+              }
+            }  
+          );
+        }
+      }
+    }
+  }
+  $c_obj('Import Data Control','get_master_lst','',callback);
+  
+
+}
diff --git a/setup/page/import_data/import_data.txt b/setup/page/import_data/import_data.txt
new file mode 100644
index 0000000..b422f12
--- /dev/null
+++ b/setup/page/import_data/import_data.txt
@@ -0,0 +1,106 @@
+[
+	{
+		'author': None,
+		'category': 'Standard',
+		'content': None,
+		'creation': '2010-12-14 10:33:09',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'file_list': None,
+		'icon': None,
+		'idx': None,
+		'keywords': None,
+		'menu_index': None,
+		'modified': '2011-05-02 16:28:00',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'Import Data',
+		'owner': 'Administrator',
+		'page_name': 'Import Data',
+		'page_title': None,
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'publish': None,
+		'script': None,
+		'show_in_menu': 0,
+		'site_description': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None,
+		'stylesheet': None,
+		'template': None,
+		'write_content': None
+	},
+	{
+		'creation': '2010-12-14 10:33:09',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 1,
+		'modified': '2011-05-02 16:28:00',
+		'modified_by': 'Administrator',
+		'name': 'PR000224',
+		'owner': 'Administrator',
+		'parent': 'Import Data',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-12-14 10:33:09',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 2,
+		'modified': '2011-05-02 16:28:00',
+		'modified_by': 'Administrator',
+		'name': 'PR000225',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Import Data',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'System Manager'
+	},
+	{
+		'creation': '2010-12-14 10:33:09',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 3,
+		'modified': '2011-05-02 16:28:00',
+		'modified_by': 'Administrator',
+		'name': 'PR000226',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Import Data',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Sales Master Manager'
+	},
+	{
+		'creation': '2010-12-14 10:33:09',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 4,
+		'modified': '2011-05-02 16:28:00',
+		'modified_by': 'Administrator',
+		'name': 'PR000227',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Import Data',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Purchase Master Manager'
+	},
+	{
+		'creation': '2010-12-14 10:33:09',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 5,
+		'modified': '2011-05-02 16:28:00',
+		'modified_by': 'Administrator',
+		'name': 'PR000228',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Import Data',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Material Master Manager'
+	}
+]
\ No newline at end of file
diff --git a/setup/page/people/__init__.py b/setup/page/people/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/people/__init__.py
diff --git a/setup/page/people/people.comp.js b/setup/page/people/people.comp.js
new file mode 100644
index 0000000..8938b6a
--- /dev/null
+++ b/setup/page/people/people.comp.js
@@ -0,0 +1,50 @@
+
+pscript.onload_people=function(){make_customer_tab($i('crm_home'));}
+function make_customer_tab(parent){new DocColumnView('Customers',parent,['Customer Group','Customer','Contact'],{'Customer Group':{show_fields:['name'],create_fields:['name'],search_fields:['name'],next_col:'Customer'},'Customer':{show_fields:['name','customer_name'],create_fields:['name','customer_name'],search_fields:['customer_name'],filter_by:['Customer Group','customer_group'],next_col:'Contact'},'Contact':{show_fields:['name','first_name','last_name'],create_fields:['name','first_name','last_name'],search_fields:['first_name','last_name'],conditions:['is_customer=1'],filter_by:['Customer','customer']},})}
+function DocColumnView(title,parent,items,opts){this.columns={};this.items=items;this.page_head=new PageHeader(parent,title);this.make_columns(items.length,parent);for(var i=0;i<items.length;i++){var c=opts[items[i]];this.columns[items[i]]=new List2(this,$td(this.tab,0,i),items[i],c);}
+this.columns[items[0]].run();}
+DocColumnView.prototype.make_columns=function(n,parent){var cl=[];for(var i=0;i<n;i++){cl.push(cint(100/n)+'%')}
+this.tab=make_table(parent,1,n,'100%',cl)
+this.tab.className='dcv-tab';}
+DocColumnView.prototype.refresh=function(){this.columns[this.items[0]].run();}
+function List2(dcv,parent,doctype,opts){this.dcv=dcv;this.doctype=doctype;this.opts=opts;this.dtl=get_doctype_label(doctype);this.make_body(parent);this.selected_item=null;}
+List2.prototype.make_body=function(parent){this.make_toolbar(parent);this.make_search(parent);this.make_message(parent);this.make_list(parent);this.clear();}
+List2.prototype.make_toolbar=function(parent){var me=this;this.head=$a(parent,'div','list2-head');$gr(this.head,'#EEE','#CCC');var t=make_table(this.head,1,2,'100%',['60%','40%'],{verticalAlign:'middle'});var span=$a($td(t,0,0),'span','',{cssFloat:'left'},this.dtl);var refresh_icon=$a($td(t,0,0),'div','wn-icon ic-playback_reload',{marginLeft:'7px',cssFloat:'left'});refresh_icon.onclick=function(){me.run();}
+this.btn=$btn($td(t,0,1),'+ New',function(){me.make_new();},{fontWeight:'bold',cssFloat:'right'},'green');}
+List2.prototype.make_search=function(parent){var me=this;this.searchbar=$a(parent,'div','list2-search');this.search_inp=$a_input(this.searchbar,'text');this.search_btn=$a(this.searchbar,'img','',{cursor:'pointer',marginLeft:'8px',marginBottom:'-3px'});this.search_btn.src='images/icons/magnifier.png';this.search_btn.onclick=function(){me.run();}}
+List2.prototype.make_message=function(parent){this.clear_message=$a(parent,'div','help_box',{margin:'4px',display:'none'},(this.opts.filter_by?('Select '+get_doctype_label(this.opts.filter_by[0])+' to see list'):''));this.no_result_message=$a(parent,'div','help_box',{margin:'4px',display:'none'},'No '+this.dtl+' created yet!');}
+List2.prototype.make_new=function(){var me=this;newdoc(this.doctype,function(dn){if(me.opts.filter_by){var val=me.dcv.columns[me.opts.filter_by[0]].get_selected();if(val)
+locals[me.doctype][dn][me.opts.filter_by[1]]=val;}});}
+List2.prototype.clear=function(){$dh(this.lst_area);$ds(this.clear_message)
+$dh(this.no_result_message);this.clear_next();}
+List2.prototype.show_list=function(){$ds(this.lst_area);$dh(this.clear_message)
+$dh(this.no_result_message);}
+List2.prototype.show_no_result=function(){if(!this.search_inp.value){$dh(this.lst_area);$dh(this.clear_message);$ds(this.no_result_message);}}
+List2.prototype.clear_next=function(){if(this.opts.next_col&&this.dcv.columns[this.opts.next_col])this.dcv.columns[this.opts.next_col].clear();}
+List2.prototype.make_list=function(parent){var me=this;this.lst_area=$a(parent,'div','list2-list-area');this.lst=new Listing('Profiles',1);this.lst.opts.hide_refresh=1;this.lst.opts.cell_style={padding:'0px'};this.lst.colwidths=['100%'];this.lst.get_query=function(){var q=me.build_query();this.query=q[0];this.query_max=q[1];}
+this.lst.make(this.lst_area);this.lst.show_cell=function(cell,ri,ci,d){new List2Item(cell,d[ri],me);}
+this.lst.onrun=function(){me.show_list();me.clear_next();if(!me.lst.has_data())me.show_no_result();}}
+List2.prototype.run=function(){$dh(this.lst.results);this.lst.run();}
+List2.prototype.build_query=function(){var args={fields:this.opts.show_fields.join(', '),doctype:this.doctype,cond:''}
+var cl=this.build_search_conditions();cl=this.add_filter_condition(cl);if(cl.length)args.cond=' AND '+cl.join(' AND ');var query=repl('SELECT %(fields)s FROM `tab%(doctype)s` WHERE docstatus < 2 %(cond)s',args)
+var query_max=repl('SELECT COUNT(*) FROM `tab%(doctype)s` WHERE docstatus < 2 %(cond)s',args)
+return[query,query_max]}
+List2.prototype.build_search_conditions=function(){var cl=new Array();if(this.opts.conditions){for(var i=0;i<this.opts.conditions.length;i++)cl.push(this.opts.conditions);}
+if(this.search_inp.value&&this.search_inp.value!='Search'){for(var i=0;i<this.opts.search_fields.length;i++){cl.push(repl('`%(field)s` LIKE "%(txt)s"',{field:this.opts.search_fields[i],txt:'%'+this.search_inp.value+'%'}));}}
+return cl;}
+List2.prototype.add_filter_condition=function(cl){if(this.opts.filter_by){cl.push(repl('`%(filter)s` = "%(val)s"',{filter:this.opts.filter_by[1],val:this.dcv.columns[this.opts.filter_by[0]].get_selected()}));}
+return cl;}
+List2.prototype.get_selected=function(){if(this.selected_item)return this.selected_item.det[0];else return'';}
+List2Item=function(cell,det,list2){this.det=det;this.list2=list2;this.make_body(cell);this.show_text();this.show_more_info();}
+List2Item.prototype.make_body=function(cell){var me=this;this.body=$a(cell,'div','list2-item-div')
+if(me.list2.opts.next_col){this.make_with_icon();}else{this.content=this.body;}
+this.body.onclick=function(){me.select();if(me.list2.opts.next_col)me.list2.dcv.columns[me.list2.opts.next_col].run();}}
+List2Item.prototype.make_with_icon=function(){var t=make_table(this.body,1,2,'100%',['','18px'])
+$y($td(t,0,1),{verticalAlign:'middle'})
+var img=$a($td(t,0,1),'img');img.src='images/icons/control_play.png';this.content=$td(t,0,0);}
+List2Item.prototype.show_text=function(){var me=this;this.label=$a(this.content,'div','list2-item-title','',this.det[0]);var span=$a(this.label,'span','link_type list2-edit-link','','[Edit]');span.onclick=function(){loaddoc(me.list2.doctype,me.det[0]);}}
+List2Item.prototype.show_more_info=function(){var det=this.det;if(det.length>1){var l=[];for(var i=1;i<det.length;i++){if(det[i]&&det[i]!=det[0])l.push(det[i]);}
+if(l.length)
+this.more_info=$a(this.content,'div','list2-item-more-info','',l.join(', '))}}
+List2Item.prototype.select=function(){if(this.list2.selected_item)this.list2.selected_item.deselect();this.body.className='list2-item-div list2-item-selected';this.list2.selected_item=this;}
+List2Item.prototype.deselect=function(){this.body.className='list2-item-div';}
\ No newline at end of file
diff --git a/setup/page/people/people.html b/setup/page/people/people.html
new file mode 100644
index 0000000..ad31e38
--- /dev/null
+++ b/setup/page/people/people.html
@@ -0,0 +1 @@
+<div id="crm_home"></div>
\ No newline at end of file
diff --git a/setup/page/people/people.js b/setup/page/people/people.js
new file mode 100644
index 0000000..fd316bf
--- /dev/null
+++ b/setup/page/people/people.js
@@ -0,0 +1,32 @@
+//make tabs
+
+pscript.onload_people = function() {
+	make_customer_tab($i('crm_home'));
+}
+
+function make_customer_tab(parent) {	
+	new wn.widgets.DocColumnView('Customers', parent, ['Customer Group', 'Customer', 'Contact'], {
+		'Customer Group': { 
+			show_fields : ['name'],
+			create_fields : ['name'],
+			search_fields : ['name'],
+			next_col: 'Customer'
+		},
+		'Customer': { 
+			show_fields : ['name', 'customer_name'],
+			create_fields : ['name', 'customer_name'],
+			search_fields : ['customer_name'],
+			filter_by : ['Customer Group', 'customer_group'],
+			next_col: 'Contact'
+		},
+		'Contact': { 
+			show_fields : ['name', 'first_name', 'last_name'],
+			create_fields : ['name','first_name', 'last_name'],
+			search_fields : ['first_name', 'last_name'],
+			conditions: ['is_customer=1'],
+			filter_by : ['Customer', 'customer']
+		},
+	})
+}
+
+
diff --git a/setup/page/people/people.txt b/setup/page/people/people.txt
new file mode 100644
index 0000000..3e7bba2
--- /dev/null
+++ b/setup/page/people/people.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-03-21 12:12:32',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-03-21 12:13:39',
+		'modified_by': 'Administrator',
+		'module': 'Setup',
+		'name': 'people',
+		'owner': 'Administrator',
+		'page_name': 'People',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file
diff --git a/setup/page/permission_engine/__init__.py b/setup/page/permission_engine/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/permission_engine/__init__.py
diff --git a/setup/page/permission_engine/permission_engine.comp.js b/setup/page/permission_engine/permission_engine.comp.js
new file mode 100644
index 0000000..f0c9b1c
--- /dev/null
+++ b/setup/page/permission_engine/permission_engine.comp.js
@@ -0,0 +1,75 @@
+
+pscript['onload_Permission Engine']=function(){var h=new PageHeader('pe_header','Permissions Manager','Set specific permissions for Roles')
+if(!pscript.perm_engine)pscript.perm_engine=new pscript.PermEngine();}
+pscript.PermEngine=function(){this.wrapper=$i('perm_engine_div');this.head=$a(this.wrapper,'div');this.body=$a(this.wrapper,'div');this.footer=$a(this.wrapper,'div');var lab=$a(this.body,'div','',{backgroundColor:'#FFD',padding:'8px',margin:'16px 0px'});lab.innerHTML='Please select the item for which you want to set permissions';this.make_head();this.load_options();}
+pscript.PermEngine.prototype.make_head=function(){var me=this;var make_select=function(label){var w=$a(me.head,'div','',{margin:'8px 0px'});var t=make_table(w,1,2,'300px',['50%','50%']);$td(t,0,0).innerHTML=label;var s=$a($td(t,0,1),'select','',{width:'140px'});s.wrapper=w;return s;}
+var make_button=function(label,parent,green){return $btn(parent,label,null,{margin:'8px 0px',display:'none'},(green?'green':null));}
+this.type_select=make_select('Set Permissions For');this.type_select.onchange=function(){me.get_permissions();}
+this.add_button=make_button('+ Add A New Rule',this.head,0);this.add_button.onclick=function(){me.add_permission();}
+this.update_button=make_button('Update',this.footer,1);this.update_button.onclick=function(){me.update_permissions();}}
+pscript.PermEngine.prototype.add_permission=function(){var me=this;if(!this.add_permission_dialog){var d=new Dialog(400,400,'Add Permission');d.make_body([['Select','Role'],['Select','Level'],['Button','Add']])
+add_sel_options(d.widgets['Role'],this.roles,'');add_sel_options(d.widgets['Level'],[0,1,2,3,4,5,6,7,8,9],0);d.widgets['Add'].onclick=function(){if(!sel_val(d.widgets['Role'])){msgprint('Please select Role');return;}
+var callback=function(r,rt){me.get_permissions();d.hide();}
+$c_obj('Permission Control','add_permission',JSON.stringify([sel_val(me.type_select),sel_val(d.widgets['Role']),sel_val(d.widgets['Level'])]),callback);}
+this.add_permission_dialog=d;}
+this.add_permission_dialog.show();}
+pscript.PermEngine.prototype.hide_fields=function(){$dh(this.role_select.wrapper);this.type_select.disabled=false;this.body.innerHTML='';}
+pscript.PermEngine.prototype.load_options=function(){var me=this;$dh(me.update_button);$dh(me.add_button);$c_obj('Permission Control','get_doctype_list','',function(r,rt){me.roles=r.message.roles;empty_select(me.type_select);add_sel_options(me.type_select,add_lists([''],r.message.doctypes));});}
+pscript.PermEngine.prototype.get_permissions=function(){var me=this;if(!sel_val(me.type_select)){msgprint('Please select a type first!');return;}
+$c_obj('Permission Control','get_permissions',sel_val(me.type_select),function(r,rt){if(r.message.perms.length)me.get_results(r.message);else me.body.innerHTML='<div style = "color : red; margin:8px 0px;">No Records Found</div>'});}
+pscript.PermEngine.prototype.get_results=function(r){var perms=r.perms;var me=this;var doctype=sel_val(me.type_select);$ds(me.update_button);$ds(me.add_button);this.body.innerHTML=''
+pscript.all_checkboxes=[];pscript.all_matches=[];var head=$a(this.body,'h3');head.innerHTML='Rules for '+doctype;var permt=make_table(me.body,perms.length+1,9,'80%',[],{border:'1px solid #AAA',padding:'3px',verticalAlign:'middle',height:'30px'});var col_labels=['Role','Level','Read','Write','Create','Submit','Cancel','Amend','Restrict By']
+for(var n=0;n<col_labels.length;n++){$y($td(permt,0,n),{backgroundColor:'#DDD',width:(n==0?'30%':(n==8?'21%':'7%'))})
+$td(permt,0,n).innerHTML=col_labels[n];$td(permt,0,n).fieldname=col_labels[n].toLowerCase();}
+for(var j=0;j<perms.length;j++){var plevel=$a($td(permt,j+1,1),'span','link_type');plevel.innerHTML=perms[j].permlevel;plevel.doctype=doctype;plevel.value=perms[j].permlevel;plevel.onclick=function(){me.get_fields(this.doctype,this.value)}
+$td(permt,j+1,0).innerHTML=perms[j].role;}
+for(var l=0;l<perms.length;l++){for(var m=0;m<6;m++){var chk=$a_input($td(permt,l+1,m+2),'checkbox');var val=perms[l][$td(permt,0,m+2).fieldname];if(val==1)chk.checked=1;else chk.checked=0;chk.doctype=doctype;chk.permlevel=perms[l].permlevel;chk.perm_type=col_labels[m+2].toLowerCase();chk.role=perms[l].role;pscript.all_checkboxes.push(chk);}}
+me.add_match_select(r,perms,permt,doctype);}
+pscript.PermEngine.prototype.add_match_select=function(r,perms,permt,doctype){var me=this;for(var i=0;i<perms.length;i++){if(perms[i].permlevel==0){var sel=$a($td(permt,i+1,8),'select','',{width:'100%'});add_sel_options(sel,r.fields);sel.details=perms[i];sel.details.parent=doctype;sel.onchange=function(){if(sel_val(this)&&sel_val(this)!='owner')$ds(this.div);else $dh(this.div);}
+var div=$a($td(permt,i+1,8),'div','link_type',{marginTop:'2px',fontSize:'10px',display:'none'});div.onclick=function(){this.details.match=sel_val(this.sel);me.show_match_dialog(this.details);}
+div.innerHTML='Set Users / Roles';div.details=perms[i];sel.div=div;div.sel=sel;if(perms[i].match){sel.value=perms[i].match;$ds(div);}
+pscript.all_matches.push(sel);}}}
+pscript.PermEngine.prototype.show_match_dialog=function(details){if(!this.match_defaults_dialog){var d=new Dialog(750,500,'Permission Applies To');d.make_body([['HTML','Body']]);var w=d.widgets['Body'];$y(w,{height:'350px',overflow:'auto'});this.match_defaults_dialog=d;}
+this.match_defaults_dialog.show();var me=this;var callback=function(r,rt){me.render_match_dialog(r,details);}
+$c_obj('Permission Control','get_defaults',details.match+'~~~'+(this.profiles?'No':'Yes'),callback);}
+pscript.PermEngine.prototype.render_match_dialog=function(r,details){var d=this.match_defaults_dialog;var w=d.widgets['Body'];w.innerHTML='<div style="background-color:#FFD; padding: 4px; color: #440; margin-bottom:16px">Please Note: Any action will also affect other permissions with similar rules!</div>'
+var t=make_table($a(w,'div','',{borderBottom:'1px solid #AAA'}),1,3,'90%',['40%','40%','20%'],{fontWeight:'bold',padding:'3px',fontSize:'14px'});$td(t,0,0).innerHTML='Who?';$td(t,0,1).innerHTML='Is allowed if '+details.match+' equals';var dl=r.message.dl;this.options=r.message.ol;if(!this.profiles){this.profiles=r.message.pl;}
+for(var i=0;i<dl.length;i++){new MatchDefaultValue(this,w,dl[i],details.match);}
+this.add_new_match_row(details.match);}
+pscript.PermEngine.prototype.add_new_match_row=function(fieldname){new MatchDefaultValue(this,this.match_defaults_dialog.widgets['Body'],null,fieldname,1);}
+MatchDefaultValue=function(pe,parent,details,fieldname,editable){this.pe=pe;this.wrapper=$a(parent,'div','',{margin:'4px'});this.clear();this.details=details;this.fieldname=fieldname;this.render(editable);}
+MatchDefaultValue.prototype.clear=function(){this.wrapper.innerHTML='';this.tab=make_table(this.wrapper,1,3,'90%',['40%','40%','20%'],{verticalAlign:'middle',padding:'3px'});}
+MatchDefaultValue.prototype.render=function(editable){if(editable){this.render_editable();}else{this.render_static();}}
+MatchDefaultValue.prototype.render_editable=function(){var me=this;this.profile_or_role=$a($td(this.tab,0,0),'select','',{width:'60px',marginRight:'8px'});add_sel_options(this.profile_or_role,['Profile','Role'],'Profile');this.profile_or_role.onchange=function(){if(sel_val(this)=='Profile'){$di(me.profile_sel);$dh(me.role_sel);}
+else{$dh(me.profile_sel);$di(me.role_sel);}}
+this.role_sel=$a($td(this.tab,0,0),'select','',{width:'100px',display:'none'});add_sel_options(this.role_sel,this.pe.roles);this.profile_sel=$a($td(this.tab,0,0),'select','',{width:'100px'});add_sel_options(this.profile_sel,this.pe.profiles);this.options_sel=$a($td(this.tab,0,1),'select','',{width:'120px'});add_sel_options(this.options_sel,this.pe.options);var span=$a($td(this.tab,0,2),'span','link_type',{marginLeft:'8px'});span.innerHTML='Add'
+span.onclick=function(){me.save();}}
+MatchDefaultValue.prototype.render_static=function(){var me=this;$td(this.tab,0,0).innerHTML=this.details.parenttype;$td(this.tab,0,0).innerHTML+='&nbsp;'+this.details.parent;$td(this.tab,0,1).innerHTML=this.details.defvalue;var span=$a($td(this.tab,0,2),'span','link_type',{marginLeft:'8px'});span.innerHTML='Cancel'
+span.onclick=function(){me.delete_def();}}
+MatchDefaultValue.prototype.delete_def=function(){var me=this;this.wrapper.innerHTML='<div style="color: #888; padding: 3px;">Deleting...</div>';var callback=function(r,rt){$dh(me.wrapper);if(r.exc)msgprint('There were errors!')}
+$c_obj('Permission Control','delete_default',[this.details.parent,this.fieldname,this.details.defvalue].join('~~~'),callback)}
+MatchDefaultValue.prototype.save=function(){var me=this;var callback=function(r,rt){me.details=r.message;me.clear();me.render();me.pe.add_new_match_row(me.fieldname);}
+if(sel_val(this.profile_or_role)=='Profile'){var parent=sel_val(this.profile_sel);var parenttype='Profile';}
+else{var parent=sel_val(this.role_sel);var parenttype='Role';}
+if(!sel_val(this.options_sel)||!parent){msgprint("Please select all values");return;}
+$c_obj('Permission Control','add_default',[parent,parenttype,this.fieldname,sel_val(this.options_sel)].join('~~~'),callback);this.wrapper.innerHTML='<div style="color: #888; padding: 3px;">Adding...</div>';}
+pscript.PermEngine.prototype.make_fields_dialog=function(){if(!pscript.get_field_dialog){pscript.get_field_dialog=new Dialog(750,500,'Fields');pscript.get_field_dialog.make_body([['HTML','Fields','<div id="perm_engine_get_fields"></div>'],['Button','OK']]);}
+else $i('perm_engine_get_fields').innerHTML='';}
+pscript.PermEngine.prototype.get_fields=function(dt,permlevel){var me=this;var callback=function(r,rt){var parent_fields_dict=r.message.parent_fields_dict;var table_fields_dict=r.message.table_fields_dict;me.make_fields_dialog();me.make_fields_table(dt,parent_fields_dict,table_fields_dict,permlevel);pscript.get_field_dialog.show();pscript.get_field_dialog.widgets['OK'].onclick=function(){pscript.get_field_dialog.hide();}}
+var args="{'dt':'"+dt+"','permlevel':"+permlevel+"}"
+$c_obj('Permission Control','get_fields',args,callback);}
+pscript.PermEngine.prototype.make_fields_table=function(dt,parent_fields_dict,table_fields_dict,permlevel){var make_grid=function(table,fields_dict){var col_labels=['Label','Fieldtype','Fieldname','Options'];for(var n=0;n<col_labels.length;n++){$a_input(($td(table,0,n)),'data');$td(table,0,n).innerHTML='<b>'+col_labels[n]+'</b>';$td(table,0,n).fieldname=col_labels[n].toLowerCase();}
+for(var i=0;i<keys(fields_dict).length;i++){for(var j=0;j<4;j++){$a_input(($td(table,i+1,j)),'data');$td(table,i+1,j).innerHTML=cstr(fields_dict[i][$td(table,0,j).fieldname])}}}
+$i('perm_engine_get_fields').innerHTML='<b>'+dt+' Fields at Level '+permlevel+':</b><br><br>';var parent_field_table=make_table('perm_engine_get_fields',keys(parent_fields_dict).length+1,4,'100%',['25%','25%','25%','25%'],{border:'1px solid #AAA',padding:'2px'});make_grid(parent_field_table,parent_fields_dict);child_tables=keys(table_fields_dict)
+if(child_tables.length>0){for(var k=0;k<child_tables.length;k++){var tab_fields_det=table_fields_dict[child_tables[k]];if(keys(tab_fields_det).length>0){$i('perm_engine_get_fields').innerHTML+='<br><b>'+child_tables[k]+' Fields at Level '+permlevel+':</b><br><br>'
+var child_field_table=make_table('perm_engine_get_fields',keys(tab_fields_det).length+1,4,'100%',['25%','25%','25%','25%'],{border:'1px solid #AAA',padding:'2px'});make_grid(child_field_table,tab_fields_det);}}}}
+pscript.PermEngine.prototype.update_permissions=function(){var me=this;var out={};var add_to_out=function(doctype,permlevel,role,key,value){if(!out[doctype])out[doctype]={};if(!out[doctype][permlevel])out[doctype][permlevel]={};if(!out[doctype][permlevel][role])out[doctype][permlevel][role]={};out[doctype][permlevel][role][key]=value;}
+for(i in pscript.all_checkboxes){c=pscript.all_checkboxes[i];add_to_out(c.doctype,c.permlevel,c.role,c.perm_type,c.checked?1:0);}
+for(var i=0;i<pscript.all_matches.length;i++){var s=pscript.all_matches[i];if(sel_val(s))
+add_to_out(s.details.parent,s.details.permlevel,s.details.role,'match',sel_val(s));}
+var args="{'perm_dict': "+JSON.stringify(out)+"}"
+$c_obj('Permission Control','update_permissions',args,function(r,rt){});}
+pscript.PermEngine.prototype.update_page_roles=function(){var me=this;var out={};for(i in pscript.all_pg_checkboxes){c=pscript.all_pg_checkboxes[i];out[c.page_name]=c.checked?1:0}
+var args="{'page_role_dict': "+JSON.stringify(out)+", 'role': '"+sel_val(me.role_select)+"'}"
+$c_obj('Permission Control','update_page_role',args,function(r,rt){});}
+pscript.PermEngine.prototype.reset_perm_engine=function(){this.type_select.selectedIndex=0;this.load_options();}
\ No newline at end of file
diff --git a/setup/page/permission_engine/permission_engine.html b/setup/page/permission_engine/permission_engine.html
new file mode 100644
index 0000000..1b9cab2
--- /dev/null
+++ b/setup/page/permission_engine/permission_engine.html
@@ -0,0 +1,4 @@
+<div class="layout_wrapper">
+<div id="pe_header"></div>
+<div id="perm_engine_div" style="margin: 16px;"></div>
+</div>
\ No newline at end of file
diff --git a/setup/page/permission_engine/permission_engine.js b/setup/page/permission_engine/permission_engine.js
new file mode 100644
index 0000000..378ad0c
--- /dev/null
+++ b/setup/page/permission_engine/permission_engine.js
@@ -0,0 +1,525 @@
+pscript['onload_Permission Engine'] = function() {
+  // header and toolbar
+  var h = new PageHeader('pe_header','Permissions Manager','Set specific permissions for Roles')
+  
+  if(!pscript.perm_engine) pscript.perm_engine = new pscript.PermEngine();
+}
+
+
+pscript.PermEngine = function() {
+  // create UI elements
+  this.wrapper = $i('perm_engine_div');
+  
+  this.head = $a(this.wrapper, 'div');
+  this.body = $a(this.wrapper, 'div');
+  this.footer = $a(this.wrapper, 'div');
+
+  var lab = $a(this.body,'div', '', {backgroundColor:'#FFD', padding:'8px', margin:'16px 0px'});
+  lab.innerHTML = 'Please select the item for which you want to set permissions';
+  
+  this.make_head();
+  this.load_options();
+}
+
+
+// Make Head
+// -------------
+pscript.PermEngine.prototype.make_head = function() {
+  var me = this;
+  
+  var make_select = function(label) {
+    var w = $a(me.head, 'div', '', {margin:'8px 0px'});
+    var t = make_table(w,1,2,'300px',['50%','50%']);
+    $td(t,0,0).innerHTML = label;
+    var s = $a($td(t,0,1),'select','',{width:'140px'});
+    s.wrapper = w;
+    return s;
+  }
+  
+  var make_button = function(label, parent, green) {
+  	return $btn(parent, label, null, {margin:'8px 0px', display:'none'}, (green ? 'green' : null));
+  }
+  
+  
+  // Set Permissions for
+  this.type_select = make_select('Set Permissions For');
+  this.type_select.onchange = function() {
+  	me.get_permissions();
+  }
+    
+  // Update Button
+  this.add_button = make_button('+ Add A New Rule', this.head, 0);
+  this.add_button.onclick = function() {
+    me.add_permission();
+  }
+
+  // Update Button
+  this.update_button = make_button('Update', this.footer, 1);
+  this.update_button.onclick = function() {
+    me.update_permissions();
+  }
+}
+
+// Add Permissions
+// -----------------
+pscript.PermEngine.prototype.add_permission = function() {
+  var me = this;
+  if(!this.add_permission_dialog) {
+  	
+  	// dialog
+    var d = new Dialog(400,400,'Add Permission');
+    d.make_body([['Select','Role'],['Select','Level'],['Button','Add']])
+
+    add_sel_options(d.widgets['Role'], this.roles, '');
+    add_sel_options(d.widgets['Level'], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 0);
+
+    // add
+    d.widgets['Add'].onclick = function() {
+      if(!sel_val(d.widgets['Role'])) {
+        msgprint('Please select Role'); return;
+      }
+      var callback = function(r, rt) {
+      	// reload
+        me.get_permissions();
+        d.hide();
+      }
+      $c_obj('Permission Control','add_permission',JSON.stringify([sel_val(me.type_select), sel_val(d.widgets['Role']), sel_val(d.widgets['Level'])]), callback);
+    }
+
+    this.add_permission_dialog = d;
+  }
+  this.add_permission_dialog.show();
+}
+
+
+// Hide Fields
+// -----------------
+pscript.PermEngine.prototype.hide_fields = function() {
+  $dh(this.role_select.wrapper);
+  this.type_select.disabled = false;
+  this.body.innerHTML = '';
+}
+
+
+// Load Roles And Modules
+// -----------------------
+pscript.PermEngine.prototype.load_options = function() {
+  var me = this;
+  $dh(me.update_button);
+  $dh(me.add_button);
+
+  $c_obj('Permission Control','get_doctype_list','', function(r,rt) {    
+    me.roles = r.message.roles;
+    
+    // Type
+    empty_select(me.type_select);
+    add_sel_options(me.type_select,add_lists([''], r.message.doctypes));
+    
+  });
+}
+
+
+// Get DocType and Permissions related to module
+// --------------------------------------------------
+pscript.PermEngine.prototype.get_permissions = function() {
+  var me = this;
+  
+  if(!sel_val(me.type_select)) {
+  	msgprint('Please select a type first!'); return;
+  }
+  
+  $c_obj('Permission Control','get_permissions',sel_val(me.type_select), function(r,rt) {    
+     // Get permissions
+    if(r.message.perms.length)me.get_results(r.message);
+    else me.body.innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>'
+  });
+}
+
+// Get Results
+// ------------------
+pscript.PermEngine.prototype.get_results = function(r){
+  var perms = r.perms;
+  var me = this;
+  var doctype = sel_val(me.type_select);
+  
+  // show update button
+  $ds(me.update_button);
+  $ds(me.add_button);
+
+  this.body.innerHTML = ''
+  pscript.all_checkboxes = [];
+  pscript.all_matches = [];
+  
+  var head = $a(this.body, 'h3'); head.innerHTML = 'Rules for ' + doctype;        
+  var permt = make_table(me.body, perms.length+1,9,'80%',[],{border:'1px solid #AAA', padding:'3px', verticalAlign:'middle', height:'30px'});
+    
+  // Create Grid for particular DocType
+  // ------------------------------------
+    
+  // Columns
+  var col_labels = ['Role','Level','Read','Write','Create','Submit','Cancel','Amend','Restrict By']
+  for(var n = 0; n < col_labels.length; n++){
+  	$y($td(permt,0,n), {backgroundColor:'#DDD', width:(n==0?'30%':(n==8?'21%':'7%'))})
+    $td(permt,0,n).innerHTML = col_labels[n];
+    $td(permt,0,n).fieldname = col_labels[n].toLowerCase();
+  }
+    
+  // Rows for Column Level / Role
+  for(var j = 0; j < perms.length; j++){
+    var plevel = $a($td(permt,j+1,1), 'span', 'link_type');
+    plevel.innerHTML = perms[j].permlevel;
+    plevel.doctype = doctype;
+    plevel.value = perms[j].permlevel;
+    plevel.onclick = function() {me.get_fields(this.doctype, this.value)}
+
+    // role
+    $td(permt,j+1,0).innerHTML = perms[j].role;
+
+  }  
+    
+  // Get values
+  for(var l = 0; l < perms.length; l++){
+    for(var m = 0; m < 6; m++){                             // (read,write,create,submit,cancel,amend) 
+      var chk = $a_input($td(permt,l+1,m+2), 'checkbox');
+      var val = perms[l][$td(permt,0,m+2).fieldname];
+      if(val == 1) chk.checked = 1;
+      else chk.checked = 0;
+      chk.doctype = doctype;
+      chk.permlevel = perms[l].permlevel; chk.perm_type = col_labels[m+2].toLowerCase(); chk.role = perms[l].role;
+      pscript.all_checkboxes.push(chk);
+    }
+  }
+  
+  // add selects for match
+  me.add_match_select(r, perms, permt, doctype);
+}
+
+// render selects for match
+// --------------------------------------------
+
+pscript.PermEngine.prototype.add_match_select = function(r, perms, permt, doctype) {
+  var me = this;
+  
+  // add select for match
+  for(var i=0; i<perms.length; i++) {
+    if(perms[i].permlevel==0) {
+      // select
+      var sel = $a($td(permt,i+1,8),'select','',{width:'100%'});
+      add_sel_options(sel, r.fields);
+      sel.details = perms[i]; sel.details.parent = doctype;
+      sel.onchange = function() { 
+      	if(sel_val(this) && sel_val(this)!='owner') $ds(this.div); 
+      	else $dh(this.div); }
+      
+      // link
+      var div = $a($td(permt,i+1,8),'div','link_type',{marginTop: '2px', fontSize:'10px', display:'none'});
+      div.onclick = function() { this.details.match = sel_val(this.sel); me.show_match_dialog(this.details); }
+      div.innerHTML = 'Set Users / Roles';
+      div.details = perms[i];
+      sel.div = div; div.sel = sel;
+
+      // set the value
+      if(perms[i].match) { sel.value = perms[i].match; $ds(div); }
+      
+      pscript.all_matches.push(sel);
+    }
+  }
+}
+
+// match users Dialog
+// =======================================================
+
+pscript.PermEngine.prototype.show_match_dialog=function(details) {
+  if(!this.match_defaults_dialog) {
+    var d = new Dialog(750, 500, 'Permission Applies To');
+    d.make_body([['HTML','Body']]);
+    var w = d.widgets['Body'];
+    $y(w,{height:'350px', overflow:'auto'});
+    this.match_defaults_dialog = d;
+  }
+  
+  // dialog
+  this.match_defaults_dialog.show();
+  
+  // render the rules
+  var me = this;
+  var callback = function(r,rt) {
+  	me.render_match_dialog(r, details);
+  }
+  // load the rules
+  $c_obj('Permission Control','get_defaults', details.match + '~~~' + (this.profiles ? 'No' : 'Yes'), callback); 
+}
+
+// --------------------------------------------
+
+pscript.PermEngine.prototype.render_match_dialog=function(r, details) {
+  var d = this.match_defaults_dialog;
+  var w = d.widgets['Body'];
+  w.innerHTML = '<div style="background-color:#FFD; padding: 4px; color: #440; margin-bottom:16px">Please Note: Any action will also affect other permissions with similar rules!</div>'
+  
+  // header
+  var t=make_table($a(w,'div','',{borderBottom:'1px solid #AAA'}),1,3,'90%',['40%','40%','20%'],{fontWeight:'bold', padding:'3px', fontSize:'14px'});
+  $td(t,0,0).innerHTML = 'Who?'; $td(t,0,1).innerHTML = 'Is allowed if '+details.match+' equals';
+  
+  // existing defaults
+  var dl = r.message.dl; this.options = r.message.ol;
+  if(!this.profiles) {
+    this.profiles = r.message.pl;
+  }
+  
+  for(var i=0; i<dl.length; i++) {
+    new MatchDefaultValue(this, w, dl[i], details.match);
+  }
+  
+  this.add_new_match_row(details.match);
+}
+
+pscript.PermEngine.prototype.add_new_match_row = function(fieldname) {
+  // add new default
+  new MatchDefaultValue(this, this.match_defaults_dialog.widgets['Body'], null, fieldname, 1);
+}  
+  
+// --------------------------------------------
+
+MatchDefaultValue = function(pe, parent, details, fieldname, editable) {
+  this.pe = pe;
+  this.wrapper = $a(parent, 'div', '', {margin:'4px'});
+  this.clear();
+  this.details = details;
+  this.fieldname = fieldname;
+  this.render(editable);
+}
+
+
+// --------------------------------------------
+
+MatchDefaultValue.prototype.clear = function() {
+  this.wrapper.innerHTML = '';
+  this.tab = make_table(this.wrapper, 1, 3, '90%', ['40%','40%','20%'], {verticalAlign:'middle', padding:'3px'});
+}
+
+// --------------------------------------------
+
+MatchDefaultValue.prototype.render = function(editable) {
+
+  if(editable) {
+  	this.render_editable();
+  } else {
+    this.render_static();
+  }
+}
+
+// --------------------------------------------
+
+MatchDefaultValue.prototype.render_editable = function() {
+  var me = this;
+
+  // profile or role
+  this.profile_or_role = $a($td(this.tab,0,0), 'select', '', {width:'60px', marginRight:'8px'});
+  add_sel_options(this.profile_or_role,['Profile', 'Role'], 'Profile');
+  this.profile_or_role.onchange = function() {
+    if(sel_val(this)=='Profile') { $di(me.profile_sel); $dh(me.role_sel); }
+    else { $dh(me.profile_sel); $di(me.role_sel); }
+  }
+
+  // role sel
+  this.role_sel = $a($td(this.tab,0,0), 'select', '', {width:'100px',display:'none'});
+  add_sel_options(this.role_sel,this.pe.roles);
+  
+  // profile sel
+  this.profile_sel = $a($td(this.tab,0,0), 'select', '', {width:'100px'});
+  add_sel_options(this.profile_sel,this.pe.profiles);
+
+  // options sel
+  this.options_sel = $a($td(this.tab,0,1), 'select', '', {width:'120px'});
+  add_sel_options(this.options_sel,this.pe.options);
+
+   // add
+  var span = $a($td(this.tab,0,2),'span','link_type',{marginLeft:'8px'});
+  span.innerHTML = 'Add'
+  span.onclick = function() { me.save(); }
+}
+
+// --------------------------------------------
+
+MatchDefaultValue.prototype.render_static = function() {
+  var me = this;
+  
+  $td(this.tab,0,0).innerHTML = this.details.parenttype;
+  $td(this.tab,0,0).innerHTML += '&nbsp;' + this.details.parent;
+  $td(this.tab,0,1).innerHTML = this.details.defvalue;
+
+   // delete
+  var span = $a($td(this.tab,0,2),'span','link_type',{marginLeft:'8px'});
+  span.innerHTML = 'Cancel'
+  span.onclick = function() { me.delete_def(); }
+}
+
+// --------------------------------------------
+
+MatchDefaultValue.prototype.delete_def = function() {	
+  var me = this;
+  this.wrapper.innerHTML = '<div style="color: #888; padding: 3px;">Deleting...</div>';
+  var callback = function(r,rt) {
+  	$dh(me.wrapper);
+    if(r.exc) msgprint('There were errors!')
+  }
+  $c_obj('Permission Control','delete_default'
+    ,[this.details.parent, this.fieldname, this.details.defvalue].join('~~~')
+    ,callback)
+}
+
+// --------------------------------------------
+
+MatchDefaultValue.prototype.save = function() {
+  var me= this;
+  
+  var callback = function(r,rt) {
+    me.details = r.message;
+    me.clear();
+    me.render();
+    me.pe.add_new_match_row(me.fieldname);
+  }
+  	
+  // values
+  if(sel_val(this.profile_or_role)=='Profile') { var parent = sel_val(this.profile_sel); var parenttype = 'Profile'; }
+  else { var parent = sel_val(this.role_sel); var parenttype = 'Role'; }
+
+  if(!sel_val(this.options_sel) || !parent) { msgprint("Please select all values"); return; }
+  	
+  $c_obj('Permission Control','add_default'
+    ,[parent, parenttype, this.fieldname, sel_val(this.options_sel)].join('~~~')
+    ,callback);
+      
+  this.wrapper.innerHTML = '<div style="color: #888; padding: 3px;">Adding...</div>';
+}
+
+
+// Make Dialog Box To Get Fields fro PermLevel
+// =======================================================
+
+pscript.PermEngine.prototype.make_fields_dialog=function(){
+  if(!pscript.get_field_dialog) {
+    pscript.get_field_dialog = new Dialog(750,500,'Fields');
+    pscript.get_field_dialog.make_body([['HTML','Fields','<div id="perm_engine_get_fields"></div>'],['Button','OK']]);
+  }
+  else $i('perm_engine_get_fields').innerHTML = '';
+}
+
+// Get Fields
+// --------------------
+pscript.PermEngine.prototype.get_fields = function(dt, permlevel) {
+  var me = this;
+  var callback = function(r,rt){
+    // Get Parent DocType Fields
+    var parent_fields_dict = r.message.parent_fields_dict;
+    
+    // Get Child Table Fields if any
+    var table_fields_dict = r.message.table_fields_dict;
+    
+    // Make Fields Dialog Box
+    me.make_fields_dialog();
+    
+    me.make_fields_table(dt, parent_fields_dict, table_fields_dict, permlevel);
+    
+    pscript.get_field_dialog.show();
+    pscript.get_field_dialog.widgets['OK'].onclick=function(){
+      pscript.get_field_dialog.hide();
+    }
+  }
+  var args = "{'dt':'"+dt+"','permlevel':"+permlevel+"}"
+  $c_obj('Permission Control','get_fields', args, callback);
+}
+
+
+
+// Make Table of Fields for Dialog Box
+// --------------------------------------
+pscript.PermEngine.prototype.make_fields_table = function(dt, parent_fields_dict, table_fields_dict, permlevel) {
+  
+  var make_grid = function(table, fields_dict) {
+    var col_labels = ['Label','Fieldtype','Fieldname','Options'];
+    for(var n = 0; n < col_labels.length; n++){
+      $a_input(($td(table,0,n)), 'data');
+      $td(table,0,n).innerHTML = '<b>'+col_labels[n]+'</b>';
+      $td(table,0,n).fieldname = col_labels[n].toLowerCase();
+    }
+    
+    // Add values
+    for(var i = 0; i < keys(fields_dict).length; i++){
+      for(var j = 0; j < 4; j++){
+        $a_input(($td(table,i+1,j)), 'data');
+        $td(table,i+1,j).innerHTML = cstr(fields_dict[i][$td(table,0,j).fieldname])
+      }
+    }
+  }
+
+  
+  $i('perm_engine_get_fields').innerHTML = '<b>'+ dt + ' Fields at Level '+ permlevel +':</b><br><br>';
+  var parent_field_table = make_table('perm_engine_get_fields',keys(parent_fields_dict).length+1, 4,'100%',['25%','25%','25%','25%'],{border:'1px solid #AAA',padding:'2px'});
+  make_grid(parent_field_table, parent_fields_dict);
+  
+  child_tables = keys(table_fields_dict)
+  if(child_tables.length > 0){
+    for(var k = 0; k < child_tables.length; k++){
+      var tab_fields_det = table_fields_dict[child_tables[k]];
+      if(keys(tab_fields_det).length > 0){
+        $i('perm_engine_get_fields').innerHTML += '<br><b>'+ child_tables[k] + ' Fields at Level '+ permlevel +':</b><br><br>'
+        var child_field_table = make_table('perm_engine_get_fields',keys(tab_fields_det).length+1, 4,'100%',['25%','25%','25%','25%'],{border:'1px solid #AAA',padding:'2px'});
+        make_grid(child_field_table, tab_fields_det);
+      }
+    }
+  }
+}
+
+
+// Update Permissions
+// -----------------------
+pscript.PermEngine.prototype.update_permissions = function() {
+  var me = this;
+  var out = {};
+
+  var add_to_out = function(doctype, permlevel, role, key, value) {
+    if(!out[doctype]) out[doctype] = {};
+    if(!out[doctype][permlevel]) out[doctype][permlevel] = {};
+    if(!out[doctype][permlevel][role]) out[doctype][permlevel][role] = {};
+    out[doctype][permlevel][role][key] = value; 
+  }
+
+  // check boxes
+  for(i in pscript.all_checkboxes) {
+    c = pscript.all_checkboxes[i];
+    add_to_out(c.doctype, c.permlevel, c.role, c.perm_type, c.checked ? 1 : 0);
+  }
+
+  // matches
+  for(var i=0; i<pscript.all_matches.length; i++) {
+  	var s = pscript.all_matches[i];
+    if(sel_val(s))
+      add_to_out(s.details.parent, s.details.permlevel, s.details.role, 'match', sel_val(s));
+  }
+  
+  var args = "{'perm_dict': "+JSON.stringify(out)+"}"
+  $c_obj('Permission Control','update_permissions', args, function(r,rt) {});
+}
+
+
+// Update Page Roles
+// ----------------------
+pscript.PermEngine.prototype.update_page_roles = function() {
+  var me = this;
+  var out = {};
+  for(i in pscript.all_pg_checkboxes) {
+    c = pscript.all_pg_checkboxes[i];
+    out[c.page_name] = c.checked ? 1 : 0
+  }
+  var args = "{'page_role_dict': "+JSON.stringify(out)+", 'role': '"+sel_val(me.role_select)+"'}"
+  $c_obj('Permission Control','update_page_role', args, function(r,rt) {});
+}
+
+// Reset Permission Engine
+// -------------------------
+pscript.PermEngine.prototype.reset_perm_engine = function(){
+  this.type_select.selectedIndex = 0;
+  this.load_options();
+}
diff --git a/setup/page/permission_engine/permission_engine.txt b/setup/page/permission_engine/permission_engine.txt
new file mode 100644
index 0000000..72ef01c
--- /dev/null
+++ b/setup/page/permission_engine/permission_engine.txt
@@ -0,0 +1 @@
+[{'creation': '2010-01-07 10:44:43', 'module': 'Setup', 'doctype': 'Page', 'owner': 'saumil@webnotestech.com', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 1, 'content': None, 'page_name': 'Permission Engine', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Permission Engine', 'idx': None, 'static_content': None, 'modified': '2010-11-18 20:24:21', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000107', 'parent': 'Permission Engine', 'creation': '2010-01-07 11:10:21', 'modified': '2010-11-18 20:24:21', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'System Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/setup/page/setup/__init__.py b/setup/page/setup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/setup/__init__.py
diff --git a/setup/page/setup/setup.comp.js b/setup/page/setup/setup.comp.js
new file mode 100644
index 0000000..59d31b4
--- /dev/null
+++ b/setup/page/setup/setup.comp.js
@@ -0,0 +1,32 @@
+
+pscript.onload_Setup=function(){var parent=$i('setup_div');add_space_holder(parent);var callback=function(r,rt){parent.page_head=new PageHeader(parent,'Setup');var setup_data=new SetupData(r.message);pscript.setup_make_sections(setup_data);remove_space_holder();}
+$c_obj('Setup Wizard Control','get_country','',callback);}
+pscript.setup_set_height=function(){var parent=$i('setup_div');$y(parent.tray.body,{height:get_window_height()-parent.page_head.wrapper.offsetHeight+'px',overflow:'auto'})}
+pscript.setup_make_sections=function(setup_data){var parent=$i('setup_div');parent.tray=new TrayPage(parent)
+var lst=[setup_data.system,setup_data.general,setup_data.accounts,setup_data.selling,setup_data.buying,setup_data.stock,setup_data.hr,setup_data.maintenance,setup_data.production];for(var s=0;s<lst.length;s++){var lbl=keys(lst[s])[0];var ti=parent.tray.add_item(lbl,null,null,1)
+new SetupItem(ti.body,lbl,lst[s][lbl]);if(s==0)ti.expand();}
+setTimeout(pscript.setup_set_height,100);resize_observers.push(pscript.setup_set_height);}
+SetupItem=function(parent,lbl,link_list){this.icons={'System':'back_img Setup','General':'back_img Home','Accounts':'back_img Accounts','Selling':'back_img Selling','Stock':'back_img Stock','Buying':'back_img Buying','Maintenance':'back_img Maintenance','Production':'back_img Production','HR':'back_img HR'};this.make_item_body(parent,lbl,link_list);}
+SetupItem.prototype.make_item_body=function(parent,lbl,link_list){this.link_area=parent;this.render_item_body(lbl,link_list);}
+SetupItem.prototype.render_item_body=function(lbl,link_list){var me=this;link_list.sort(function(a,b){return a[0]>b[0];});for(var i=0;i<link_list.length;i++){var wrapper=$a(this.link_area,'div','',{marginBottom:'4px',padding:'2px'});$(wrapper).hover(function(){$y(this,{backgroundColor:'#EEF'})},function(){$y(this,{backgroundColor:''})})
+var tab=make_table($a(wrapper,'div'),1,2,'100%',[200/7+'%',500/7+'%'])
+var dt=$a($td(tab,0,0),'span','link_type');dt.innerHTML=link_list[i][0];dt.label=link_list[i][0];dt.arg=link_list[i][1];dt.nm=link_list[i][2];if(dt.arg==1)dt.cn=link_list[i][3];else if(dt.arg==2)dt.cb=link_list[i][3];dt.onclick=function(){me.link_action(this)}
+$y($td(tab,0,1),{color:'#777'});$td(tab,0,1).innerHTML=link_list[i][4];}}
+SetupItem.prototype.link_action=function(obj){var me=this;var obj=obj;if(obj.arg==1){if(in_list(profile.can_read,obj.nm)){if(obj.cn!='')
+loaddocbrowser(obj.nm,obj.nm,obj.cn);else
+loaddocbrowser(obj.nm);}
+else
+msgprint('No read permission',1);}
+else if(obj.arg==2){me.show_page(obj);}
+else if(obj.arg==3){newdoc(obj.nm);}}
+SetupItem.prototype.show_page=function(obj){var me=obj;var callback=function(r,rt)
+{if(r.message){if(me.cb=='')
+loadpage(me.nm);else
+show_chart_browser(me.nm,me.cb);}
+else
+msgprint('No read permission',1);}
+$c_obj('Setup Wizard Control','get_page_lst',me.nm,callback);}
+SetupData=function(cnty){this.system={'System':[['Global Defaults',3,'Manage Account','','Set global default values'],['Manage Series',3,'Naming Series','','Manage numbering series for transactions'],['Custom Field',1,'Custom Field','dt'+NEWLINE+'label'+NEWLINE+'fieldtype'+NEWLINE+'options','Add and manage custom fields on forms'],['Email Settings',3,'Email Settings','','Outgoing email server and address'],['Notification Settings',3,'Notification Control','','Automatic emails set at selected events'],['Company',1,'Company','id'+NEWLINE+'is_active'+NEWLINE+'email','Manage list of companies'],['Fiscal Year',1,'Fiscal Year','id'+NEWLINE+'company'+NEWLINE+'is_active'+NEWLINE+'year','Manage list of fiscal years'],['Personalize',3,'Personalize','','Set your banner'],['Manage Trash',2,'Trash','','Restore trashed items'],['Import Data',2,'Import Data','','Import data from CSV files'],['Manage Users',2,'My Company','','Add / remove users and manage their roles'],['Web Forms',2,'Webforms','','Code to embed forms in yor website'],['Permissions Manager',2,'Permission Engine','','Manage all permissions from one tool (beta)'],['Property Setter',1,'Property Setter','','Customize properties of a Form (DocType) or Field'],['Letter Head',1,'Letter Head','','Manage different letter heads for Prints'],['SMS Settings',3,'SMS Settings','','Integrate your personalized SMS gateway which support http web service'],['SMS Center',3,'SMS Center','','Send mass sms to your leads, contacts and partners']]};this.general={'General':[['Authorization Rule',1,'Authorization Rule','','Set rules based on amounts'],['Print Heading',1,'Print Heading','','Manage headings for printing transactions'],['Term',1,'Term','','Manage template of standard Terms for order / invoices etc'],['Currency',1,'Currency','','Manage list of currencies'],['Country',1,'Country','','Country master'],['State',1,'State','','State master'],['Activty Type',1,'Activity Type','','Types of activities that you can select in your Timesheet'],['City',1,'City','','City master']]};this.selling={'Selling':[['Customer Group',2,'Sales Browser','Customer Group','Manage customer categories'],['Territory',2,'Sales Browser','Territory','Manage sales territories'],['Customer',1,'Customer','customer_group'+NEWLINE+'country','Customer master'],['Sales Person',2,'Sales Browser','Sales Person','Manage sales persons'],['Sales Partner',1,'Sales Partner','','Manage sales partners'],['Campaign',1,'Campaign','id'+NEWLINE+'campaign_name'+NEWLINE+'description','Manage sales / marketing campaigns'],['Sales BOM',1,'Sales BOM','id'+NEWLINE+'is_active'+NEWLINE+'new_item_name'+NEWLINE+'description'+NEWLINE+'item_group','Manage Sales Bill of Material (Main item + accessories)'],['Price List',1,'Price List','','Price list master']]};this.accounts={'Accounts':[['Chart of Accounts',2,'Accounts Browser','Account','Manage chart of accounts'],['Chart of Cost Centers',2,'Accounts Browser','Cost Center','Manage chart of cost centers'],['POS Setting',1,'POS Setting','','Manage Point of Sales default Settings.']]};if(cnty=='India'){var lst1=[['TDS Rate Chart',1,'TDS Rate Chart','','TDS rate master'],['TDS Category',1,'TDS Category','id'+NEWLINE+'module','TDS categories']];for(var i=0;i<lst1.length;i++)
+this.accounts['Accounts'].push(lst1[i]);}
+var lst=[['Monthly Distribution',1,'Budget Distribution','id'+NEWLINE+'fiscal_year'+NEWLINE+'distribution_id','Manage budget distributions (seasonalities)'],['Sales Other Charges',1,'Other Charges','','Manage your charge structures (taxes + charges) for sales'],['Purchase Other Charges',1,'Purchase Other Charges','','Manage your charge structures (taxes + charges) for purchase'],['Mode of Payment',1,'Mode of Payment','','Mode of payment master']];for(var i=0;i<lst.length;i++)
+this.accounts['Accounts'].push(lst[i]);this.stock={'Stock':[['Item Group',2,'Sales Browser','Item Group','Manage item classifications'],['Item',1,'Item','name'+NEWLINE+'item_group'+NEWLINE+'description','Item master'],['Brand',1,'Brand','id'+NEWLINE+'description','Brand master'],['Batch',1,'Batch','name'+NEWLINE+'start_date'+NEWLINE+'item'+NEWLINE+'expiry_date','Manage batches'],['Price List',1,'Price List','','Price list master'],['UOM',1,'UOM','','Unit of measure (UOM) master'],['Warehouse Type',1,'Warehouse Type','','Warehouse classifications'],['Warehouse',1,'Warehouse','','Warehouse master']]};this.buying={'Buying':[['Supplier Type',1,'Supplier Type','','Manage supplier classifications'],['Supplier',1,'Supplier','id'+NEWLINE+'supplier_type'+NEWLINE+'supplier_status'+NEWLINE+'company','Supplier master']]};this.maintenance={'Maintenance':[['Serial No',1,'Serial No','item_code'+NEWLINE+'status'+NEWLINE+'pr_no'+NEWLINE+'delivery_note_no'+NEWLINE+'customer_name','Manage unique serial numbers for items'],['Purpose of Service',1,'Purpose of Service','','Purpose of service master']]};this.production={'Production':[['Bill of Materials',1,'Bill Of Materials','id'+NEWLINE+'item'+NEWLINE+'description'+NEWLINE+'operating_cost'+NEWLINE+'maintained_by','Muti-level bill of materials and operations'],['Workstation',1,'Workstation','id'+NEWLINE+'workstation_name'+NEWLINE+'warehouse'+NEWLINE+'description','Workstation master']]};this.hr={'HR':[['Department',1,'Department','','Company department master'],['Designation',1,'Designation','','Company designation master'],['Branch',1,'Branch','','Manage branches for your company'],['Grade',1,'Grade','','Manage employee grades'],['Employment Type',1,'Employment Type','','Manage types of employment'],['Employee',1,'Employee','employee_name'+NEWLINE+'employment_type'+NEWLINE+'status'+NEWLINE+'branch'+NEWLINE+'designation'+NEWLINE+'department'+NEWLINE+'grade'+NEWLINE+'reports_to','Employee master'],['Earning Type',1,'Earning Type','taxable'+NEWLINE+'exemption_limit','Types of salary earning master'],['Deduction Type',1,'Deduction Type','','Types of salary deduction master'],['Expense Type',1,'Expense Type','','Types of expense master'],['Salary Structure',1,'Salary Structure','employee'+NEWLINE+'is_active'+NEWLINE+'fiscal_year'+NEWLINE+'from_date'+NEWLINE+'ctc'+NEWLINE+'total_earning'+NEWLINE+'total_deduction'+NEWLINE+'total','Salary structure template'],['Holiday List',1,'Holiday List','fiscal_year','List of holidays'],['Leave Type',1,'Leave Type','max_days_allowed'+NEWLINE+'is_carry_forward'+NEWLINE+'is_encash','Leave type master'],['KRA Template',1,'KRA Template','','Template of Key Result Areas (KRAs)']]};}
\ No newline at end of file
diff --git a/setup/page/setup/setup.html b/setup/page/setup/setup.html
new file mode 100644
index 0000000..e60d00b
--- /dev/null
+++ b/setup/page/setup/setup.html
@@ -0,0 +1 @@
+<div id="setup_div" class="layout_wrapper"></div>
\ No newline at end of file
diff --git a/setup/page/setup/setup.js b/setup/page/setup/setup.js
new file mode 100644
index 0000000..645fbd1
--- /dev/null
+++ b/setup/page/setup/setup.js
@@ -0,0 +1,253 @@
+pscript.onload_Setup = function() {
+  var parent = $i('setup_div');
+  add_space_holder(parent);
+
+  var callback = function(r,rt){
+
+    // header
+    parent.page_head = new PageHeader(parent,'Setup');
+    
+    // sections
+    var setup_data = new SetupData(r.message);
+    pscript.setup_make_sections(setup_data);
+    
+    remove_space_holder();
+  }
+  $c_obj('Setup Wizard Control','get_country','',callback);  
+}
+
+pscript.setup_set_height = function() {
+  var parent = $i('setup_div');
+  $y(parent.tray.body, {height: get_window_height() - parent.page_head.wrapper.offsetHeight + 'px', overflow:'auto'})
+}
+
+// Make sections
+// ===================================================
+
+pscript.setup_make_sections = function(setup_data) {
+  var parent = $i('setup_div');
+  parent.tray = new TrayPage(parent)
+
+  // list of setup data
+  var lst = [setup_data.system, setup_data.general, setup_data.accounts, setup_data.selling, setup_data.buying, setup_data.stock, setup_data.hr, setup_data.maintenance, setup_data.production];
+
+  for(var s=0; s<lst.length; s++){
+    var lbl = keys(lst[s])[0];
+
+    var ti = parent.tray.add_item(lbl, null, null, 1)
+    new SetupItem(ti.body, lbl, lst[s][lbl]);
+
+    if(s==0) ti.expand();
+  }
+  
+  setTimeout(pscript.setup_set_height, 100);
+  resize_observers.push(pscript.setup_set_height);
+}
+
+// Setup Item
+// ===================================================
+SetupItem = function(parent, lbl, link_list) {
+  this.icons = {'System':'back_img Setup', 'General':'back_img Home', 'Accounts':'back_img Accounts', 'Selling':'back_img Selling', 'Stock':'back_img Stock', 'Buying':'back_img Buying', 'Maintenance':'back_img Maintenance', 'Production':'back_img Production', 'HR':'back_img HR'};
+  this.make_item_body(parent, lbl, link_list);
+}
+
+
+// Make body for item in setup wizard
+// ===================================================
+SetupItem.prototype.make_item_body = function(parent, lbl, link_list){
+  // item link area
+  this.link_area = parent;
+  this.render_item_body(lbl, link_list);
+}
+
+
+// Render item body
+// ===================================================
+SetupItem.prototype.render_item_body = function(lbl, link_list) {
+  var me = this;
+  // set item header
+
+  link_list.sort(function(a, b) { return a[0] > b[0]; });
+
+  // show links for item
+  for(var i=0; i<link_list.length; i++){
+    var wrapper = $a(this.link_area, 'div','',{marginBottom:'4px', padding:'2px'});
+    $(wrapper).hover(
+      function() { $y(this,{backgroundColor:'#EEF'}) }
+      ,function() { $y(this,{backgroundColor:''}) }
+    )
+    var tab = make_table($a(wrapper,'div'), 1, 2, '100%', [200/7+'%', 500/7+'%'])
+
+    var dt= $a($td(tab,0,0), 'span', 'link_type');
+    dt.innerHTML = link_list[i][0]; 
+    dt.label = link_list[i][0];
+    dt.arg = link_list[i][1]; 
+    dt.nm = link_list[i][2];
+    
+    if(dt.arg == 1) dt.cn = link_list[i][3]; 
+    else if(dt.arg == 2) dt.cb=link_list[i][3];
+ 
+    // execute when link is clicked
+    dt.onclick = function(){
+      me.link_action(this)
+    }
+    
+    // description
+    $y($td(tab,0,1), {color:'#777'});
+    $td(tab,0,1).innerHTML = link_list[i][4];
+  }
+}
+
+
+// Execute when link is clicked
+// ----------------------------
+SetupItem.prototype.link_action = function(obj) {
+  var me = this;
+  var obj = obj;
+  
+  // if object links to a doc browser
+  if(obj.arg == 1){
+    if(in_list(profile.can_read, obj.nm)){
+      if(obj.cn !='')
+        loaddocbrowser(obj.nm, obj.nm, obj.cn);
+      else
+        loaddocbrowser(obj.nm);
+    }
+    else
+      msgprint('No read permission',1);
+  }
+  
+  // if obj links to a page
+  else if(obj.arg == 2){
+    me.show_page(obj);
+  }
+  
+  // if object links to a single doctype
+  else if(obj.arg == 3){
+    newdoc(obj.nm);
+  }
+}
+
+
+// Show page for corresponding link
+// --------------------------------
+SetupItem.prototype.show_page = function(obj) {
+  var me = obj;
+  var callback = function(r,rt)
+  {
+    if(r.message){
+      if(me.cb == '')
+        loadpage(me.nm);
+      else
+        show_chart_browser(me.nm,me.cb);    
+    }
+    else
+      msgprint('No read permission',1);
+  }
+  $c_obj('Setup Wizard Control','get_page_lst',me.nm,callback);  
+}
+
+
+// Setup Data
+// ======================================================================================================================================================= 
+SetupData = function(cnty){
+
+  // arg : 1 - Docbrowser, 2 - Page, 3 - DocType
+  
+  //[label, arg, name, callback/col_name, description]
+
+  this.system = {'System':[['Global Defaults',3,'Manage Account','','Set global default values'],
+    ['Manage Series',3,'Naming Series','','Manage numbering series for transactions'],
+    ['Custom Field',1,'Custom Field','dt'+NEWLINE+'label'+NEWLINE+'fieldtype'+NEWLINE+'options','Add and manage custom fields on forms'],
+    ['Email Settings',3,'Email Settings','','Outgoing email server and address'],
+    ['Notification Settings',3,'Notification Control','','Automatic emails set at selected events'],
+    ['Company',1,'Company','id'+NEWLINE+'is_active'+NEWLINE+'email','Manage list of companies'],
+    ['Fiscal Year',1,'Fiscal Year','id'+NEWLINE+'company'+NEWLINE+'is_active'+NEWLINE+'year','Manage list of fiscal years'],
+    ['Personalize',3,'Personalize','','Set your banner'],
+    ['Manage Trash',2,'Trash','','Restore trashed items'],
+    ['Import Data',2,'Import Data','','Import data from CSV files'],
+    ['Manage Users',2,'My Company','','Add / remove users and manage their roles'],
+    ['Web Forms',2,'Webforms','', 'Code to embed forms in yor website'],
+    ['Permissions Manager',2,'Permission Engine','', 'Manage all permissions from one tool (beta)'],
+    ['Property Setter',1,'Property Setter','', 'Customize properties of a Form (DocType) or Field'],
+    //['Badge Settings',3,'Badge Settings','','Define rules for assigning badges to users'],
+    //['Social Badge',1,'Social Badge','id'+NEWLINE+'badge_image'+NEWLINE+'badge_description'+NEWLINE+'badge_points','Social badge master'],
+    ['Letter Head',1,'Letter Head','','Manage different letter heads for Prints'],
+    ['SMS Settings',3,'SMS Settings','','Integrate your personalized SMS gateway which support http web service'],
+    ['SMS Center',3,'SMS Center','','Send mass sms to your leads, contacts and partners']
+  ]};
+
+  
+  this.general = {'General':[['Authorization Rule',1,'Authorization Rule','','Set rules based on amounts'],
+    ['Print Heading',1,'Print Heading','','Manage headings for printing transactions'],
+    ['Term',1,'Term','','Manage template of standard Terms for order / invoices etc'],
+    ['Currency',1,'Currency','','Manage list of currencies'],
+    ['Country',1,'Country','','Country master'],
+    ['State',1,'State','','State master'],
+    ['Activty Type',1,'Activity Type','','Types of activities that you can select in your Timesheet'],
+    ['City',1,'City','','City master']]};
+  
+  this.selling = {'Selling':[['Customer Group',2,'Sales Browser','Customer Group','Manage customer categories'],
+    ['Territory',2,'Sales Browser','Territory','Manage sales territories'],
+    ['Customer',1,'Customer','customer_group'+NEWLINE+'country','Customer master'],
+    ['Sales Person',2,'Sales Browser','Sales Person','Manage sales persons'],
+    ['Sales Partner',1,'Sales Partner','', 'Manage sales partners'],
+    ['Campaign',1,'Campaign','id'+NEWLINE+'campaign_name'+NEWLINE+'description','Manage sales / marketing campaigns'],
+    ['Sales BOM',1,'Sales BOM','id'+NEWLINE+'is_active'+NEWLINE+'new_item_name'+NEWLINE+'description'+NEWLINE+'item_group','Manage Sales Bill of Material (Main item + accessories)'],
+    ['Price List',1,'Price List','','Price list master']]};
+
+  this.accounts = {'Accounts':[['Chart of Accounts',2,'Accounts Browser','Account','Manage chart of accounts'],
+    ['Chart of Cost Centers',2,'Accounts Browser','Cost Center','Manage chart of cost centers'],
+    ['POS Setting',1,'POS Setting','','Manage Point of Sales default Settings.']]};
+    
+  // if country = india; show india related doctypes
+  //-------------------------------------------------
+    
+  if(cnty == 'India'){  
+    var lst1 = [['TDS Rate Chart',1,'TDS Rate Chart','', 'TDS rate master'],['TDS Category',1,'TDS Category','id'+NEWLINE+'module','TDS categories']];
+    for(var i =0; i<lst1.length;i++)      
+      this.accounts['Accounts'].push(lst1[i]);
+  }
+  //--------------------------------------------------    
+  
+  var lst = [['Monthly Distribution',1,'Budget Distribution','id'+NEWLINE+'fiscal_year'+NEWLINE+'distribution_id','Manage budget distributions (seasonalities)'],
+    ['Sales Other Charges',1,'Other Charges','','Manage your charge structures (taxes + charges) for sales'],
+    ['Purchase Other Charges',1,'Purchase Other Charges','','Manage your charge structures (taxes + charges) for purchase'],
+    ['Mode of Payment',1,'Mode of Payment','','Mode of payment master']];
+             
+  for(var i =0; i<lst.length;i++)
+      this.accounts['Accounts'].push(lst[i]);
+  
+  this.stock = {'Stock':[['Item Group',2,'Sales Browser','Item Group','Manage item classifications'],
+    ['Item',1,'Item','name'+NEWLINE+'item_group'+NEWLINE+'description','Item master'],
+    ['Brand',1,'Brand','id'+NEWLINE+'description','Brand master'],
+    ['Batch',1,'Batch','name'+NEWLINE+'start_date'+NEWLINE+'item'+NEWLINE+'expiry_date','Manage batches'],
+    ['Price List',1,'Price List','','Price list master'],
+    ['UOM',1,'UOM','','Unit of measure (UOM) master'],
+    ['Warehouse Type',1,'Warehouse Type','','Warehouse classifications'],
+    ['Warehouse',1,'Warehouse','','Warehouse master']]};
+  
+  this.buying = {'Buying':[['Supplier Type',1,'Supplier Type','','Manage supplier classifications'],
+    ['Supplier',1,'Supplier','id'+NEWLINE+'supplier_type'+NEWLINE+'supplier_status'+NEWLINE+'company','Supplier master']]};
+  
+  this.maintenance = {'Maintenance':[['Serial No',1,'Serial No','item_code'+NEWLINE+'status'+NEWLINE+'pr_no'+NEWLINE+'delivery_note_no'+NEWLINE+'customer_name','Manage unique serial numbers for items'],
+    ['Purpose of Service',1,'Purpose of Service','','Purpose of service master']]};
+  
+  this.production = {'Production':[['Bill of Materials',1,'Bill Of Materials','id'+NEWLINE+'item'+NEWLINE+'description'+NEWLINE+'operating_cost'+NEWLINE+'maintained_by','Muti-level bill of materials and operations'],
+    ['Workstation',1,'Workstation','id'+NEWLINE+'workstation_name'+NEWLINE+'warehouse'+NEWLINE+'description','Workstation master']]};
+  
+  this.hr = {'HR':[['Department',1,'Department','','Company department master'],
+    ['Designation',1,'Designation','','Company designation master'],
+    ['Branch',1,'Branch','','Manage branches for your company'],
+    ['Grade',1,'Grade','','Manage employee grades'],
+    ['Employment Type',1,'Employment Type','','Manage types of employment'],
+    ['Employee',1,'Employee','employee_name'+NEWLINE+'employment_type'+NEWLINE+'status'+NEWLINE+'branch'+NEWLINE+'designation'+NEWLINE+'department'+NEWLINE+'grade'+NEWLINE+'reports_to','Employee master'],
+    ['Earning Type',1,'Earning Type','taxable'+NEWLINE+'exemption_limit','Types of salary earning master'],
+    ['Deduction Type',1,'Deduction Type','','Types of salary deduction master'],
+    ['Expense Type',1,'Expense Type','', 'Types of expense master'],
+      
+    ['Salary Structure',1,'Salary Structure','employee'+NEWLINE+'is_active'+NEWLINE+'fiscal_year'+NEWLINE+'from_date'+NEWLINE+'ctc'+NEWLINE+'total_earning'+NEWLINE+'total_deduction'+NEWLINE+'total','Salary structure template'],
+    ['Holiday List',1,'Holiday List','fiscal_year','List of holidays'],
+    ['Leave Type',1,'Leave Type','max_days_allowed'+NEWLINE+'is_carry_forward'+NEWLINE+'is_encash','Leave type master'],
+    ['KRA Template',1,'KRA Template','','Template of Key Result Areas (KRAs)']]};
+}
diff --git a/setup/page/setup/setup.txt b/setup/page/setup/setup.txt
new file mode 100644
index 0000000..f2a7a70
--- /dev/null
+++ b/setup/page/setup/setup.txt
@@ -0,0 +1 @@
+[{'creation': '2010-07-13 13:42:28', 'module': 'Setup', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'harshada@webnotestech.com', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Setup', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Setup', 'idx': None, 'static_content': None, 'modified': '2010-11-24 16:25:07', 'parenttype': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/setup/page/setup/setup_static.html b/setup/page/setup/setup_static.html
new file mode 100644
index 0000000..54fee71
--- /dev/null
+++ b/setup/page/setup/setup_static.html
@@ -0,0 +1 @@
+Setup
\ No newline at end of file
diff --git a/setup/page/setup_wizard/__init__.py b/setup/page/setup_wizard/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/setup_wizard/__init__.py
diff --git a/setup/page/setup_wizard/setup_wizard.html b/setup/page/setup_wizard/setup_wizard.html
new file mode 100644
index 0000000..1f5547e
--- /dev/null
+++ b/setup/page/setup_wizard/setup_wizard.html
@@ -0,0 +1 @@
+<div id="setup_wizard_wrapper" class="layout_wrapper"></div>
\ No newline at end of file
diff --git a/setup/page/setup_wizard/setup_wizard.js b/setup/page/setup_wizard/setup_wizard.js
new file mode 100644
index 0000000..59308f1
--- /dev/null
+++ b/setup/page/setup_wizard/setup_wizard.js
@@ -0,0 +1,167 @@
+pscript['onload_Setup Wizard'] = function()
+{   
+
+  // header and toolbar
+  var h = new PageHeader('setup_wizard_wrapper','Setup Wizard','All important setup items in one place');
+
+  pscript.setup_wizard_callback();
+}
+
+// ==================================================================================================
+
+pscript.setup_wizard_callback = function(){
+    var items = {};
+    items['Customer'] = new pscript.Setup_Wizard_Obj('Customer', 'customer_name', 0, '', 'Customer', 'Manage your customers',1);
+    items['Supplier'] = new pscript.Setup_Wizard_Obj('Supplier', 'supplier_name', 0, '', 'Supplier', 'Manage your supplier',1);
+    items['Item'] = new pscript.Setup_Wizard_Obj('Item', 'item_name', 0, '', 'Item', 'Create your items',1);
+    //items['Customer Group'] = new pscript.Setup_Wizard_Obj('Customer Group', 'group_name', 0, '', 'Customer Group', 'Organizes your customers for better analysis');
+    items['Price List'] = new pscript.Setup_Wizard_Obj('Price List', 'price_list_name', 0, '', 'Price List', 'Helps you maintain different prices for different customers, currencies etc.');
+    items['Supplier Type'] = new pscript.Setup_Wizard_Obj('Supplier Type', 'supplier_type', 0, '', 'Supplier Type', 'Organizes your suppliers for better analysis');
+    //items['Item Group'] = new pscript.Setup_Wizard_Obj('Item Group', 'group_name', 0, '', 'Item Group', 'Organizes your items for better analysis');
+    items['UoM'] = new pscript.Setup_Wizard_Obj('UOM', 'uom_name', 0, '', 'UOM', 'Maintain multiple Units of Measure (UOM)');
+    items['Warehouse Type'] = new pscript.Setup_Wizard_Obj('Warehouse Type', 'warehouse_type', 0, '', 'Warehouse Type', 'Define types of warehouses');
+    items['Warehouse'] = new pscript.Setup_Wizard_Obj('Warehouse', 'warehouse_name', 'warehouse_type', 'Warehouse Type', 'Warehouse', 'Manage stock across different warehouses');
+    items['Print Heading'] = new pscript.Setup_Wizard_Obj('Print Heading', 'print_heading', 'transaction', 'Transaction', 'Print Heading', 'Define print heading for various transaction.');
+    items['Warehouse Type'].onmake = function(){
+       items['Warehouse'].refresh_select('warehouse_type', 'Warehouse Type', 'Warehouse');
+    }
+    items['Print Heading'].onmake = function(){
+       items['Print Heading'].refresh_select('transaction', 'Transaction', 'Print Heading');
+    }
+}
+
+// ==================================================================================================
+pscript.Setup_Wizard_Obj = function(lbl, name_field, opt_fieldname, opt_field_tbl, dt, desc, important) 
+{
+    this.lbl = lbl;
+    this.make_body(lbl, important);
+    if(lbl != 'Item')
+      this.make_input(name_field);
+    if(opt_fieldname){
+      this.make_select(opt_fieldname, opt_field_tbl, dt);
+    }
+   
+    this.show_description(desc);
+    this.make_button();
+    this.create_doc_link(dt);
+
+}
+
+pscript.Setup_Wizard_Obj.prototype.make_body = function(lbl, important) {
+    var wrapper = $a($i('setup_wizard_wrapper'), 'div', '', {padding:'8px', borderBottom: '1px solid #AAA'});
+    if(important)$y(wrapper, {backgroundColor:'#FFD'});
+    this.tab = make_table(wrapper,1,3,'90%',['20%','50%','30%'], {padding:'2px 0px', verticalAlign:'middle'});
+    this.desc_area = $a(wrapper,'div','comment');
+    
+    $td(this.tab,0,0).innerHTML = lbl.bold();
+}
+
+pscript.Setup_Wizard_Obj.prototype.make_input = function(name_field){
+    this.input = $a_input($td(this.tab,0,1), 'text');
+    this.name_field = name_field;
+}
+
+pscript.Setup_Wizard_Obj.prototype.make_select = function(fn, ft, dt){
+    this.select = $a($td(this.tab,0,1), 'select', '', {width:'120px', marginLeft:'8px'});
+    this.opt_field = fn;
+    this.sel_field = 'Select ' + ft + '...';
+    this.refresh_select(fn, ft, dt);
+}                
+
+pscript.Setup_Wizard_Obj.prototype.refresh_select = function(fn, ft, dt){
+  var me = this;
+  if(ft == 'Transaction'){
+    empty_select(me.select);
+    add_sel_options(me.select, ['Select Transaction ...','Purchase Order','Sales Order','Service Order','Purchase Receipt','Delivery Note','Receivable Voucher','Payable Voucher','Journal Voucher']);
+  }
+  else{
+    $c_obj('Setup Wizard Control', 'get_master_lists','', function(r,rt){
+      var ft_lst = [];
+      if(r.message) ft_lst = r.message;
+      ft_lst.push('Select Warehouse Type ...');
+      empty_select(me.select);
+      add_sel_options(me.select, ft_lst.reverse(), 'Warehouse Type');
+    });
+  }
+}  
+ 
+pscript.Setup_Wizard_Obj.prototype.make_button = function(){   
+    var me = this;
+
+    var create = $a($td(this.tab,0,1), 'button', '', {marginLeft:'8px'});
+    create.innerHTML = 'Create';
+    
+    create.onclick = function(){
+        me.create_record(this);
+    }
+}
+
+// show description
+pscript.Setup_Wizard_Obj.prototype.show_description=function(desc){ 
+    this.desc_area.innerHTML = desc;
+}
+
+// create link to show listing of all records
+pscript.Setup_Wizard_Obj.prototype.create_doc_link = function(doc_link){  
+    this.obj_link = $a($td(this.tab,0,2), 'span', 'link_type',{marginLeft:'8px'});
+    this.obj_link.innerHTML = 'View ' + doc_link + ' list';
+    this.dt = doc_link;
+
+    this.obj_link.onclick = function(){
+      if(doc_link == 'Customer') doc_lst = 'customer_group'+NEWLINE+'country';
+      else if(doc_link == 'Supplier') doc_lst = 'supplier_type'+NEWLINE+'supplier_status'+NEWLINE+'company';
+      else if(doc_link == 'Item') doc_lst = 'item_group'+NEWLINE+'description';
+        
+      if(doc_link == 'Customer' || doc_link == 'Supplier' || doc_link == 'Item')
+        loaddocbrowser(doc_link,doc_link, doc_lst);
+      else
+        loaddocbrowser(doc_link);
+    }
+}    
+pscript.Setup_Wizard_Obj.prototype.create_record = function(cur_obj)
+{   
+    var me = this;
+    if(me.lbl == 'Item'){ me.create_master_rec(); }
+    else{
+      if(this.input.value) { //check for input value
+        
+        if (this.select && (this.sel_field == this.select.value)){ //check for value is selected or not
+          alert('Please select '+this.select.value);  
+          this.input.value = '';
+        }
+        else{
+          args = {};
+          args['Doctype'] = this.dt;
+          if(strip(this.input.value) == ''){ alert("Please enter proper name."); me.input.value = '';}
+          else{
+            if(me.lbl == 'Customer' || me.lbl == 'Supplier'){ this.create_master_rec(); }
+            else{
+              args[this.name_field] = this.input.value;
+              args[this.opt_field] = this.opt_field ? this.select.value : '';
+              
+              $c_obj('Setup Wizard Control', 'create_record', JSON.stringify(args), function(r,rt){        
+                alert(r.message);
+                me.input.value = '';
+                if(me.onmake) me.onmake();  
+              });
+            }
+          }
+        }
+      }
+      else
+        alert("Please enter " +this.dt);
+    }
+}
+
+pscript.Setup_Wizard_Obj.prototype.create_master_rec = function(){
+  var me = this;
+  var fn = function(new_docname) {
+    var new_doc = locals[me.lbl][new_docname];
+    if(me.lbl == 'Customer')
+      new_doc.customer_name = me.input.value;
+    else if(me.lbl == 'Supplier')
+      new_doc.supplier_name = me.input.value;
+  }
+  new_doc(me.lbl, fn);
+  
+}
\ No newline at end of file
diff --git a/setup/page/setup_wizard/setup_wizard.txt b/setup/page/setup_wizard/setup_wizard.txt
new file mode 100644
index 0000000..e79cc54
--- /dev/null
+++ b/setup/page/setup_wizard/setup_wizard.txt
@@ -0,0 +1 @@
+[{'creation': '2010-04-26 11:03:08', 'module': 'Setup', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Setup Wizard', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Setup Wizard', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000127', 'parent': 'Setup Wizard', 'creation': '2010-04-26 13:35:08', 'modified': '2010-07-13 13:36:23', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/setup/page/setup_wizard/setup_wizard_static.html b/setup/page/setup_wizard/setup_wizard_static.html
new file mode 100644
index 0000000..281c686
--- /dev/null
+++ b/setup/page/setup_wizard/setup_wizard_static.html
@@ -0,0 +1 @@
+<div></div>
\ No newline at end of file
diff --git a/setup/page/webforms/__init__.py b/setup/page/webforms/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/page/webforms/__init__.py
diff --git a/setup/page/webforms/webforms.html b/setup/page/webforms/webforms.html
new file mode 100644
index 0000000..e1717dc
--- /dev/null
+++ b/setup/page/webforms/webforms.html
@@ -0,0 +1,13 @@
+<div class="layout_wrapper">
+<div id="webform_div"></div>
+<p><strong>Note : </strong>Copy and paste code provided below in your website wherever you want to show the form to capture details</p>
+<p>&nbsp;</p>
+<p><span style="font-size: medium;"><strong>Lead</strong></span></p>
+<div id="lead_div"></div>
+<p><span style="font-size: medium;"><strong>Customer Issue</strong></span></p>
+<div id="cust_issue_div"></div>
+<p><span style="font-size: medium;"><strong>Job Application</strong></span></p>
+<div id="job_div"></div>
+<p><span style="font-size: medium;"><strong>Ticket</strong></span></p>
+<div id="ticket_div"></div>
+</div>
\ No newline at end of file
diff --git a/setup/page/webforms/webforms.js b/setup/page/webforms/webforms.js
new file mode 100644
index 0000000..d429ce0
--- /dev/null
+++ b/setup/page/webforms/webforms.js
@@ -0,0 +1,26 @@
+pscript.onload_Webforms = function(){
+
+  $c_obj('Home Control','get_acc_id','', function(r,rt) {
+    if(r.message) {
+      var acc_id = r.message; 
+  var parent = $i('webform_div');
+  new PageHeader(parent,'Web Forms','');
+      
+      var lead_dv = $a('lead_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'90%'});
+      var cust_issue_dv = $a('cust_issue_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'95%'});
+      var job_dv = $a('job_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'95%'});
+      var ticket_dv = $a('ticket_div','div', '', {border:'1px solid #AAA', padding:'8px', width:'95%'});
+
+      // url
+      if(window.location.href.indexOf('?')!=-1)
+        var url = window.location.href.split('?')[0];
+      else
+        var url = window.location.href.split('#')[0];
+
+      lead_dv.innerHTML = '&lt;iframe src ="'+url+'?ac_name='+acc_id+'&embed=Lead" width ="400" height="800" frameborder="0"&gt;&lt;/iframe&gt;';
+      cust_issue_dv.innerHTML = '&lt;iframe src ="'+url+'?ac_name='+acc_id+'&embed=Customer Issue" width ="400" height="500" frameborder="0"&gt;&lt;/iframe&gt;';
+      job_dv.innerHTML = '&lt;iframe src ="'+url+'?ac_name='+acc_id+'&embed=Job Application"  width ="400" height="800" frameborder="0""&gt;&lt;/iframe&gt;';
+      ticket_dv.innerHTML = '&lt;iframe src ="'+url+'?ac_name='+acc_id+'&embed=Support Ticket"  width ="400" height="800" frameborder="0""&gt;&lt;/iframe&gt;';
+    }
+  }); 
+}
diff --git a/setup/page/webforms/webforms.txt b/setup/page/webforms/webforms.txt
new file mode 100644
index 0000000..63a8289
--- /dev/null
+++ b/setup/page/webforms/webforms.txt
@@ -0,0 +1 @@
+[{'creation': '2010-12-18 17:10:03', 'module': 'Setup', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Webforms', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Webforms', 'idx': None, 'static_content': None, 'modified': '2010-12-18 17:14:25', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000075', 'parent': 'Webforms', 'creation': '2010-12-18 17:11:12', 'modified': '2010-12-18 17:14:25', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/setup/page/webforms/webforms_static.html b/setup/page/webforms/webforms_static.html
new file mode 100644
index 0000000..3488a17
--- /dev/null
+++ b/setup/page/webforms/webforms_static.html
@@ -0,0 +1 @@
+webforms
\ No newline at end of file
diff --git a/srm/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt b/srm/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
new file mode 100644
index 0000000..04659ff
--- /dev/null
+++ b/srm/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
@@ -0,0 +1 @@
+[{'modified_by': 'jai@webnotestech.com', 'name': 'Indent-Purchase Order', 'parent': None, 'to_doctype': 'Purchase Order', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'module': 'SRM', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': '', 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Indent', 'parentfield': ''}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00165', 'parent': 'Indent-Purchase Order', 'to_field': 'fiscal_year', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'fiscal_year', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00164', 'parent': 'Indent-Purchase Order', 'to_field': 'company', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': '=', 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00544', 'parent': 'Indent-Purchase Order', 'to_field': 'prevdoc_doctype', 'creation': '2009-09-21 13:13:48', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parenttype', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00163', 'parent': 'Indent-Purchase Order', 'to_field': 'prevdoc_docname', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00162', 'parent': 'Indent-Purchase Order', 'to_field': 'prevdoc_detail_docname', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00155', 'parent': 'Indent-Purchase Order', 'to_field': 'stock_uom', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00168', 'parent': 'Indent-Purchase Order', 'to_field': 'conversion_factor', 'creation': '2009-03-13 13:18:32', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval:flt(1)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00166', 'parent': 'Indent-Purchase Order', 'to_field': 'uom', 'creation': '2009-03-12 17:24:05', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'uom', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00157', 'parent': 'Indent-Purchase Order', 'to_field': 'warehouse', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'warehouse', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00160', 'parent': 'Indent-Purchase Order', 'to_field': 'schedule_date', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'schedule_date', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00159', 'parent': 'Indent-Purchase Order', 'to_field': 'item_code', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00244', 'parent': 'Indent-Purchase Order', 'to_field': 'item_name', 'creation': '2009-03-25 17:36:50', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00243', 'parent': 'Indent-Purchase Order', 'to_field': 'brand', 'creation': '2009-03-25 17:36:50', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'brand', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00158', 'parent': 'Indent-Purchase Order', 'to_field': 'description', 'creation': '2009-03-12 12:10:22', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 14, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00649', 'parent': 'Indent-Purchase Order', 'to_field': 'item_group', 'creation': '2009-12-22 14:59:02', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 15, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'item_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00253', 'parent': 'Indent-Purchase Order', 'to_field': 'stock_qty', 'creation': '2009-03-30 10:55:56', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 16, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'jai@webnotestech.com', 'name': 'FMD/00602', 'parent': 'Indent-Purchase Order', 'to_field': 'qty', 'creation': '2009-11-18 15:10:27', 'modified': '2009-12-30 16:55:33', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 17, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)', 'parentfield': 'field_mapper_details'}, {'reference_key': 'prevdoc_docname', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000017', 'parent': 'Indent-Purchase Order', 'is_reference_table': None, 'to_field': '', 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': '', 'modified': '2009-12-30 16:55:33', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Indent', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Purchase Order', 'from_field': '', 'validation_logic': 'docstatus = 1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'jai@webnotestech.com', 'name': 'TMD/0000018', 'parent': 'Indent-Purchase Order', 'is_reference_table': 1, 'to_field': 'po_details', 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': 'prevdoc_doctype', 'modified': '2009-12-30 16:55:33', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'Indent Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'PO Detail', 'from_field': 'indent_details', 'validation_logic': 'qty > ifnull(ordered_qty,0) and docstatus =1', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/srm/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt b/srm/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt
new file mode 100644
index 0000000..15b9c3f
--- /dev/null
+++ b/srm/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'saumil@webnotestech.com', 'name': 'Purchase Order-Payable Voucher', 'parent': None, 'to_doctype': 'Payable Voucher', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'module': 'SRM', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Purchase Order', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00123', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'company', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00124', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'fiscal_year', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'fiscal_year', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00125', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'conversion_rate', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'conversion_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00348', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'currency', 'creation': '2009-06-25 20:08:36', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'currency', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00131', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'supplier', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'supplier', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00899', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'supplier_name', 'creation': '2010-08-26 16:35:01', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'supplier_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00126', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'item_code', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00252', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'item_name', 'creation': '2009-03-25 17:39:39', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00251', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'brand', 'creation': '2009-03-25 17:39:39', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'brand', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00130', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'qty', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00127', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'rate', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'purchase_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00597', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'amount', 'creation': '2009-10-27 10:46:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00347', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'import_rate', 'creation': '2009-06-25 17:05:10', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'import_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00706', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'import_amount', 'creation': '2010-05-24 12:22:49', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 14, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00128', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'description', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 15, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00129', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'purchase_order', 'creation': '2009-03-12 12:10:22', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 16, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00236', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'po_detail', 'creation': '2009-03-18 06:32:14', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 17, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00651', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'item_group', 'creation': '2009-12-22 16:54:46', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 18, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'item_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00677', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'category', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 19, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'category', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00678', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'add_deduct_tax', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 20, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'add_deduct_tax', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00679', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'charge_type', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 21, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'charge_type', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00680', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'row_id', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 22, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'row_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00681', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'item_wise_tax_detail', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 23, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'item_wise_tax_detail', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00682', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'description', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 24, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00683', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'account_head', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 25, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'account_head', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00684', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'cost_center', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 26, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'cost_center', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00685', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'rate', 'creation': '2010-02-05 17:09:42', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 27, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'saumil@webnotestech.com', 'name': 'FMD/00873', 'parent': 'Purchase Order-Payable Voucher', 'to_field': 'project_name', 'creation': '2010-08-18 15:28:54', 'modified': '2010-10-18 16:11:50', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 28, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'project_name', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'saumil@webnotestech.com', 'name': 'TMD/0000013', 'parent': 'Purchase Order-Payable Voucher', 'is_reference_table': None, 'to_field': None, 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': '', 'modified': '2010-10-18 16:11:50', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Purchase Order', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Payable Voucher', 'from_field': '', 'validation_logic': 'docstatus =1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'saumil@webnotestech.com', 'name': 'TMD/0000014', 'parent': 'Purchase Order-Payable Voucher', 'is_reference_table': None, 'to_field': 'entries', 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': '', 'modified': '2010-10-18 16:11:50', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'PO Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'PV Detail', 'from_field': 'po_details', 'validation_logic': 'ifnull(billed_qty,0)  < qty', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'saumil@webnotestech.com', 'name': 'TMD/0000065', 'parent': 'Purchase Order-Payable Voucher', 'is_reference_table': None, 'to_field': 'purchase_tax_details', 'creation': '2010-02-05 17:09:42', 'reference_doctype_key': '', 'modified': '2010-10-18 16:11:50', 'doctype': 'Table Mapper Detail', 'match_id': 2, 'idx': 3, 'parenttype': 'DocType Mapper', 'from_table': 'Purchase Tax Detail', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'to_table': 'Purchase Tax Detail', 'from_field': 'purchase_tax_details', 'validation_logic': 'docstatus =1', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/srm/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/srm/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
new file mode 100644
index 0000000..bfb756e
--- /dev/null
+++ b/srm/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
@@ -0,0 +1,802 @@
+[
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'DocType Mapper',
+		'from_doctype': 'Purchase Order',
+		'idx': None,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'Purchase Order-Purchase Receipt',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'ref_doc_submitted': 1,
+		'to_doctype': 'Purchase Receipt'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier',
+		'idx': 1,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00197',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_name',
+		'idx': 2,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00586',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'supplier_address',
+		'idx': 3,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00198',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'supplier_address'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'company',
+		'idx': 4,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00199',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'company'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'fiscal_year',
+		'idx': 5,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00200',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'fiscal_year'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'currency',
+		'idx': 6,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00201',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'currency'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-09 09:44:02',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'terms',
+		'idx': 7,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00553',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'terms'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'warehouse',
+		'idx': 8,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00202',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'warehouse'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_factor',
+		'idx': 9,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00203',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_factor'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'stock_uom',
+		'idx': 10,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00204',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_uom'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'name',
+		'idx': 11,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00205',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_detail_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parent',
+		'idx': 12,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00206',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_docname'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'parenttype',
+		'idx': 13,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00207',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'prevdoc_doctype'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'uom',
+		'idx': 14,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00208',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'uom'
+	},
+	{
+		'checking_operator': '=',
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_code',
+		'idx': 15,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00209',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_code'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'brand',
+		'idx': 16,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00210',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'brand'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_name',
+		'idx': 17,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00211',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_name'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ',
+		'idx': 18,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00212',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'received_qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ',
+		'idx': 19,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00213',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)',
+		'idx': 20,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00214',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'stock_qty'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'purchase_rate',
+		'idx': 21,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00215',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'purchase_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_group',
+		'idx': 22,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00217',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_group'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'import_rate',
+		'idx': 23,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00218',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)',
+		'idx': 24,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00219',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'import_amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'schedule_date',
+		'idx': 25,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00220',
+		'owner': 'jitesh',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'schedule_date'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)',
+		'idx': 26,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00221',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'amount'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2011-03-23 11:40:19',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_tax_rate',
+		'idx': 27,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': '000003203',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_tax_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'conversion_rate',
+		'idx': 28,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00222',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'conversion_rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'category',
+		'idx': 29,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00223',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'category'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'add_deduct_tax',
+		'idx': 30,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00224',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'add_deduct_tax'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'charge_type',
+		'idx': 31,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00225',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'charge_type'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'row_id',
+		'idx': 32,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00226',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'row_id'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 33,
+		'map': 'Yes',
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00228',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'item_wise_tax_detail',
+		'idx': 34,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00227',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'item_wise_tax_detail'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'description',
+		'idx': 35,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00216',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'description'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'account_head',
+		'idx': 36,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00229',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'account_head'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'cost_center',
+		'idx': 37,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00230',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'cost_center'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'rate',
+		'idx': 38,
+		'map': 'Yes',
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00231',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'rate'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'contact_person',
+		'idx': 39,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00232',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'contact_person'
+	},
+	{
+		'checking_operator': None,
+		'creation': '2010-09-01 15:48:10',
+		'docstatus': 0,
+		'doctype': 'Field Mapper Detail',
+		'from_field': 'project_name',
+		'idx': 40,
+		'map': 'Yes',
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'FMD/00587',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'field_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'to_field': 'project_name'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'po_details',
+		'from_table': 'PO Detail',
+		'idx': 1,
+		'match_id': 1,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000025',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': 'prevdoc_doctype',
+		'reference_key': 'prevdoc_detail_docname',
+		'to_field': 'purchase_receipt_details',
+		'to_table': 'Purchase Receipt Detail',
+		'validation_logic': 'docstatus=1 and qty > ifnull(received_qty,0)'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': None,
+		'from_table': 'Purchase Order',
+		'idx': 2,
+		'match_id': 0,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000026',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': 'prevdoc_docname',
+		'to_field': None,
+		'to_table': 'Purchase Receipt',
+		'validation_logic': 'docstatus = 1'
+	},
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'doctype': 'Table Mapper Detail',
+		'from_field': 'purchase_tax_details',
+		'from_table': 'Purchase Tax Detail',
+		'idx': 3,
+		'match_id': 2,
+		'modified': '2011-04-06 13:47:31',
+		'modified_by': 'Administrator',
+		'name': 'TMD/0000027',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order-Purchase Receipt',
+		'parentfield': 'table_mapper_details',
+		'parenttype': 'DocType Mapper',
+		'reference_doctype_key': None,
+		'reference_key': None,
+		'to_field': 'purchase_tax_details',
+		'to_table': 'Purchase Tax Detail',
+		'validation_logic': 'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/srm/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt b/srm/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt
new file mode 100644
index 0000000..116b4e9
--- /dev/null
+++ b/srm/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt
@@ -0,0 +1 @@
+[{'modified_by': 'ashwini@webnotestech.com', 'name': 'Purchase Receipt-Payable Voucher', 'parent': None, 'to_doctype': 'Payable Voucher', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'module': 'SRM', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': 1, 'owner': 'Administrator', 'docstatus': 0, 'from_doctype': 'Purchase Receipt', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00111', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'company', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'company', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00112', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'fiscal_year', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'fiscal_year', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00113', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'supplier', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 3, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'supplier', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00900', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'supplier_name', 'creation': '2010-08-26 16:36:43', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 4, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'supplier_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00349', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'currency', 'creation': '2009-06-25 20:20:25', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 5, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'currency', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00114', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'conversion_rate', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 6, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'conversion_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00115', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'item_code', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 7, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_code', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00246', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'item_name', 'creation': '2009-03-25 17:37:43', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 8, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'item_name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00245', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'brand', 'creation': '2009-03-25 17:37:43', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 9, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'brand', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00116', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'description', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 10, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00117', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'qty', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 11, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00118', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'rate', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 12, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'purchase_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00596', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'amount', 'creation': '2009-10-27 10:40:33', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 13, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00346', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'import_rate', 'creation': '2009-06-25 12:29:15', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 14, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'import_rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00707', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'import_amount', 'creation': '2010-05-24 12:24:15', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 15, 'parenttype': 'DocType Mapper', 'checking_operator': '', 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00119', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'purchase_receipt', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 16, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'parent', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00120', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'purchase_order', 'creation': '2009-03-12 12:10:22', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 17, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'prevdoc_docname', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00234', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'pr_detail', 'creation': '2009-03-18 06:29:21', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 18, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'name', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00235', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'po_detail', 'creation': '2009-03-18 06:30:13', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 19, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'Administrator', 'docstatus': 0, 'from_field': 'prevdoc_detail_docname', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00652', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'item_group', 'creation': '2009-12-22 16:55:31', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 1, 'idx': 20, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'jai@webnotestech.com', 'docstatus': 0, 'from_field': 'item_group', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00659', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'category', 'creation': '2010-02-05 16:42:00', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 21, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'from_field': 'category', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00669', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'add_deduct_tax', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 22, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'add_deduct_tax', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00670', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'charge_type', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 23, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'charge_type', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00671', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'row_id', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 24, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'row_id', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00672', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'item_wise_tax_detail', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 25, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'item_wise_tax_detail', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00673', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'description', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 26, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'description', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00674', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'account_head', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 27, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'account_head', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00675', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'cost_center', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 28, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'cost_center', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00676', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'rate', 'creation': '2010-02-05 17:05:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 2, 'idx': 29, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'from_field': 'rate', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00874', 'parent': 'Purchase Receipt-Payable Voucher', 'to_field': 'project_name', 'creation': '2010-08-18 15:29:50', 'modified': '2010-11-02 09:46:20', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 30, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'from_field': 'project_name', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000011', 'parent': 'Purchase Receipt-Payable Voucher', 'is_reference_table': None, 'to_field': 'entries', 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': '', 'modified': '2010-11-02 09:46:20', 'doctype': 'Table Mapper Detail', 'match_id': 1, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'Purchase Receipt Detail', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'PV Detail', 'from_field': 'purchase_receipt_details', 'validation_logic': 'ifnull(billed_qty,0)  < qty', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000012', 'parent': 'Purchase Receipt-Payable Voucher', 'is_reference_table': None, 'to_field': None, 'creation': '2009-03-12 12:10:22', 'reference_doctype_key': '', 'modified': '2010-11-02 09:46:20', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'from_table': 'Purchase Receipt', 'owner': 'Administrator', 'docstatus': 0, 'to_table': 'Payable Voucher', 'from_field': None, 'validation_logic': 'docstatus=1', 'parentfield': 'table_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000063', 'parent': 'Purchase Receipt-Payable Voucher', 'is_reference_table': None, 'to_field': 'purchase_tax_details', 'creation': '2010-02-05 16:42:01', 'reference_doctype_key': '', 'modified': '2010-11-02 09:46:20', 'doctype': 'Table Mapper Detail', 'match_id': 2, 'idx': 3, 'parenttype': 'DocType Mapper', 'from_table': 'Purchase Tax Detail', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'to_table': 'Purchase Tax Detail', 'from_field': 'purchase_tax_details', 'validation_logic': 'docstatus=1', 'parentfield': 'table_mapper_details'}]
\ No newline at end of file
diff --git a/srm/Module Def/SRM/SRM.txt b/srm/Module Def/SRM/SRM.txt
new file mode 100644
index 0000000..cbbc2b1
--- /dev/null
+++ b/srm/Module Def/SRM/SRM.txt
@@ -0,0 +1,294 @@
+[
+	{
+		'creation': '2010-09-25 10:50:35',
+		'disabled': 'No',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': 'DocType Mapper, Purchase Receipt-Payable Voucher\nDocType Mapper, Purchase Order-Payable Voucher\nDocType Mapper, Purchase Order-Purchase Receipt\nDocType Mapper, Indent-Purchase Order\nPrint Format, Purchase Order Format\nPrint Format, Purchase Receipt Format',
+		'file_list': 'scm.gif,FileData/00209',
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2010-11-29 12:02:02',
+		'modified': '2011-04-14 10:22:42',
+		'modified_by': 'Administrator',
+		'module_desc': '<p>All details about your Suppliers and past transactions</p>',
+		'module_icon': 'Buying.gif',
+		'module_label': 'Buying',
+		'module_name': 'SRM',
+		'module_page': None,
+		'module_seq': 4,
+		'name': 'SRM',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Your Supplier Database',
+		'display_name': 'Supplier',
+		'doc_name': 'Supplier',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'id\nsupplier_type\nsupplier_status\ncompany',
+		'hide': None,
+		'icon': None,
+		'idx': 1,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01067',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Buy requests from various people in your company',
+		'display_name': 'Indent',
+		'doc_name': 'Indent',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\ntransaction_date\nsales_order_no\nremark',
+		'hide': None,
+		'icon': None,
+		'idx': 2,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01068',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': 'Orders you have placed to your suppliers',
+		'display_name': 'Purchase Order',
+		'doc_name': 'Purchase Order',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'status\nsupplier\ntransaction_date\ngrand_total',
+		'hide': None,
+		'icon': None,
+		'idx': 3,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01069',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Itemwise Receipt Details',
+		'doc_name': 'Purchase Receipt Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 4,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01071',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Purchase in Transit',
+		'doc_name': 'PV Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01072',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Pending PO Items To Receive',
+		'doc_name': 'PO Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 6,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01073',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Pending PO Items To Bill',
+		'doc_name': 'PO Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 7,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01074',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-09-25 10:50:35',
+		'description': None,
+		'display_name': 'Itemwise Purchase Details',
+		'doc_name': 'PO Detail',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 8,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01075',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-12-14 10:33:10',
+		'description': 'Ledger details of your creditors',
+		'display_name': "Creditor's Ledger",
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'accept.gif',
+		'idx': 9,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': 'MDI01206',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2011-05-09 11:04:26',
+		'description': 'You can calculate landed cost of stock by distributing some costs proportionately (based on amount) to several Purchase Receipts through this wizard.',
+		'display_name': 'Landed Cost Wizard',
+		'doc_name': 'Landed Cost Wizard',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 10,
+		'modified': '2011-05-09 11:04:26',
+		'modified_by': 'Administrator',
+		'name': '000000411',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00288',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase User'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00289',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Manager'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00290',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-09-25 10:50:35',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2010-09-25 10:50:35',
+		'modified_by': 'Administrator',
+		'name': 'MDR00291',
+		'owner': 'Administrator',
+		'parent': 'SRM',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Master Manager'
+	}
+]
\ No newline at end of file
diff --git a/srm/__init__.py b/srm/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/__init__.py
diff --git a/srm/doctype/__init__.py b/srm/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/__init__.py
diff --git a/srm/doctype/indent/__init__.py b/srm/doctype/indent/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/indent/__init__.py
diff --git a/srm/doctype/indent/indent.js b/srm/doctype/indent/indent.js
new file mode 100644
index 0000000..a2e1614
--- /dev/null
+++ b/srm/doctype/indent/indent.js
@@ -0,0 +1,136 @@
+cur_frm.cscript.tname = "Indent Detail";
+cur_frm.cscript.fname = "indent_details";
+
+$import(Purchase Common)
+$import(SMS Control)
+//========================== On Load =================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  
+  if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
+  if (!doc.status) doc.status = 'Draft';
+  
+  // second call
+  if(doc.__islocal){ 
+    cur_frm.cscript.get_item_defaults(doc);
+  }
+}
+
+cur_frm.cscript.get_item_defaults = function(doc) {
+    var ch = getchildren( 'Indent Detail', doc.name, 'indent_details');
+    if (flt(ch.length) > 0){
+      $c_obj(make_doclist(doc.doctype, doc.name), 'get_item_defaults', '', function(r, rt) {refresh_field('indent_details'); });
+    }
+}
+
+
+//======================= Refresh =====================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
+
+  // Unhide Fields in Next Steps
+  // ---------------------------------
+  
+  cur_frm.clear_custom_buttons();
+
+  if(doc.docstatus == 1 && doc.status != 'Stopped'){
+    var ch = getchildren('Indent Detail',doc.name,'indent_details');
+    var is_closed = 1;
+    for(var i in ch){
+      if(flt(ch[i].qty) > flt(ch[i].ordered_qty)) is_closed = 0;
+    }
+    if(!is_closed) {
+  	  cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order'])
+  	  cur_frm.add_custom_button('Stop Indent', cur_frm.cscript['Stop Indent'])
+    }
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+  }
+ 
+  if(doc.docstatus == 1 && doc.status == 'Stopped')
+    cur_frm.add_custom_button('Unstop Indent', cur_frm.cscript['Unstop Indent'])
+    
+  if(doc.docstatus == 1)
+    unhide_field(['Repair Indent']);
+  else
+    hide_field(['Repair Indent']);
+}
+
+//======================= validation ===================================
+cur_frm.cscript.validate = function(doc,cdt,cdn){
+  is_item_table(doc,cdt,cdn);
+}
+//======================= transaction date =============================
+cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
+  if(doc.__islocal){ 
+    cur_frm.cscript.get_default_schedule_date(doc);
+  }
+}
+
+//=================== Quantity ===================================================================
+cur_frm.cscript.qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if (flt(d.qty) < flt(d.min_order_qty))
+    alert("Warning: Indent Qty is less than Minimum Order Qty");
+}
+
+// On Button Click Functions
+// ------------------------------------------------------------------------------
+
+// Make Purchase Order
+cur_frm.cscript['Make Purchase Order'] = function() {
+  var doc = cur_frm.doc;
+  n = createLocal('Purchase Order');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Purchase Order'][n]]),
+    'from_doctype':doc.doctype,
+    'to_doctype':'Purchase Order',
+    'from_docname':doc.name,
+    'from_to_list':"[['Indent','Purchase Order'],['Indent Detail','PO Detail']]"
+    }, function(r,rt) {
+       loaddoc('Purchase Order', n);
+    }
+  );
+}
+
+// Make RFQ
+/*
+cur_frm.cscript['Create RFQ'] = function() {
+  var doc = cur_frm.doc;
+  n = createLocal('RFQ');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['RFQ'][n]]),
+    'from_doctype':doc.doctype,
+    'to_doctype':'RFQ',
+    'from_docname':doc.name,
+    'from_to_list':"[['Indent','RFQ'],['Indent Detail','RFQ Detail']]"
+    }, function(r,rt) {
+       loaddoc('RFQ', n);
+    }
+  );
+}
+*/
+
+// Stop INDENT
+// ==================================================================================================
+cur_frm.cscript['Stop Indent'] = function() {
+  var doc = cur_frm.doc;
+  var check = confirm("Do you really want to STOP this Indent?");
+
+  if (check) {
+    $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });
+  }
+}
+
+// Un Stop INDENT
+//====================================================================================================
+cur_frm.cscript['Unstop Indent'] = function(){
+  var doc = cur_frm.doc
+  var check = confirm("Do you really want to UNSTOP this Indent?");
+  
+  if (check) {
+    $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+      
+    });
+  }
+}
diff --git a/srm/doctype/indent/indent.py b/srm/doctype/indent/indent.py
new file mode 100644
index 0000000..86a0f70
--- /dev/null
+++ b/srm/doctype/indent/indent.py
@@ -0,0 +1,209 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+		self.defaults = get_defaults()
+		self.tname = 'Indent Detail'
+		self.fname = 'indent_details'
+
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+
+	def get_default_schedule_date(self):
+		get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
+
+	# Pull Sales Order Details
+	# -------------------------
+	def pull_so_details(self):
+		self.check_if_already_pulled()
+		if self.doc.sales_order_no:
+			get_obj('DocType Mapper', 'Sales Order-Indent', with_children=1).dt_map('Sales Order', 'Indent', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Indent'],['Sales Order Detail', 'Indent Detail']]")
+			self.get_item_defaults()
+		else:
+			msgprint("Please select Sales Order whose details need to pull")
+
+	def check_if_already_pulled(self):
+		pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')]
+
+
+	# Get item's other details
+	#- ------------------------
+	def get_item_defaults(self):
+		self.get_default_schedule_date()
+		for d in getlist(self.doclist, 'indent_details'):
+			det = sql("select min_order_qty from tabItem where name = '%s'" % d.item_code)
+			d.min_order_qty = det and flt(det[0][0]) or 0
+
+	# Validate so items
+	# ----------------------------
+	def validate_qty_against_so(self):
+		so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
+		for d in getlist(self.doclist, 'indent_details'):
+			if d.sales_order_no:
+				if not so_items.has_key(d.sales_order_no):
+					so_items[d.sales_order_no] = {d.item_code: flt(d.qty)}
+				else:
+					if not so_items[d.sales_order_no].has_key(d.item_code):
+						so_items[d.sales_order_no][d.item_code] = flt(d.qty)
+					else:
+						so_items[d.sales_order_no][d.item_code] += flt(d.qty)
+		
+		for so_no in so_items.keys():
+			for item in so_items[so_no].keys():
+				already_indented = sql("select sum(qty) from `tabIndent Detail` where item_code = '%s' and sales_order_no = '%s' and docstatus = 1 and parent != '%s'" % (item, so_no, self.doc.name))
+				already_indented = already_indented and flt(already_indented[0][0]) or 0
+				
+				actual_so_qty = sql("select sum(qty) from `tabSales Order Detail` where parent = '%s' and item_code = '%s' and docstatus = 1 group by parent" % (so_no, item))
+				actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
+
+				if flt(so_items[so_no][item]) + already_indented > actual_so_qty:
+					msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1)
+				
+		
+	# Validate fiscal year
+	# ----------------------------
+	def validate_fiscal_year(self):
+		get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Indent Date')
+
+	# get item details
+	# ---------------------------------
+	def get_item_details(self, arg =''):
+		return cstr( get_obj(dt='Purchase Common').get_item_details(self,arg) )
+
+	# Get UOM Details
+	# ---------------------------------
+	def get_uom_details(self, arg = ''):
+		return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
+
+	# GET TERMS & CONDITIONS
+	#-----------------------------
+	def get_tc_details(self):
+		return get_obj('Purchase Common').get_tc_details(self)
+		
+	# Validate Schedule Date
+	#--------------------------------
+	def validate_schedule_date(self):
+		 #:::::::: validate schedule date v/s indent date ::::::::::::
+		for d in getlist(self.doclist, 'indent_details'):
+			if d.schedule_date < self.doc.transaction_date:
+				msgprint("Expected Schedule Date cannot be before Indent Date")
+				raise Exception
+				
+	# Validate
+	# ---------------------
+	def validate(self):
+		self.validate_schedule_date()
+		self.validate_fiscal_year()
+		
+		# set status as "Draft"
+		set(self.doc, 'status', 'Draft')
+
+		# Get Purchase Common Obj
+		pc_obj = get_obj(dt='Purchase Common')
+
+		# Validate Mandatory
+		pc_obj.validate_mandatory(self)
+
+		# Validate for items
+		pc_obj.validate_for_items(self)
+		
+		# Validate qty against SO
+		self.validate_qty_against_so()
+
+
+	# On Submit Functions
+	#----------------------------------------------------------------------------
+	
+	# Update Indented Qty in Bin
+	def update_bin(self, is_submit, is_stopped):
+		for d in getlist(self.doclist, 'indent_details'):
+			# Step 1:=> Check if is_stock_item == 'Yes'
+			if cstr(sql("select is_stock_item from `tabItem` where name = '%s'" % cstr(d.item_code))[0][0]) == 'Yes':
+				if not d.warehouse:
+					msgprint('Please Enter Warehouse for Item %s as it is stock item.' % cstr(d.item_code))
+					raise Exception
+				# Step 2:=> Set Qty 
+				qty =flt(d.qty)
+				if is_stopped:
+					qty = (d.qty > d.ordered_qty) and flt(flt(d.qty) - flt(d.ordered_qty)) or 0 
+				# Step 3 :=> Update Bin's Indent Qty by +- qty 
+				get_obj('Warehouse', d.warehouse).update_bin(0, 0, 0, (is_submit and 1 or -1) * flt(qty), 0, d.item_code, self.doc.transaction_date)		
+		
+	# On Submit			
+	#---------------------------------------------------------------------------
+	def on_submit(self):
+		# Step 1:=> Set Status
+		set(self.doc,'status','Submitted')
+
+		# Step 2:=> Update Bin
+		self.update_bin(is_submit = 1, is_stopped = 0)
+	
+	def check_modified_date(self):
+		mod_db = sql("select modified from `tabIndent` where name = '%s'" % self.doc.name)
+		date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
+		
+		if date_diff and date_diff[0][0]:
+			msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
+			raise Exception
+	
+	# On Stop / unstop
+	#------------------------------------------------------------------------------
+	def update_status(self, status):
+		self.check_modified_date()
+		# Step 1:=> Update Bin
+		self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
+
+		# Step 2:=> Set status 
+		set(self.doc,'status',cstr(status))
+		
+		# Step 3:=> Acknowledge User
+		msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)) )
+ 
+	# On Cancel
+	#-----------------------------------------------------------------------------
+	def on_cancel(self):
+		# Step 1:=> Get Purchase Common Obj
+		pc_obj = get_obj(dt='Purchase Common')
+		
+		# Step 2:=> Check for stopped status
+		pc_obj.check_for_stopped_status( self.doc.doctype, self.doc.name)
+		
+		# Step 3:=> Check if Purchase Order has been submitted against current Indent
+		pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
+
+		# Step 4:=> Check if RFQ has been submitted against current Indent
+		#pc_obj.check_docstatus(check = 'Next', doctype = 'RFQ', docname = self.doc.name, detail_doctype = 'RFQ Detail')
+		
+		# Step 5:=> Update Bin
+		self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0)
+		
+		# Step 6:=> Set Status
+		set(self.doc,'status','Cancelled')
+
+
+	# Repair Indent
+	# ===========================================
+	def repair_indent(self):
+		get_obj('Purchase Common', 'Purchase Common').repair_curr_doctype_details(self)
diff --git a/srm/doctype/indent/indent.txt b/srm/doctype/indent/indent.txt
new file mode 100644
index 0000000..cd31d39
--- /dev/null
+++ b/srm/doctype/indent/indent.txt
@@ -0,0 +1,1251 @@
+[
+	{
+		'_last_update': '1304500997',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': 0,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-04 14:53:17',
+		'modified_by': 'Guest',
+		'module': 'SRM',
+		'name': 'Indent',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'status,transaction_date,sales_order_no',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(per_ordered)s% ordered',
+		'tag_fields': '',
+		'use_template': None,
+		'version': 186
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00254',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00255',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00256',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00257',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00258',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00259',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': '',
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00260',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:04',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2010-08-08 17:09:04',
+		'modified_by': 'Administrator',
+		'name': 'PERM00261',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 16:45:35',
+		'default': 'Enter items and their details which are falling short in your warehouse and for which you want your purchase department to raise a purchase order.',
+		'depends_on': None,
+		'description': 'Enter items and their details for which you want your purchase department to raise a purchase order.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000714',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000715',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': 'IDT',
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL01476',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': 'IDT',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL01477',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nStopped\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000716',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Indent Date',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL01479',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': '% of materials ordered against this Indent',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_ordered',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': '% Ordered',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL01480',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'per_ordered',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000717',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'One or multiple Sales Order no which generated this Indent',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Sales Order No',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL01487',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'sales_order_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:34',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Pull Sales Order Details',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': '000000711',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'pull_so_details',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'indent_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Indent Details',
+		'modified': '2011-05-09 16:45:34',
+		'modified_by': 'Guest',
+		'name': 'FL01482',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'indent_details',
+		'oldfieldtype': 'Table',
+		'options': 'Indent Detail',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 16:45:35',
+		'default': 'Give additional details about the indent.',
+		'depends_on': None,
+		'description': 'Filing in Additional Information about the Indent will help you analyze your data better.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000718',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01484',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01485',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'Name of the entity who has requested for the indent',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'requested_by',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Requested By',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01486',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'requested_by',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000719',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remark',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01489',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remark',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'After cancelling the indent, a dialog box will ask you reason for cancellation which will be reflected in this field',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01490',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01491',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01492',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': 'Add Terms and Conditions for the Indent. You can also prepare a master Term Sheet and use the Template',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000720',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-12-14 10:32:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': 'Letter Head',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL04148',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'letter_head',
+		'oldfieldtype': 'Select',
+		'options': 'link:Letter Head',
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01494',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01495',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000721',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'Terms1',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01497',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 16:45:35',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': '000000722',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Repair Indent',
+		'modified': '2011-05-09 16:45:35',
+		'modified_by': 'Guest',
+		'name': 'FL01505',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_indent',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Indent',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/srm/doctype/indent_detail/__init__.py b/srm/doctype/indent_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/indent_detail/__init__.py
diff --git a/srm/doctype/indent_detail/indent_detail.txt b/srm/doctype/indent_detail/indent_detail.txt
new file mode 100644
index 0000000..fd051b3
--- /dev/null
+++ b/srm/doctype/indent_detail/indent_detail.txt
@@ -0,0 +1,582 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'IDTD/.#####',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-04 14:41:43',
+		'modified_by': 'Guest',
+		'module': 'SRM',
+		'name': 'Indent Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Tray',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 29
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'schedule_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Required Date',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01506',
+		'no_copy': 1,
+		'oldfieldname': 'schedule_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01507',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Item Name',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01508',
+		'no_copy': None,
+		'oldfieldname': 'item_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Description',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01509',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '300px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Warehouse',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01511',
+		'no_copy': None,
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Brand',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01512',
+		'no_copy': None,
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Link',
+		'options': 'Brand',
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '100px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Item Group',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01513',
+		'no_copy': 0,
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:04',
+		'default': '0.00',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Quantity',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01510',
+		'no_copy': 0,
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'lead_time_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Lead Time Date',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01514',
+		'no_copy': 1,
+		'oldfieldname': 'lead_time_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'uom',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Stock UOM',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01515',
+		'no_copy': 0,
+		'oldfieldname': 'uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': '50px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'min_order_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Min Order Qty',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01516',
+		'no_copy': 1,
+		'oldfieldname': 'min_order_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': None,
+		'trigger': None,
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'projected_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Projected Qty',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01518',
+		'no_copy': 1,
+		'oldfieldname': 'projected_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '70px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ordered_qty',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Ordered Qty',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01517',
+		'no_copy': 1,
+		'oldfieldname': 'ordered_qty',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 14:48:29',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Sales Order No',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': '000000494',
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:04',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'page_break',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Page Break',
+		'modified': '2011-05-09 14:48:29',
+		'modified_by': 'Administrator',
+		'name': 'FL01519',
+		'no_copy': 1,
+		'oldfieldname': 'page_break',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Indent Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/srm/doctype/landed_cost_detail/__init__.py b/srm/doctype/landed_cost_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/landed_cost_detail/__init__.py
diff --git a/srm/doctype/landed_cost_detail/landed_cost_detail.txt b/srm/doctype/landed_cost_detail/landed_cost_detail.txt
new file mode 100644
index 0000000..c6816a1
--- /dev/null
+++ b/srm/doctype/landed_cost_detail/landed_cost_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-02-12 11:47:07', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'wasim@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'wasim@webnotestech.com', 'document_type': None, 'name': 'Landed Cost Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-02-12 11:47:07', 'doctype': 'DocField', 'oldfieldname': 'account_head', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Account Head', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03969', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-02-12 11:47:07', 'parenttype': 'DocType', 'fieldname': 'account_head', 'fieldtype': 'Link', 'options': 'Account', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-02-12 11:47:07', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03970', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-02-12 11:47:07', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-02-12 11:47:07', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'wasim@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Landed Cost Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03971', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-02-12 11:47:07', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/lc_pr_detail/__init__.py b/srm/doctype/lc_pr_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/lc_pr_detail/__init__.py
diff --git a/srm/doctype/lc_pr_detail/lc_pr_detail.txt b/srm/doctype/lc_pr_detail/lc_pr_detail.txt
new file mode 100644
index 0000000..a21be95
--- /dev/null
+++ b/srm/doctype/lc_pr_detail/lc_pr_detail.txt
@@ -0,0 +1,196 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:07',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': 1,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-27 10:06:12',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'LC PR Detail',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 2
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Purchase Receipt No',
+		'modified': '2011-04-27 10:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01758',
+		'no_copy': None,
+		'oldfieldname': 'purchase_receipt_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'LC PR Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:07',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'include_in_landed_cost',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Include In Landed Cost',
+		'modified': '2011-04-27 10:06:12',
+		'modified_by': 'Administrator',
+		'name': 'FL01759',
+		'no_copy': None,
+		'oldfieldname': 'include_in_landed_cost',
+		'oldfieldtype': 'Check',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'LC PR Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '150px'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-27 10:06:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Net Total',
+		'modified': '2011-04-27 10:06:12',
+		'modified_by': 'Administrator',
+		'name': '000000650',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'LC PR Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-04-27 10:06:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'added_cost',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Added Cost',
+		'modified': '2011-04-27 10:06:12',
+		'modified_by': 'Administrator',
+		'name': '000000651',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'LC PR Detail',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/srm/doctype/po_detail/__init__.py b/srm/doctype/po_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/po_detail/__init__.py
diff --git a/srm/doctype/po_detail/po_detail.txt b/srm/doctype/po_detail/po_detail.txt
new file mode 100644
index 0000000..a4cb6d8
--- /dev/null
+++ b/srm/doctype/po_detail/po_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:18', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 48, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'POD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'PO Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-12 16:53:30', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': 1, 'oldfieldtype': 'Date', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'schedule_date', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Reqd By Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01169', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'schedule_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'item_code', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': 0, 'modified_by': 'harshada@webnotestech.com', 'label': 'Item Code', 'width': '', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01170', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'item_code', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-25 17:25:15', 'doctype': 'DocField', 'oldfieldname': 'item_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Item Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01469', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'item_name', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Description', 'width': '160px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01171', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Quantity', 'width': '60px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01172', 'idx': 5, 'default': '0.00', 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 0, 'modified_by': 'harshada@webnotestech.com', 'label': 'UOM', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01173', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'uom', 'fieldtype': 'Link', 'options': 'UOM', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'purchase_rate', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Rate (Default Curr.)', 'width': '100px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01176', 'idx': 7, 'default': '0.00', 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'purchase_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Amount  (Default Curr.)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01177', 'idx': 8, 'default': '0.00', 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'import_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 0, 'modified_by': 'harshada@webnotestech.com', 'label': 'Rate', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01181', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'import_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-05-24 11:32:21', 'doctype': 'DocField', 'oldfieldname': 'import_amount', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05034', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'import_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'warehouse', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Warehouse', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01178', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'warehouse', 'fieldtype': 'Link', 'options': 'Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'conversion_factor', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Conversion Factor', 'width': '', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01174', 'idx': 12, 'default': '', 'colour': 'White:FFF', 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'conversion_factor', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Stock UOM', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01175', 'idx': 13, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Data', 'creation': '2009-09-17 21:26:32', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_doctype', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Prevdoc DocType', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03042', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Indent No', 'width': '120px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01168', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_docname', 'fieldtype': 'Link', 'options': 'Indent', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-06-21 17:40:03', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_date', 'owner': 'nabin@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Indent Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL05392', 'idx': 16, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 0, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'prevdoc_detail_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Indent Detail No', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01180', 'idx': 17, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'prevdoc_detail_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-25 17:25:15', 'doctype': 'DocField', 'oldfieldname': 'brand', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Brand', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01468', 'idx': 18, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'brand', 'fieldtype': 'Link', 'options': 'Brand', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-12-17 12:05:52', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL03521', 'idx': 19, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-03-28 14:31:38', 'doctype': 'DocField', 'oldfieldname': 'stock_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Stock Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01543', 'idx': 20, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'stock_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-11-17 17:39:37', 'doctype': 'DocField', 'oldfieldname': 'received_qty', 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Received Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03362', 'idx': 21, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'received_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-03-12 12:10:18', 'doctype': 'DocField', 'oldfieldname': 'billed_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Billed Quantity', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01182', 'idx': 22, 'default': '0.00', 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'billed_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-01-29 12:11:33', 'doctype': 'DocField', 'oldfieldname': 'item_tax_rate', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Item Tax Rate', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': 'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges', 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03893', 'idx': 23, 'default': None, 'colour': 'White:FFF', 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'item_tax_rate', 'fieldtype': 'Small Text', 'options': None, 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Check', 'creation': '2009-09-03 15:05:31', 'doctype': 'DocField', 'oldfieldname': 'page_break', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Page Break', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 0, 'description': None, 'parent': 'PO Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL02914', 'idx': 24, 'default': None, 'colour': None, 'modified': '2010-11-12 16:53:30', 'parenttype': 'DocType', 'fieldname': 'page_break', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/po_raw_material_detail/__init__.py b/srm/doctype/po_raw_material_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/po_raw_material_detail/__init__.py
diff --git a/srm/doctype/po_raw_material_detail/po_raw_material_detail.txt b/srm/doctype/po_raw_material_detail/po_raw_material_detail.txt
new file mode 100644
index 0000000..ce9da69
--- /dev/null
+++ b/srm/doctype/po_raw_material_detail/po_raw_material_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-14 10:41:08', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'dhanalekshmi@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'document_type': None, 'name': 'PO Raw Material Detail', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-14 10:41:08', 'doctype': 'DocField', 'oldfieldname': 'reference_name', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Reference Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL03574', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:08', 'parenttype': 'DocType', 'fieldname': 'reference_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-14 10:41:08', 'doctype': 'DocField', 'oldfieldname': 'bom_detail_no', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'BOM Detail No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03575', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:08', 'parenttype': 'DocType', 'fieldname': 'bom_detail_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-14 10:41:08', 'doctype': 'DocField', 'oldfieldname': 'main_item_code', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03576', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:08', 'parenttype': 'DocType', 'fieldname': 'main_item_code', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-14 10:41:08', 'doctype': 'DocField', 'oldfieldname': 'rm_item_code', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Raw Material Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03577', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:08', 'parenttype': 'DocType', 'fieldname': 'rm_item_code', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-14 10:41:09', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Stock Uom', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03578', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:09', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-14 10:41:09', 'doctype': 'DocField', 'oldfieldname': 'required_qty', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Required Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03579', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:09', 'parenttype': 'DocType', 'fieldname': 'required_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-14 10:41:09', 'doctype': 'DocField', 'oldfieldname': 'conversion_factor', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Conversion Factor', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03580', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:09', 'parenttype': 'DocType', 'fieldname': 'conversion_factor', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-14 10:41:09', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03581', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:09', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-14 10:41:09', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'dhanalekshmi@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PO Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03582', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-01-14 10:41:09', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/pr_raw_material_detail/__init__.py b/srm/doctype/pr_raw_material_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/pr_raw_material_detail/__init__.py
diff --git a/srm/doctype/pr_raw_material_detail/pr_raw_material_detail.txt b/srm/doctype/pr_raw_material_detail/pr_raw_material_detail.txt
new file mode 100644
index 0000000..288c61b
--- /dev/null
+++ b/srm/doctype/pr_raw_material_detail/pr_raw_material_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-23 16:39:30', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'wasim@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 17, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'PR Raw Material Detail', 'idx': None, 'hide_toolbar': 0, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-23 16:39:31', 'doctype': 'DocField', 'oldfieldname': 'reference_name', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Reference Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 0, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL03392', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'reference_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-01 12:22:23', 'doctype': 'DocField', 'oldfieldname': 'bom_detail_no', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'BOM Detail No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03459', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'bom_detail_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-23 16:39:31', 'doctype': 'DocField', 'oldfieldname': 'main_item_code', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03393', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'main_item_code', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-23 16:39:31', 'doctype': 'DocField', 'oldfieldname': 'rm_item_code', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Raw Material Item Code', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03394', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'rm_item_code', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-21 10:08:33', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03650', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-30 18:02:44', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Stock Uom', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03454', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-11-30 14:32:11', 'doctype': 'DocField', 'oldfieldname': 'required_qty', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Required Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03449', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'required_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-11-30 14:32:11', 'doctype': 'DocField', 'oldfieldname': 'consumed_qty', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Consumed Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03448', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'consumed_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-11-30 19:19:34', 'doctype': 'DocField', 'oldfieldname': 'conversion_factor', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Conversion Factor', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03455', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'conversion_factor', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-11-23 16:39:31', 'doctype': 'DocField', 'oldfieldname': 'rate', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Rate', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03396', 'idx': 10, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-11-23 16:39:31', 'doctype': 'DocField', 'oldfieldname': 'amount', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Amount', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03397', 'idx': 11, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-01-21 14:23:48', 'doctype': 'DocField', 'oldfieldname': 'current_stock', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'nabin@webnotestech.com', 'label': 'Current Stock', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'PR Raw Material Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03657', 'idx': 12, 'default': None, 'colour': None, 'modified': '2010-06-30 15:00:33', 'parenttype': 'DocType', 'fieldname': 'current_stock', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/purchase_common/__init__.py b/srm/doctype/purchase_common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/purchase_common/__init__.py
diff --git a/srm/doctype/purchase_common/purchase_common.js b/srm/doctype/purchase_common/purchase_common.js
new file mode 100644
index 0000000..f91b1d8
--- /dev/null
+++ b/srm/doctype/purchase_common/purchase_common.js
@@ -0,0 +1,508 @@
+// Preset
+// ------
+// cur_frm.cscript.tname - Details table name
+// cur_frm.cscript.fname - Details fieldname
+var tname = cur_frm.cscript.tname;
+var fname = cur_frm.cscript.fname;
+
+
+cur_frm.cscript.get_default_schedule_date = function(doc) {
+    var ch = getchildren( tname, doc.name, fname);
+    if (flt(ch.length) > 0){
+      $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_schedule_date', '', function(r, rt) { refresh_field(fname); });
+    }
+}
+
+/*
+// ======================== Supplier =================================================
+cur_frm.cscript.supplier = function(doc, cdt, cdn) {
+  if(doc.supplier) get_server_fields('get_supplier_details', doc.supplier,'', doc, cdt, cdn, 1);
+}
+
+*/
+
+
+// ======================== Conversion Rate ==========================================
+cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) {
+  cur_frm.cscript.calc_amount( doc, 1);
+}
+
+//==================== Item Code Get Query =======================================================
+// Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed.
+cur_frm.fields_dict[fname].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.%(key)s LIKE "%s" LIMIT 50'
+}
+
+//==================== Get Item Code Details =====================================================
+cur_frm.cscript.item_code = function(doc,cdt,cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code) {
+    temp = "{'item_code':'"+(d.item_code?d.item_code:'')+"', 'warehouse':'"+(d.warehouse?d.warehouse:'')+"'}"
+    get_server_fields('get_item_details', temp, fname, doc, cdt, cdn, 1);
+  }
+}
+
+//==================== Update Stock Qty ==========================================================
+cur_frm.cscript.update_stock_qty = function(doc,cdt,cdn){
+  d = locals[cdt][cdn]
+  // Step 1:=> Check if qty , uom, conversion_factor
+  if (d.qty && d.uom && d.conversion_factor){
+    // Step 2:=> Set stock_qty = qty * conversion_factor
+    d.stock_qty = flt(flt(d.qty) * flt(d.conversion_factor));
+    // Step 3:=> Refer stock_qty field a that particular row.
+    refresh_field('stock_qty' , d.name,fname);
+  }
+}
+
+//==================== Purchase UOM Get Query =======================================================
+//cur_frm.fields_dict[fname].grid.get_field("uom").get_query = function(doc, cdt, cdn) {
+//  var d = locals[this.doctype][this.docname];
+//  return 'SELECT `tabUOM Conversion Detail`.`uom` FROM `tabUOM Conversion Detail` WHERE `tabUOM Conversion Detail`.`parent` = "' + d.item_code + '" AND `tabUOM Conversion Detail`.uom LIKE "%s"'
+//}
+
+
+//==================== UOM ======================================================================
+cur_frm.cscript.uom = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code && d.uom) {
+    call_back = function(doc, cdt, cdn){
+      //refresh_field('purchase_rate', d.name, fname);
+      //refresh_field('qty' , d.name, fname);
+      //refresh_field('conversion_factor' , d.name, fname);
+      //var doc = locals[cdt][cdn];
+      cur_frm.cscript.calc_amount(doc, 2);
+    }
+    str_arg = {'item_code':d.item_code, 'uom':d.uom, 'stock_qty':flt(d.stock_qty), 'qty': flt(d.qty)}
+    // Updates Conversion Factor, Qty and Purchase Rate
+    get_server_fields('get_uom_details',JSON.stringify(str_arg), fname, doc,cdt,cdn,1, call_back);
+    // don't make mistake of calling update_stock_qty() the get_uom_details returns stock_qty as per conversion factor properly
+  }
+}
+
+
+//==================== Conversion factor =========================================================
+cur_frm.cscript.conversion_factor = function(doc, cdt, cdn) {
+  cur_frm.cscript.uom(doc, cdt, cdn);
+}
+
+//==================== stock qty ======================================================================
+cur_frm.cscript.stock_qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.uom && d.qty){
+    d.conversion_factor = flt(d.stock_qty)/flt(d.qty);
+    refresh_field('conversion_factor', d.name, fname);
+  }
+}
+
+//==================== Warehouse ================================================================
+cur_frm.cscript.warehouse = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if (d.item_code && d.warehouse) {
+    str_arg = "{'item_code':'" +  (d.item_code?d.item_code:'') + "', 'warehouse':'" + (d.warehouse?d.warehouse:'') + "'}"
+    get_server_fields('get_bin_details', str_arg, fname, doc, cdt, cdn, 1);
+  }  
+}
+
+//=================== Quantity ===================================================================
+cur_frm.cscript.qty = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  // Step 1: => Update Stock Qty 
+  cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
+  // Step 2: => Calculate Amount
+  cur_frm.cscript.calc_amount(doc, 2);
+}
+
+
+//=================== Purchase Rate ==============================================================
+cur_frm.cscript.purchase_rate = function(doc, cdt, cdn) {
+  // Calculate Amount
+  cur_frm.cscript.calc_amount(doc, 2);
+}
+
+//==================== Import Rate ================================================================
+cur_frm.cscript.import_rate = function(doc, cdt, cdn) {
+  // Calculate Amount
+  cur_frm.cscript.calc_amount(doc, 1);
+}
+
+
+//====================== Calculate Amount  ============================================================
+/*cur_frm.cscript.calc_amount = function(doc, n) {
+  // Set defaults
+  doc = locals[doc.doctype][doc.name] 
+  if (! doc.conversion_rate) doc.conversion_rate = 1;
+  if(!n) n=0;
+  var net_total = 0;
+  var net_total_import = 0;
+  
+  var cl = getchildren(tname, doc.name, fname);
+  
+  for(var i=0;i<cl.length;i++) 
+  {
+    if(n == 1){ 
+      set_multiple(tname, cl[i].name, {'purchase_rate': flt(doc.conversion_rate) * flt(cl[i].import_rate) }, fname);
+      set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(doc.conversion_rate) * flt(cl[i].import_rate))}, fname);
+      set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].import_rate))}, fname);
+    }
+    if(n == 2){
+      set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate)), 'import_rate': flt(flt(cl[i].purchase_rate) / flt(doc.conversion_rate)) }, fname);
+      set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) *  flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
+    }
+    net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
+    net_total_import += flt(flt(cl[i].qty) * flt(cl[i].import_rate));
+  }
+  doc.net_total = flt(net_total) ;
+  doc.net_total_import = flt(net_total_import) ;
+  refresh_field('net_total');
+  refresh_field('net_total_import');
+}  */
+
+//==================== check if item table is blank ==============================================
+var is_item_table = function(doc,cdt,cdn) {
+  // Step 1 :=>Get all childrens/ rows from Detail Table
+  var cl = getchildren(tname, doc.name, fname);
+  // Step 2 :=> If there are no rows then set validated = false, I hope this will stop further execution of code.
+  if (cl.length == 0) {
+    alert("There is no item in table"); validated = false;
+  }
+}
+
+//==================== Validate ====================================================================
+cur_frm.cscript.validate = function(doc, cdt, cdn) {
+  // Step 1:=> check if item table is blank
+  is_item_table(doc,cdt,cdn);
+  // Step 2:=> Calculate Amount
+  cur_frm.cscript.calc_amount(doc, 1);
+}
+
+
+
+/*cur_frm.cscript.other_fname = "purchase_tax_details";
+other_charges ===> purchase_tax_details
+RV Tax Detail ===> Purchase Tax Detail
+cur_frm.cscript.recalc ===> cur_frm.cscript.calc_amount
+export ===> import
+other_charges_total ===> total_tax
+Other Charges Calculation  ===> Tax Calculation*/
+
+// **************** RE-CALCULATE VALUES ***************************
+
+cur_frm.cscript['Re-Calculate Values'] = function(doc, cdt, cdn) {
+  cur_frm.cscript['Calculate Tax'](doc,cdt,cdn);
+}
+
+cur_frm.cscript['Calculate Tax'] = function(doc, cdt, cdn) {
+  var other_fname  = cur_frm.cscript.other_fname;
+
+  var cl = getchildren('Purchase Tax Detail', doc.name, other_fname, doc.doctype);
+  for(var i = 0; i<cl.length; i++){
+    cl[i].total_tax_amount = 0;
+    cl[i].total_amount = 0;
+    cl[i].tax_amount = 0;                    // this is done to calculate other charges
+    cl[i].total = 0;
+    if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
+      alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
+      validated = false;
+    }
+  }
+  if(doc.doctype != 'Payable Voucher') cur_frm.cscript.calc_amount(doc, 1);
+  else if(doc.doctype == 'Payable Voucher') cur_frm.cscript.calc_total(doc);
+}
+
+
+
+cur_frm.cscript.get_item_wise_tax_detail = function( doc, rate, cl, i, tax, t) {
+  doc = locals[doc.doctype][doc.name];
+  var detail = '';
+  detail = cl[i].item_code + " : " + cstr(rate) + NEWLINE;
+  return detail;
+}
+
+  //if(cur_frm.cscript.custom_recalc)cur_frm.cscript.custom_recalc(doc);
+
+
+
+cur_frm.cscript.amount = function(doc, cdt, cdn) {
+  cur_frm.cscript.calc_amount(doc, 3);
+}
+
+
+//====================== Calculate Amount for PO and PR not for PV  ============================================================
+cur_frm.cscript.calc_amount = function(doc, n) {
+  // Set defaults
+  doc = locals[doc.doctype][doc.name]
+  var other_fname  = cur_frm.cscript.other_fname;
+  if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
+  if(!n) n=0;
+  var net_total = 0;
+  var net_total_import = 0;
+  
+  var cl = getchildren(tname, doc.name, fname);
+  
+  for(var i=0;i<cl.length;i++) 
+  {
+    if(n == 1){ 
+      set_multiple(tname, cl[i].name, {'purchase_rate': flt(doc.conversion_rate) * flt(cl[i].import_rate) }, fname);
+      set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(doc.conversion_rate) * flt(cl[i].import_rate))}, fname);
+      set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].import_rate))}, fname);
+    }
+    if(n == 2){
+      set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate)), 'import_rate': flt(flt(cl[i].purchase_rate) / flt(doc.conversion_rate)) }, fname);
+      set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) *  flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
+    }
+    if(n == 3){
+      set_multiple(tname, cl[i].name, {'purchase_rate': flt(flt(cl[i].amount) / flt(cl[i].qty)) }, fname);
+      set_multiple(tname, cl[i].name, {'import_rate': flt(flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname); 
+      set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) *  flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
+    }
+    if (n != 3){
+      net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
+      net_total_import += flt(flt(cl[i].qty) * flt(cl[i].import_rate));
+    }
+    else if(n == 3){
+      net_total += flt(cl[i].amount);
+      net_total_import += flt(cl[i].amount) / flt(doc.conversion_rate);
+    }
+    //update stock uom
+    cur_frm.cscript.update_stock_qty(doc, tname, cl[i].name);
+  }
+  doc.net_total = flt(net_total) ;
+  doc.net_total_import = flt(net_total_import) ;
+  refresh_field('net_total');
+  refresh_field('net_total_import');
+  
+  cur_frm.cscript.val_cal_charges(doc, cdt, cdn, tname, fname, other_fname);
+}
+
+
+//======== Function was broken away from cur_frm.cscript.calc_amount as PV has fieldname 'rate' instead of 'purchase_rate'===========
+cur_frm.cscript.val_cal_charges = function(doc, cdt, cdn, tname, fname, other_fname){
+
+  doc = locals[doc.doctype][doc.name]
+  if(flt(doc.net_total) > 0) {
+    var cl = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+    for(var i = 0; i<cl.length; i++){
+      cl[i].total_tax_amount = 0;
+      cl[i].total_amount = 0;
+      cl[i].tax_amount = 0;                    // this is done to calculate other charges
+      cl[i].total = 0;
+      cl[i].item_wise_tax_detail = "";
+      if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
+        alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
+        validated = false;
+      }
+    }
+    cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
+  }
+  cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
+
+  refresh_many(['net_total','grand_total','rounded_total','grand_total_import','rounded_total_import','in_words','in_words_import','purchase_tax_details','total_tax','other_charges_added', 'other_charges_deducted','net_total_import','other_charges_added_import','other_charges_deducted_import']);
+
+}
+
+
+// ******************************* OTHER CHARGES *************************************
+cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname) {
+  doc = locals[doc.doctype][doc.name];
+  // make display area
+  // ------------------
+
+  
+  cur_frm.fields_dict['Tax Calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Other Charges and Landed cost:</b>';
+  var cl = getchildren(tname, doc.name, fname);
+  var tax = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+  // make display table
+  // ------------------
+  var otc = make_table(cur_frm.fields_dict['Tax Calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
+  $y(otc,{marginTop:'8px'});
+  
+  var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
+  
+  
+  for(var i=0;i<cl.length;i++) {
+    var item_tax = 0;
+    if(doc.doctype != 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
+    else if(doc.doctype == 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].rate));
+
+    var prev_total = flt(cl[i].amount);
+    if(cl[i].item_tax_rate)
+      var check_tax = eval('var a='+cl[i].item_tax_rate+';a');        //to get in dictionary
+    
+    // Add Item Code in new Row 
+    //--------------------------
+    $td(otc,i+1,0).innerHTML = cl[i].item_code;
+    
+    var tax = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+    var total = net_total;
+    for(var t=0;t<tax.length;t++){
+ 
+      var account = tax[t].account_head;
+      $td(otc,0,t+1).innerHTML = account?account:'';
+      //Check For Rate
+      if(cl[i].item_tax_rate && check_tax[account]!=null)  {rate = flt(check_tax[account]);}
+      else               // if particular item doesn't have particular rate it will take other charges rate
+        rate = flt(tax[t].rate);
+      //Check For Rate and get tax amount
+      var tax_amount = cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t, cl[i], rate);
+      
+      //enter item_wise_tax_detail i.e. tax rate on each item
+      
+      item_wise_tax_detail = cur_frm.cscript.get_item_wise_tax_detail( doc, rate, cl, i, tax, t);
+      
+      
+      if(tax[t].add_deduct_tax == 'Add'){
+        // this is calculation part for all types
+        if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
+        tax[t].total_amount = flt(tax_amount.toFixed(2));     //stores actual tax amount in virtual field
+        tax[t].total_tax_amount = flt(prev_total.toFixed(2));      //stores total amount in virtual field
+        tax[t].tax_amount += flt(tax_amount.toFixed(2));       
+        var total_amount = flt(tax[t].tax_amount);
+        total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
+        if(tax[t].category != "For Valuation"){
+          set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)+flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
+          prev_total += flt(tax[t].total_amount);
+          total += flt(tax[t].tax_amount);  // for adding total to previous amount       
+        }
+        else{
+          set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
+          prev_total = prev_total;
+        }
+        //prev_total += flt(tax[t].total_amount);   // for previous row total
+
+        if(tax[t].charge_type == 'Actual')
+          $td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
+        else
+          $td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
+
+        if (tax[t].category != "For Total"){
+          item_tax += tax[t].total_amount;
+        }
+      }
+      else if(tax[t].add_deduct_tax == 'Deduct'){
+        // this is calculation part for all types
+        if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
+        tax[t].total_amount = flt(tax_amount.toFixed(2));     //stores actual tax amount in virtual field
+        tax[t].total_tax_amount = flt(prev_total.toFixed(2));      //stores total amount in virtual field
+        tax[t].tax_amount += flt(tax_amount.toFixed(2));
+        var total_amount = flt(tax[t].tax_amount);
+        total_tax_amount = flt(tax[t].total_tax_amount) - flt(total_amount);
+        if(tax[t].category != "For Valuation"){
+          set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)-flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
+          prev_total -= flt(tax[t].total_amount); 
+          total -= flt(tax[t].tax_amount);  // for adding total to previous amount       
+        }
+        else{
+          set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
+          prev_total = prev_total;
+        }
+        //prev_total += flt(tax[t].total_amount);   // for previous row total
+
+        if(tax[t].charge_type == 'Actual')
+          $td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
+        else
+          $td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
+
+        if (tax[t].category != "For Total"){
+          item_tax -= tax[t].total_amount;
+        }
+      }      
+      
+      
+    }
+    set_multiple(tname, cl[i].name, {'item_tax_amount': item_tax }, fname);
+  }
+}
+
+
+
+
+// ******* Calculation of total amounts of document (item amount + other charges)****************
+cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) {
+  doc = locals[doc.doctype][doc.name];
+  var net_total = 0; var total_tax = 0; var other_charges_added = 0; var other_charges_deducted = 0;
+  var cl = getchildren(tname, doc.name, fname);
+  for(var i = 0; i<cl.length; i++){
+    net_total += flt(cl[i].amount);
+  }
+  var d = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+  for(var j = 0; j<d.length; j++){
+    if(d[j].category != 'For Valuation'){
+      
+      if(d[j].add_deduct_tax == 'Add'){
+        other_charges_added += flt(d[j].tax_amount);
+        total_tax += flt(d[j].tax_amount);
+      }
+      if(d[j].add_deduct_tax == 'Deduct'){
+        other_charges_deducted += flt(d[j].tax_amount);
+        total_tax -= flt(d[j].tax_amount);
+      }
+    }
+  }
+  doc.net_total = flt(net_total);
+  doc.total_tax = flt(total_tax);
+
+  doc.other_charges_added = flt(other_charges_added);
+  doc.other_charges_deducted = flt(other_charges_deducted);
+  doc.grand_total = flt(flt(net_total) + flt(other_charges_added) - flt(other_charges_deducted));
+  doc.rounded_total = Math.round(doc.grand_total);
+  doc.net_total_import = flt(flt(net_total) / flt(doc.conversion_rate));
+  doc.other_charges_added_import = flt(flt(other_charges_added) / flt(doc.conversion_rate));
+  doc.other_charges_deducted_import = flt(flt(other_charges_deducted) / flt(doc.conversion_rate));
+  doc.grand_total_import = flt(flt(doc.grand_total) / flt(doc.conversion_rate));
+  doc.rounded_total_import = Math.round(doc.grand_total_import);
+
+  if(doc.doctype == 'Payable Voucher'){
+    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(net_total) + flt(other_charges_added) - flt(other_charges_deducted) - flt(doc.total_tds_on_voucher));
+    
+    // outstanding amount 
+    if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(other_charges_added) - flt(other_charges_deducted) - flt(doc.total_tds_on_voucher) - flt(doc.total_advance);
+    
+    refresh_many(['net_total','total_taxes','grand_total','total_tds_on_voucher','total_amount_to_pay', 'outstanding_amount']);
+  }
+}
+
+
+cur_frm.cscript.check_charge_type_and_get_tax_amount = function(doc, tax, t, cl, rate, print_amt) {
+  doc = locals[doc.doctype][doc.name];
+
+  var tax_amount = 0;
+  if(tax[t].charge_type == 'Actual') {
+    var value = flt(tax[t].rate) / flt(doc.net_total);   // this give the ratio in which all items are divided           
+    return tax_amount = flt(value) * flt(cl.amount);
+   }   
+  else if(tax[t].charge_type == 'On Net Total') {
+    return tax_amount = (flt(rate) * flt(cl.amount) / 100);
+  }
+  else if(tax[t].charge_type == 'On Previous Row Amount'){
+    var row_no = (tax[t].row_id).toString();
+    var row = (row_no).split("+");      // splits the values and stores in an array
+    for(var r = 0;r<row.length;r++){
+      var id = cint(row[r].replace(/^\s+|\s+$/g,""));
+      tax_amount += (flt(rate) * flt(tax[id-1].total_amount) / 100);
+    }
+    var row_id = row_no.indexOf("/");
+    if(row_id != -1) {
+      rate = '';
+      var row = (row_no).split("/");      // splits the values and stores in an array
+      if(row.length>2) alert("You cannot enter more than 2 nos. for division");
+      var id1 = cint(row[0].replace(/^\s+|\s+$/g,""));
+      var id2 = cint(row[1].replace(/^\s+|\s+$/g,""));
+      tax_amount = flt(tax[id1-1].total_amount) / flt(tax[id2-1].total_amount);
+    }
+    return tax_amount
+  }
+  else if(tax[t].charge_type == 'On Previous Row Total') {
+    var row = cint(tax[t].row_id);
+    if(tax[row-1].add_deduct_tax == 'Add'){
+      return tax_amount = flt(rate) * (flt(tax[row-1].total_tax_amount)+flt(tax[row-1].total_amount)) / 100;
+     }
+    else if(tax[row-1].add_deduct_tax == 'Deduct'){
+      return tax_amount = flt(rate) * (flt(tax[row-1].total_tax_amount)-flt(tax[row-1].total_amount)) / 100;
+     }
+  }
+}
diff --git a/srm/doctype/purchase_common/purchase_common.py b/srm/doctype/purchase_common/purchase_common.py
new file mode 100644
index 0000000..cad4f18
--- /dev/null
+++ b/srm/doctype/purchase_common/purchase_common.py
@@ -0,0 +1,622 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+		self.chk_tol_for_list = ['Indent - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Payable Voucher']
+
+		self.update_qty = {'Indent - Purchase Order'						: 'ordered_qty',
+											 'Purchase Order - Purchase Receipt'	: 'received_qty',
+											 'Purchase Order - Payable Voucher'	 : 'billed_qty',
+											 'Purchase Receipt - Payable Voucher' : 'billed_qty'}
+
+		self.update_percent_field = {'Indent - Purchase Order'						: 'per_ordered',
+									 'Purchase Order - Purchase Receipt'	: 'per_received',
+									 'Purchase Order - Payable Voucher'	 : 'per_billed',
+									 'Purchase Receipt - Payable Voucher' : 'per_billed'}
+
+		# used in validation for items and update_prevdoc_detail
+		self.doctype_dict = {'Indent'						 : 'Indent Detail',
+							 'RFQ'								: 'RFQ Detail',
+							 'Supplier Quotation' : 'Supplier Quotation Detail',
+							 'Purchase Order'		 : 'PO Detail',
+							 'Purchase Receipt'	 : 'Purchase Receipt Detail'}
+ 
+		self.repair_percent_field = {
+												 'ordered_qty' : 'per_ordered',
+												 'received_qty': 'per_received',
+												 'billed_qty'	: 'per_billed'}
+
+		self.repair_fields = {
+									'Indent Detail'			 : ['ordered_qty'],
+									'PO Detail'				 : ['received_qty', 'billed_qty'],
+									'Purchase Receipt Detail': ['billed_qty']
+							 }
+
+		self.next_dt_detail = {
+									'ordered_qty' : 'PO Detail',
+									'billed_qty'	: 'PV Detail',
+									'received_qty': 'Purchase Receipt Detail'
+								}
+
+		self.msg = []
+
+
+	def get_default_schedule_date( self, obj):
+		for d in getlist( obj.doclist, obj.fname):
+			item = sql("select lead_time_days from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())" % cstr(d.item_code) , as_dict = 1)
+			ltd = item and cint(item[0]['lead_time_days']) or 0
+			if ltd and obj.doc.transaction_date:
+				if d.fields.has_key('lead_time_date') or obj.doc.doctype == 'Indent':
+					d.lead_time_date = cstr(add_days( obj.doc.transaction_date, cint(ltd)))
+				if not d.fields.has_key('prevdoc_docname') or (d.fields.has_key('prevdoc_docname') and not d.prevdoc_docname):
+					d.schedule_date =	cstr( add_days( obj.doc.transaction_date, cint(ltd)))
+				
+	# Client Trigger functions
+	#------------------------------------------------------------------------------------------------
+
+	# Get Supplier Details 
+	def get_supplier_details(self, name = ''):
+		details = sql("select supplier_name,address from `tabSupplier` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+		if details:
+			ret = {
+				'supplier_name'	:	details and details[0]['supplier_name'] or '',
+				'supplier_address'	:	details and details[0]['address'] or ''
+			}
+			# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
+			contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
+			ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
+			return cstr(ret)
+		else:
+			msgprint("Supplier : %s does not exists" % (name))
+			raise Exception
+	
+	# Get TERMS AND CONDITIONS
+	# =======================================================================================
+	def get_tc_details(self,obj):
+		r = sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
+		if r: obj.doc.terms = r[0][0]
+
+	# Get Item Details
+	def get_item_details( self, obj, arg =''):
+
+		arg = eval(arg)
+		item = sql("select item_name,item_group, brand, description, min_order_qty, stock_uom, default_warehouse,lead_time_days, last_purchase_rate from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())", (arg['item_code']), as_dict = 1)
+		tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg['item_code'])
+		t = {}
+		for x in tax: t[x[0]] = flt(x[1])
+		# get warehouse 
+		if arg['warehouse']:
+			wh = arg['warehouse']
+		else:
+			wh = item and item[0]['default_warehouse'] or ''
+			
+		ret = {
+			'item_name'					: item and item[0]['item_name'] or '',
+			'item_group'				 : item and item[0]['item_group'] or '',
+			'brand'							: item and item[0]['brand'] or '',
+			'description'				: item and item[0]['description'] or '',
+			'qty'								: 0,
+			'uom'								: item and item[0]['stock_uom'] or '',
+			'stock_uom'					: item and item[0]['stock_uom'] or '',
+			'conversion_factor'	: '1',
+			'warehouse'					: wh,
+			'item_tax_rate'			: str(t),
+			'batch_no'					 : ''		
+		}
+		
+		# get min_order_qty from item
+		if obj.doc.doctype in ['Indent','RFQ']:
+			ret['min_order_qty'] = item and flt(item[0]['min_order_qty']) or 0
+		
+		# get projected qty from bin
+		if ret['warehouse']:
+			bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], ret['warehouse']), as_dict=1)
+			ret['projected_qty'] = bin and flt(bin[0]['projected_qty']) or 0
+
+		# get schedule date, lead time date
+		if obj.doc.transaction_date and item and item[0]['lead_time_days']:
+			ret['schedule_date'] =	cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
+			ret['lead_time_date'] = cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
+		
+		#	get last purchase rate as per stock uom and default currency for following list of doctypes
+		if obj.doc.doctype in ['Supplier Quotation', 'Purchase Order', 'Purchase Receipt']:
+			ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
+			ret['import_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1)
+		
+		return cstr(ret)
+
+	# Get Available Qty at Warehouse
+	def get_bin_details( self, arg = ''):
+		arg = eval(arg)
+		bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict=1)
+		ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 }
+		return str(ret)
+
+	# Get UOM Details
+	def get_uom_details(self, arg = ''):
+		arg, ret = eval(arg), {}
+		lpr = sql("select last_purchase_rate from `tabItem` where name = %s and (ifnull(end_of_life,'')=''	or end_of_life = '0000-00-00' or end_of_life >	now())", arg['item_code'], as_dict =1)
+		uom = sql("select conversion_factor from `tabUOM Conversion Detail` where parent = %s and uom = %s", (arg['item_code'],arg['uom']), as_dict = 1)
+		if uom:
+			ret = {
+				'conversion_factor' : flt(uom[0]['conversion_factor']),
+				'qty'				 : flt(arg['stock_qty']) / flt(uom[0]['conversion_factor']),
+				'purchase_rate'		 : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0
+			}
+		
+		return str(ret)
+
+	# get last purchase rate
+	def get_last_purchase_rate( self, obj):
+		for d in getlist(obj.doclist, obj.fname):
+			if d.item_code:
+				rate = sql("select last_purchase_rate from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())"% cstr(d.item_code), as_dict = 1 )
+				d.purchase_rate =	rate and flt(rate[0]['last_purchase_rate']) * flt(d.conversion_factor) or 0
+
+				if not rate[0]['last_purchase_rate']:
+					msgprint("%s has no Last Purchase Rate."% d.item_code)
+
+	# validation
+	# -------------------------------------------------------------------------------------------------------
+	
+	# validate fields
+	def validate_mandatory(self, obj):
+		# check amendment date
+		if obj.doc.amended_from and not obj.doc.amendment_date:
+			msgprint("Please enter amendment date")
+			raise Exception
+
+	# validate for same items and	validate is_stock_item , is_purchase_item also validate uom and conversion factor
+	def validate_for_items(self, obj):
+		check_list, chk_dupl_itm=[],[]
+		for d in getlist( obj.doclist, obj.fname):
+			# validation for valid qty	
+			if flt(d.qty) < 0 or (d.parenttype != 'Purchase Receipt' and not flt(d.qty)):
+				msgprint("Please enter valid qty for item %s" % cstr(d.item_code))
+				raise Exception
+			
+			# udpate with latest quantities
+			bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+			
+			f_lst ={'projected_qty': bin and flt(bin[0]['projected_qty']) or 0, 'ordered_qty': 0, 'received_qty' : 0, 'billed_qty': 0}
+			if d.doctype == 'Purchase Receipt Detail':
+				f_lst.pop('received_qty')
+			for x in f_lst :
+				if d.fields.has_key(x):
+					d.fields[x] = f_lst[x]
+			
+			item = sql("select is_stock_item, is_purchase_item from tabItem where name=%s and (ifnull(end_of_life,'')=''	or end_of_life = '0000-00-00' or end_of_life >	now())", d.item_code)
+			if not item:
+				msgprint("Item %s does not exist in Item Master." % cstr(d.item_code))
+				raise Exception
+			
+			# validate stock item
+			if item[0][0]=='Yes':
+				if not d.warehouse:
+					msgprint("Warehouse is mandatory for %s, since it is a stock item" % d.item_code)
+					raise Exception
+			
+			# validate purchase item
+			if not item[0][1]=='Yes':
+				msgprint("Item %s is not purchase item." % (d.item_code))
+				raise Exception
+			
+			if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
+				# check warehouse, uom	in previous doc and in current doc are same.
+				data = sql("select item_code, warehouse, uom from `tab%s` where name = '%s'" % ( self.doctype_dict[d.prevdoc_doctype], d.prevdoc_detail_docname), as_dict = 1)
+				if not data:
+					msgprint("Please fetch data in Row " + cstr(d.idx) + " once again or please contact Administrator.")
+					raise Exception
+				
+				# Check if Item Code has been modified.
+				if not cstr(data[0]['item_code']) == cstr(d.item_code):
+					msgprint("Please check Item %s is not present in %s %s ." % (d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
+					raise Exception
+				
+				# Check if Warehouse has been modified.
+				if not cstr(data[0]['warehouse']) == cstr(d.warehouse):
+					msgprint("Please check warehouse %s of Item %s which is not present in %s %s ." % (d.warehouse, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
+					raise Exception
+				
+				#	Check if UOM has been modified.
+				if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Indent':
+					msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % (d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
+					raise Exception
+			
+			# list criteria that should not repeat if item is stock item
+			e = [d.schedule_date, d.item_code, d.warehouse, d.uom, d.fields.has_key('prevdoc_docname') and d.prevdoc_docname or '', d.fields.has_key('prevdoc_detail_docname') and d.prevdoc_detail_docname or '', d.fields.has_key('batch_no') and d.batch_no or '']
+			
+			# if is not stock item
+			f = [d.schedule_date, d.item_code, d.description]
+			
+			ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
+			
+			if ch and ch[0][0] == 'Yes':			
+				# check for same items
+				if e in check_list:
+					msgprint("Item %s has been entered more than once with same schedule date, warehouse and uom." % d.item_code)
+					raise Exception
+				else:
+					check_list.append(e)
+					
+			elif ch and ch[0][0] == 'No':
+				# check for same items
+				if f in chk_dupl_itm:
+					msgprint("Item %s has been entered more than once." % d.item_code)
+					raise Exception
+				else:
+					chk_dupl_itm.append(f)
+
+	# validate conversion rate
+	def validate_conversion_rate(self, obj):
+		default_currency = get_obj('Manage Account').doc.default_currency
+		if not default_currency:
+			msgprint('Message: Please enter default currency in Global Defaults')
+			raise Exception
+
+		company_currency = sql("select default_currency from `tabCompany` where name = '%s'" % obj.doc.company)
+		curr = company_currency and cstr(company_currency[0][0]) or default_currency
+		if (obj.doc.currency == curr and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != curr and flt(obj.doc.conversion_rate) == 1.00):
+			msgprint("Message: Please Enter Appropriate Conversion Rate.")
+			raise Exception
+
+	def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname):
+		if prevdoc_docname :
+			get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc_doctype, prevdoc_docname))
+			name = get_name and get_name[0][0] or ''
+			if name:	#check for incorrect docname
+				dt = sql("select company, docstatus from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
+				company_name = dt and cstr(dt[0][0]) or ''
+				docstatus = dt and dt[0][1] or 0
+				
+				# check for docstatus 
+				if (docstatus != 1):
+					msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " is not Submitted Document.")
+					raise Exception
+
+				# check for company
+				if (company_name != obj.doc.company):
+					msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " does not belong to the Company: " + cstr(obj.doc.company))
+					raise Exception
+
+				if prevdoc_doctype in ['Supplier Quotation','Purchase Order', 'Purchase Receipt']:
+					dt = sql("select supplier, currency from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
+					supplier = dt and dt[0][0] or ''
+					currency = dt and dt[0][1] or ''
+						
+					# check for supplier
+					if (supplier != obj.doc.supplier):
+						msgprint("Purchase Order: " + cstr(d.prevdoc_docname) + " supplier :" + cstr(supplier) + " does not match with supplier of current document.")
+						raise Exception
+					 
+					# check for curency
+					if (currency != obj.doc.currency):
+						msgprint("Purchase Order: " + cstr(d.prevdoc_docname) + " currency :" + cstr(currency) + " does not match with currency of current document.")
+						raise Exception
+
+			else: # if not name than
+				msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " is not a valid " + cstr(prevdoc_doctype))
+				raise Exception
+				
+
+# Validate values with reference document
+	#---------------------------------------
+	def validate_reference_value(self, obj):
+		ref_doc = []
+		for d in getlist(obj.doclist, obj.fname):
+			if d.prevdoc_doctype and d.prevdoc_docname and d.prevdoc_doctype not in ref_doc:
+				mapper_name = d.prevdoc_doctype + '-' + obj.doc.doctype
+				get_obj('DocType Mapper', mapper_name, with_children = 1).validate_reference_value(obj, obj.doc.name)
+				ref_doc.append(d.prevdoc_doctype)
+
+
+	# Check for Stopped status 
+	def check_for_stopped_status(self, doctype, docname):
+		stopped = sql("select name from `tab%s` where name = '%s' and status = 'Stopped'" % ( doctype, docname))
+		if stopped:
+			msgprint("One cannot do any transaction against %s : %s, it's status is 'Stopped'" % ( doctype, docname))
+			raise Exception
+			
+	# Check Docstatus of Next DocType on Cancel AND of Previous DocType on Submit
+	def check_docstatus(self, check, doctype, docname , detail_doctype = ''):
+		
+		if check == 'Next':
+			# Convention := doctype => Next Doctype, docname = current_docname , detail_doctype = Next Doctype Detail Table
+
+			submitted = sql("select t1.name from `tab%s` t1,`tab%s` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % ( doctype, detail_doctype, docname))
+			if submitted:
+				msgprint(cstr(doctype) + " : " + cstr(submitted[0][0]) + " has already been submitted !")
+				raise Exception
+
+		if check == 'Previous':
+			# Convention := doctype => Previous Doctype, docname = Previous Docname 
+			submitted = sql("select name from `tab%s` where docstatus = 1 and name = '%s'" % (doctype, docname))
+			if not submitted:
+				msgprint(cstr(doctype) + " : " + cstr(submitted[0][0]) + " not submitted !")
+				raise Exception
+				
+	# Update Ref Doc
+	# =======================================================
+	def get_qty(self,curr_doctype,ref_tab_fname,ref_tab_dn,ref_doc_tname, transaction, curr_parent_name):
+		# Get total Quantities of current doctype (eg. PR) except for qty of this transaction
+		#------------------------------
+		# please check as UOM changes from Indent - Purchase Order ,so doing following else uom should be same .
+		# i.e. in PO uom is NOS then in PR uom should be NOS
+		# but if in Indent uom KG it can change in PO
+		
+		get_qty = (transaction == 'Indent - Purchase Order') and 'qty * conversion_factor' or 'qty'
+		qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% ( get_qty, curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
+		qty = qty and flt(qty[0][0]) or 0 
+		
+		# get total qty of ref doctype
+		#--------------------
+		max_qty = sql("select qty from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
+		max_qty = max_qty and flt(max_qty[0][0]) or 0
+		
+		return cstr(qty)+'~~~'+cstr(max_qty)	
+
+
+
+	def update_refdoc_qty(self, curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name):
+		# Get Quantity
+		#------------------------------
+		curr_ref_qty = self.get_qty(curr_doctype,ref_tab_fname,ref_tab_dn,self.doctype_dict[ref_dt], transaction, curr_parent_name)
+		qty, max_qty, max_qty_plus_tol = flt(curr_ref_qty.split('~~~')[0]), flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[1])
+
+		# Qty above Tolerance should be allowed only once.
+		# But there is special case for Transaction 'Indent-Purhcase Order' that there should be no restriction
+		# One can create any no. of PO against same Indent!!!
+		if qty >= max_qty and is_submit and flt(curr_qty) > 0:
+			reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Payable Voucher') and 'Billed'
+			msgprint("Error: Item Code : '%s' of '%s' is already %s." %(item_code,ref_dn,reason))
+			raise Exception
+		
+		#check if tolerance added in item master
+		tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
+		
+		if not(tolerance):
+			tolerance = flt(get_value('Manage Account',None,'tolerance') or 0)
+
+		if is_submit:
+			qty = qty + flt(curr_qty)
+			
+			# Calculate max_qty_plus_tol i.e. max_qty with tolerance 
+			#-----------------------------------------------------------------
+			if transaction in self.chk_tol_for_list:
+				max_qty_plus_tol = max_qty * (1 + (flt(tolerance)/ 100))
+
+				if max_qty_plus_tol < qty:
+					reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Payable Voucher') and 'Billed'
+					msgprint("error:Already %s Qty for %s is %s and maximum allowed Qty is %s" % (cstr(reason), item_code, cstr(flt(qty) - flt(curr_qty)) , cstr(max_qty_plus_tol)))
+					raise Exception
+
+		# Update qty
+		#------------------
+		sql("update `tab%s` set %s = '%s',modified = now() where name = '%s'" % (self.doctype_dict[ref_dt],self.update_qty[transaction] , flt(qty), ref_tab_dn))
+		
+	def update_ref_doctype_dict(self, curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name):
+		# update qty 
+		self.update_refdoc_qty( curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name)
+		
+		# append distinct ref_dn in doctype_dict
+		if not self.ref_doctype_dict.has_key(ref_dn) and self.update_percent_field.has_key(transaction):
+			self.ref_doctype_dict[ref_dn] = [ ref_dt, self.doctype_dict[ref_dt],transaction]
+
+
+	# update prevdoc detail
+	# --------------------
+	def update_prevdoc_detail(self, obj, is_submit):
+		import math
+		self.ref_doctype_dict= {}
+		for d in getlist(obj.doclist, obj.fname):
+			
+			if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
+				transaction = cstr(d.prevdoc_doctype) + ' - ' + cstr(obj.doc.doctype)
+				curr_qty = (transaction == 'Indent - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty)
+				self.update_ref_doctype_dict( flt(curr_qty), d.doctype, d.prevdoc_docname, d.prevdoc_doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, transaction, d.item_code, is_submit, obj.doc.doctype, obj.doc.name)
+			
+			# for payable voucher
+			if d.fields.has_key('purchase_order') and d.purchase_order:
+				curr_qty = sql("select sum(qty) from `tabPV Detail` where po_detail = '%s' and parent = '%s'" % (cstr(d.po_detail), cstr(obj.doc.name)))
+				curr_qty = curr_qty and flt(curr_qty[0][0]) or 0
+				self.update_ref_doctype_dict( curr_qty, d.doctype, d.purchase_order, 'Purchase Order', 'po_detail', d.po_detail, 'Purchase Order - ' + cstr(obj.doc.doctype), d.item_code, is_submit,	obj.doc.doctype, obj.doc.name)
+
+			if d.fields.has_key('purchase_receipt') and d.purchase_receipt:
+				 self.update_ref_doctype_dict( flt(d.qty), d.doctype, d.purchase_receipt, 'Purchase Receipt', 'pr_detail', d.pr_detail, 'Purchase Receipt - ' + cstr(obj.doc.doctype), d.item_code, is_submit,	obj.doc.doctype, obj.doc.name)
+			
+		for ref_dn in self.ref_doctype_dict:
+			# Calculate percentage
+			#----------------------
+			ref_doc_obj = get_obj(self.ref_doctype_dict[ref_dn][0],ref_dn,with_children = 1)
+			count = 0
+			percent = 0
+			for d in getlist(ref_doc_obj.doclist,ref_doc_obj.fname):
+				ref_qty = d.fields[self.update_qty[self.ref_doctype_dict[ref_dn][2]]]
+				if flt(d.qty) - flt(ref_qty) <= 0:
+					percent += 100
+				else:
+					percent += (flt(ref_qty)/flt(d.qty) * 100)
+				count += 1
+			percent_complete = math.floor(flt(percent)/ flt(count))
+			
+			# update percent complete and modified
+			#-------------------------------------
+			sql("update `tab%s` set %s = '%s', modified = '%s' where name = '%s'" % (self.ref_doctype_dict[ref_dn][0], self.update_percent_field[self.ref_doctype_dict[ref_dn][2]], percent_complete, obj.doc.modified, ref_dn))
+
+	#update last purchse rate
+	#------------------------------
+	def update_last_purchase_rate(self, obj, is_submit):
+		for d in getlist(obj.doclist,obj.fname):
+			# get last purchase rate from Purchase Order
+			po_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.transaction_date as date from `tabPurchase Order` t1, `tabPO Detail` t2	where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t1.name != '%s' order by t1.transaction_date DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
+			# get last purchase rate from purchase receipt
+			pr_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.posting_date as date, t1.posting_time from `tabPurchase Receipt` t1, `tabPurchase Receipt Detail` t2	where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1	and t1.name != '%s' order by t1.posting_date DESC, t1.posting_time DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
+			# compare dates of Po & Pr
+			date_diff1	= sql("select DATEDIFF('%s', '%s')" % ( po_lpr and po_lpr[0]['date'] or '0000-00-00', pr_lpr and pr_lpr[0]['date'] or '0000-00-00'))
+
+			if flt(date_diff1[0][0]) == 0	or flt(date_diff1[0][0]) < 0:	lpr = [pr_lpr and pr_lpr[0]['rate'] or 0, pr_lpr and pr_lpr[0]['date'] or '0000-00-00', 'Purchase Receipt'] 
+			elif flt(date_diff1[0][0]) > 0 : lpr = [po_lpr and po_lpr[0]['rate'] or 0, po_lpr and po_lpr[0]['date'] or '0000-00-00', 'Purchase Order']
+
+			# compare dates of above lpr and current doctype
+			date_diff2	= sql("select DATEDIFF('%s', '%s')" % ( lpr[1], (obj.doc.doctype	== 'Purchase Order') and obj.doc.transaction_date or obj.doc.posting_date ))
+
+			if is_submit == 1 and flt(date_diff2[0][0]) == 0 or flt(date_diff2[0][0]) < 0: lpr = [flt(d.purchase_rate) / flt(d.conversion_factor)]
+
+			# update last purchsae rate
+			sql("update `tabItem` set last_purchase_rate = '%s' where name = '%s'" % (flt(lpr[0]),d.item_code))
+			
+	def validate_fiscal_year(self,fiscal_year,transaction_date,dn):
+		fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year)
+		ysd=fy and fy[0][0] or ""
+		yed=add_days(str(ysd),365)		
+		if str(transaction_date) < str(ysd) or str(transaction_date) > str(yed):
+			msgprint("'%s' Not Within The Fiscal Year"%(dn))
+			raise Exception			
+
+
+#---Other charges starting point------------------------
+
+	# Get other charges from Master
+	# =================================================================================
+	def get_purchase_tax_details(self,obj):
+		self.doc.clear_table(obj.doclist,'purchase_tax_details')
+		idx = 0
+		other_charge = sql("select category, add_deduct_tax, charge_type,row_id,description,account_head,rate,tax_amount from `tabPurchase Tax Detail` where parent = '%s' order by idx" %(obj.doc.purchase_other_charges), as_dict = 1)
+		for other in other_charge:
+			d =	addchild(obj.doc, 'purchase_tax_details', 'Purchase Tax Detail', 1, obj.doclist)
+			d.category = other['category']
+			d.add_deduct_tax = other['add_deduct_tax']
+			d.charge_type = other['charge_type']
+			d.row_id = other['row_id']
+			d.description = other['description']
+			d.account_head = other['account_head']
+			d.rate = flt(other['rate'])
+			d.tax_amount = flt(other['tax_amount'])
+			d.idx = idx
+			idx += 1
+
+
+	# Get Tax rate if account type is TAX
+	# =========================================================================
+	def get_rate(self, arg, obj):
+		arg = eval(arg)
+		rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s'" %(arg['account_head']), as_dict=1)
+		
+		ret = {
+				'rate'	:	rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0
+		}
+		#msgprint(ret)
+		return cstr(ret)
+
+	# Check Approving Authority
+	# -------------------------
+	def check_approving_authority(self, doctype_name, grand_total):
+		det = sql("select amount from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount <= '%s'" % (doctype_name, grand_total))
+		amt_list, auth_users = [], []
+		if det:
+			for x in det:
+				amt_list.append(flt(x[0]))
+			max_amount = max(amt_list)
+			# Get names of all approving authority with max amount
+			for d in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount = '%s'" % (doctype_name, flt(max_amount))): auth_users.append(d[0])
+			for x in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount > '%s'" % (doctype_name, grand_total)): auth_users.append(x[0])
+			if not has_common(auth_users, session['data']['profile']['roles']):
+				msgprint("You do not have an authority to submit this %s. Only %s can submit since amount exceeds %s. %s" % (doctype_name, auth_users, get_defaults()['currency'], flt(max_amount)))
+				raise Exception
+				
+				
+	# Get total in words
+	# ==================================================================	
+	def get_total_in_words(self, currency, amount):
+		from webnotes.utils import money_in_words
+		return money_in_words(amount, currency)	
+	
+	# get against document date	
+	#-----------------------------
+	def get_prevdoc_date(self, obj):
+		import datetime
+		for d in getlist(obj.doclist, obj.fname):
+			if d.prevdoc_doctype and d.prevdoc_docname:
+				dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
+				d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
+
+
+#=================================================================================
+# REPAIR OPTION
+#=================================================================================
+
+	def get_next_dt_detail_qty(self, next_dt_detail, name, curr_dt, f):
+		get_qty = (curr_dt == 'Indent') and 'qty * conversion_factor' or 'qty'
+		qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1"% (get_qty, next_dt_detail, (f == 'billed_qty') and (curr_dt == 'Purchase Order' and 'po_detail' or 'pr_detail') or 'prevdoc_detail_docname', name))
+		return qty and flt(qty[0][0]) or 0
+
+	def repair_curr_qty_details(self, obj):
+		self.repair_fields_list, count, percent =	self.repair_fields[obj.tname], {}, {}
+		# Check and Update Fields in Detail Table 
+		for d in getlist(obj.doclist, obj.fname):
+			for f in self.repair_fields_list:
+				qty, update_qty = d.fields.get(f,0), self.get_next_dt_detail_qty(self.next_dt_detail[f], d.name, obj.doc.doctype, f)
+
+				# Check qty
+				if flt(qty) != flt(update_qty):
+					msgprint('<div style="color: RED"> Difference found in %s (Before : %s; After : %s) in %s of %s : %s in Row No : %s </div>' % (f, qty, update_qty, obj.tname, obj.doc.doctype, obj.doc.name, d.name))
+					self.msg.append('<div style="color: RED"> Difference found in %s (Before : %s; After : %s) in %s of %s : %s in Row No : %s</div>' % (f, qty, update_qty, obj.tname, obj.doc.doctype, obj.doc.name, d.name))
+					# update qty
+					#sql("update `tab%s` set %s = '%s' where name = '%s'"% (obj.tname, f, update_qty, d.name))
+					set(d, f, update_qty)
+
+				# Calculate percentage
+				if flt(d.qty) - flt(update_qty) <= 0:
+					percent[f] = percent.get(f, 0) + 100
+				else:
+					percent[f] = percent.get(f, 0) + (flt(update_qty)/flt(d.qty) * 100)
+				count[f] = count.get(f,0) + 1
+
+		return count, percent
+
+	def repair_curr_percent_detail(self, obj, count, percent):
+		import math
+		for f in self.repair_fields_list:
+			per_complete, update_per_complete = flt(obj.doc.fields.get(self.repair_percent_field[f], 0)), math.floor(flt(percent[f]) / flt(count[f]))
+			if flt(obj.doc.fields.get(self.repair_percent_field[f], 0)) != flt(update_per_complete):
+				msgprint('<div style="color: RED">Difference found in %s (Before : %s; After : %s) in	%s : %s </div>' % (self.repair_percent_field[f], per_complete, update_per_complete, obj.doc.doctype, obj.doc.name))
+				self.msg.append('<div style="color: RED">Difference found in %s (Before : %s; After : %s) in	%s : %s </div>' % (self.repair_percent_field[f], per_complete, update_per_complete, obj.doc.doctype, obj.doc.name))
+				#sql("update `tab%s` set %s = '%s' where name = '%s'" % (obj.doc.doctype, self.repair_percent_field[f], update_per_complete, obj.doc.name))
+				set(obj.doc, self.repair_percent_field[f], update_per_complete)
+
+	def send_mail(self, obj):
+		email_msg = """ Dear Administrator,
+
+In Account := %s User := %s has Reposted %s : %s and following was found:-
+
+%s
+
+""" % (get_value('Control Panel', None,'account_id'), session['user'], obj.doc.doctype, obj.doc.name, '\n'.join(self.msg))
+
+		sendmail(['jai@webnotestech.com'], subject='Repair Option', parts = [('text/plain', email_msg)])
+
+	def repair_curr_doctype_details(self, obj):
+		count, percent = self.repair_curr_qty_details(obj)
+		self.repair_curr_percent_detail(obj, count, percent)
+		if self.msg: self.send_mail(obj)
+		msgprint('<div style="color: GREEN"> ' + cstr(obj.doc.doctype) + ' : ' + cstr(obj.doc.name) + ' has been checked' + cstr(self.msg and ' and repaired successfully.' or '. No changes Found.' + '</div>'))
diff --git a/srm/doctype/purchase_common/purchase_common.txt b/srm/doctype/purchase_common/purchase_common.txt
new file mode 100644
index 0000000..fa89213
--- /dev/null
+++ b/srm/doctype/purchase_common/purchase_common.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-18 17:29:02', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 229, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': '', 'name': 'Purchase Common', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-11-17 10:46:49', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/srm/doctype/purchase_order/__init__.py b/srm/doctype/purchase_order/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/purchase_order/__init__.py
diff --git a/srm/doctype/purchase_order/purchase_order.js b/srm/doctype/purchase_order/purchase_order.js
new file mode 100644
index 0000000..cbc0d3a
--- /dev/null
+++ b/srm/doctype/purchase_order/purchase_order.js
@@ -0,0 +1,246 @@
+cur_frm.cscript.tname = "PO Detail";
+cur_frm.cscript.fname = "po_details";
+cur_frm.cscript.other_fname = "purchase_tax_details";
+$import(Purchase Common)
+$import(Purchase Other Charges)
+$import(SMS Control)
+
+//========================== On Load =================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+
+  if(!doc.fiscal_year && doc.__islocal){ //set_default_values(doc);
+    doc.fiscal_year = sys_defaults.fiscal_year;
+  }
+  if(!doc.conversion_rate) doc.conversion_rate = 1;
+  if(!doc.currency) doc.currency = sys_defaults.currency;
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+  if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+    
+  if(doc.__islocal){ 
+    cur_frm.cscript.get_default_schedule_date(doc);
+  }
+  
+  if(doc.__islocal){
+    hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
+  }
+}
+
+// ================================== Refresh ==========================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
+
+  // Show buttons
+  // ---------------------------------
+  cur_frm.clear_custom_buttons();
+  if(doc.docstatus == 1 && doc.status != 'Stopped'){
+    var ch = getchildren('PO Detail',doc.name,'po_details');
+    var allow_billing = 0; var allow_receipt = 0;
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+
+    for(var i in ch){
+      if(ch[i].qty > ch[i].received_qty) allow_receipt = 1; 
+      if(ch[i].qty > ch[i].billed_qty) allow_billing = 1;
+    }
+    if(allow_receipt)
+      cur_frm.add_custom_button('Make Purchase Receipt', cur_frm.cscript['Make Purchase Receipt']);
+	    
+	if(allow_billing)
+      cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Purchase Invoice']);
+
+    if(allow_billing || allow_receipt)
+      cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']);
+  }
+    
+  if(doc.docstatus == 1 && doc.status == 'Stopped')
+    cur_frm.add_custom_button('Unstop Purchase Order', cur_frm.cscript['Unstop Purchase Order']);
+
+  if(doc.docstatus == 1) unhide_field(['Repair Purchase Order']);
+  else hide_field(['Repair Purchase Order']);
+}
+
+
+
+//Supplier
+cur_frm.cscript.supplier = function(doc,dt,dn) {
+  if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
+  if(doc.supplier) unhide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
+}
+
+cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {    
+  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'].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';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  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';
+}
+
+
+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;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+  locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
+  locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
+}
+
+
+
+
+
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+  tn = createLocal('Contact');
+  locals['Contact'][tn].is_supplier = 1;
+  if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier;
+  loaddoc('Contact', tn);
+}
+
+//======================= transaction date =============================
+cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
+  if(doc.__islocal){ 
+    cur_frm.cscript.get_default_schedule_date(doc);
+  }
+}
+
+
+// ---------------------- Get project name --------------------------
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+
+//==================== Indent No Get Query =======================================================
+//===== Only those Indents status != 'Completed' and docstatus = 1 i.e. submitted=================
+cur_frm.fields_dict['indent_no'].get_query = function(doc) {
+  return 'SELECT DISTINCT `tabIndent`.`name` FROM `tabIndent` WHERE `tabIndent`.company = "' + doc.company + '" and `tabIndent`.`docstatus` = 1 and `tabIndent`.`status` != "Stopped" and ifnull(`tabIndent`.`per_ordered`,0) < 100 and `tabIndent`.%(key)s LIKE "%s" ORDER BY `tabIndent`.`name` DESC LIMIT 50';
+}
+
+/*
+//*********** get approved supplier quotation ********************
+cur_frm.fields_dict['supplier_qtn'].get_query = function(doc) {
+  var cond='';
+  if(doc.supplier) cond = 'ifnull(`tabSupplier Quotation`.supplier, "") = "'+doc.supplier+'" and';
+  
+  return repl('SELECT DISTINCT `tabSupplier Quotation`.`name` FROM `tabSupplier Quotation` WHERE `tabSupplier Quotation`.company = "%(company)s" and`tabSupplier Quotation`.`docstatus` = 1 and `tabSupplier Quotation`.`approval_status` = "Approved" and %(cond)s `tabSupplier Quotation`.%(key)s LIKE "%s" ORDER BY `tabSupplier Quotation`.`name` DESC LIMIT 50', {company:doc.company,cond:cond});
+}
+*/
+
+
+//========================= Get Last Purhase Rate =====================================
+cur_frm.cscript['Get Last Purchase Rate'] = function(doc, cdt, cdn){
+  $c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', 
+      function(r, rt) { 
+        refresh_field(cur_frm.cscript.fname);
+        var doc = locals[cdt][cdn];
+        cur_frm.cscript.calc_amount( doc, 2);
+      }
+  );
+
+}
+
+//========================= Make Purchase Receipt =======================================================
+cur_frm.cscript['Make Purchase Receipt'] = function() {
+  n = createLocal('Purchase Receipt');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Purchase Receipt'][n]]),
+    'from_doctype': cur_frm.doc.doctype,
+    'to_doctype':'Purchase Receipt',
+    'from_docname':cur_frm.doc.name,
+    'from_to_list':"[['Purchase Order','Purchase Receipt'],['PO Detail','Purchase Receipt Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
+    }, function(r,rt) {
+       loaddoc('Purchase Receipt', n);
+    }
+  );
+}
+
+//========================== Make Purchase Invoice =====================================================
+cur_frm.cscript['Make Purchase Invoice'] = function() {
+  n = createLocal('Payable Voucher');
+  $c('dt_map', args={
+    'docs':compress_doclist([locals['Payable Voucher'][n]]),
+    'from_doctype':cur_frm.doc.doctype,
+    'to_doctype':'Payable Voucher',
+    'from_docname': cur_frm.doc.name,
+    'from_to_list':"[['Purchase Order','Payable Voucher'],['PO Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
+    }, function(r,rt) {
+       loaddoc('Payable Voucher', n);
+    }
+  );
+}
+
+
+// Stop PURCHASE ORDER
+// ==================================================================================================
+cur_frm.cscript['Stop Purchase Order'] = function() {
+  var doc = cur_frm.doc;
+  var check = confirm("Do you really want to STOP " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+  }
+}
+
+// Unstop PURCHASE ORDER
+// ==================================================================================================
+cur_frm.cscript['Unstop Purchase Order'] = function() {
+  var doc = cur_frm.doc;
+  var check = confirm("Do you really want to UNSTOP " + doc.name);
+
+  if (check) {
+    $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+      cur_frm.refresh();
+    });	
+  }
+}
+
+// ***************** Get Print Heading  *****************
+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';
+}
+//****************** For print sales order no and date*************************
+cur_frm.pformat.indent_no = function(doc, cdt, cdn){
+  //function to make row of table
+  
+  var make_row = function(title,val1, val2, bold){
+    var bstart = '<b>'; var bend = '</b>';
+
+    return '<tr><td style="width:39%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+     +'<td style="width:61%;text-align:left;">'+val1+(val2?' ('+dateutil.str_to_user(val2)+')':'')+'</td>'
+     +'</tr>'
+  }
+
+  out ='';
+  
+  var cl = getchildren('PO Detail',doc.name,'po_details');
+
+  // outer table  
+  var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
+  
+  // main table
+  out +='<table class="noborder" style="width:100%">';
+
+  // add rows
+  if(cl.length){
+    prevdoc_list = new Array();
+    for(var i=0;i<cl.length;i++){
+      if(cl[i].prevdoc_doctype == 'Indent' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
+        prevdoc_list.push(cl[i].prevdoc_docname);
+        if(prevdoc_list.length ==1)
+          out += make_row(cl[i].prevdoc_doctype, cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
+        else
+          out += make_row('', cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
+      }
+    }
+  }
+
+  out +='</table></td></tr></table></div>';
+
+  return out;
+}
diff --git a/srm/doctype/purchase_order/purchase_order.py b/srm/doctype/purchase_order/purchase_order.py
new file mode 100644
index 0000000..7c02e65
--- /dev/null
+++ b/srm/doctype/purchase_order/purchase_order.py
@@ -0,0 +1,350 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.defaults = get_defaults()
+    self.tname = 'PO Detail'
+    self.fname = 'po_details'
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+  def get_default_schedule_date(self):
+    get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
+    
+  def validate_fiscal_year(self):
+    get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
+
+
+  # Client Trigger Functions
+  #----------------------------------------------------------------------------------------------------
+  # Get Supplier Details 
+  #def get_supplier_details(self, name = ''):
+    #return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
+
+  # Get Item Details
+  def get_item_details(self, arg =''):
+    return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg))
+
+  # Get UOM Details
+  def get_uom_details(self, arg = ''):
+    return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
+
+  # get available qty at warehouse
+  def get_bin_details(self, arg = ''):
+    return cstr(get_obj(dt='Purchase Common').get_bin_details(arg))
+
+  # Pull Indent
+  def get_indent_details(self):
+    #self.validate_prev_docname() 
+    if self.doc.indent_no:
+      get_obj('DocType Mapper','Indent-Purchase Order').dt_map('Indent','Purchase Order',self.doc.indent_no, self.doc, self.doclist, "[['Indent','Purchase Order'],['Indent Detail', 'PO Detail']]")
+      for d in getlist(self.doclist, 'po_details'):			
+        if d.item_code:
+          item = sql("select last_purchase_rate from tabItem where name = '%s'" %(d.item_code), as_dict=1)
+          d.purchase_rate = item and flt(item[0]['last_purchase_rate']) or 0
+          d.import_rate = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(self.doc.fields.has_key('conversion_rate') and flt(self.doc.conversion_rate) or 1)
+    if self.doc.supplier_qtn:
+      get_obj('DocType Mapper','Supplier Quotation-Purchase Order').dt_map('Supplier Quotation','Purchase Order',self.doc.supplier_qtn, self.doc, self.doclist, "[['Supplier Quotation','Purchase Order'],['Supplier Quotation Detail', 'PO Detail']]")
+  
+  # GET TERMS & CONDITIONS
+  # =====================================================================================
+  def get_tc_details(self):
+    return get_obj('Purchase Common').get_tc_details(self)
+
+  # validate if indent has been pulled twice
+  def validate_prev_docname(self):
+    for d in getlist(self.doclist, 'po_details'): 
+      if d.prevdoc_docname and self.doc.indent_no == d.prevdoc_docname:
+        msgprint(cstr(self.doc.indent_no) + " indent details have already been pulled. ")
+        raise Exception
+
+  # get last purchase rate
+  def get_last_purchase_rate(self):
+    get_obj('Purchase Common').get_last_purchase_rate(self)
+    
+  # validation
+  #-------------------------------------------------------------------------------------------------------------
+  def validate_doc(self,pc_obj):
+    # Please Check Supplier Quotation - Purchase ORder Transaction , it has to be discussed
+    if self.doc.supp_quo_no:
+      pc_obj.validate_doc(obj = self, prevdoc_doctype = 'Supplier Quotation', prevdoc_docname = cstr(self.doc.supp_quo_no))
+    else:
+      # Validate values with reference document
+      pc_obj.validate_reference_value(obj = self)
+
+  # Check for Stopped status 
+  def check_for_stopped_status(self, pc_obj):
+    check_list =[]
+    for d in getlist(self.doclist, 'po_details'):
+      if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
+        check_list.append(d.prevdoc_docname)
+        pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
+
+    
+  # Validate
+  def validate(self):
+    self.validate_fiscal_year()
+    # Step 1:=> set status as "Draft"
+    set(self.doc, 'status', 'Draft')
+    
+    # Step 2:=> get Purchase Common Obj
+    pc_obj = get_obj(dt='Purchase Common')
+    
+    # Step 3:=> validate mandatory
+    pc_obj.validate_mandatory(self)
+
+    # Step 4:=> validate for items
+    pc_obj.validate_for_items(self)
+
+    # Step 5:=> validate conversion rate
+    pc_obj.validate_conversion_rate(self)
+    
+    # Get po date
+    pc_obj.get_prevdoc_date(self)
+    
+    # validate_doc
+    self.validate_doc(pc_obj)
+    
+    # Check for stopped status
+    self.check_for_stopped_status(pc_obj)
+    
+      
+     # get total in words
+    self.doc.in_words = pc_obj.get_total_in_words(get_defaults().get('currency') and get_defaults()['currency'] or 'INR', self.doc.grand_total)
+    self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
+  
+  # update bin
+  # ----------
+  def update_bin(self, is_submit, is_stopped = 0):
+    pc_obj = get_obj('Purchase Common')
+    for d in getlist(self.doclist, 'po_details'):
+      #1. Check if is_stock_item == 'Yes'
+      if sql("select is_stock_item from tabItem where name=%s", d.item_code)[0][0]=='Yes':
+        
+        ind_qty, po_qty = 0, flt(d.qty) * flt(d.conversion_factor)
+        if is_stopped:
+          po_qty = flt(d.qty) > flt(d.received_qty) and flt( flt(flt(d.qty) - flt(d.received_qty)) * flt(d.conversion_factor))or 0 
+        
+        # No updates in Indent on Stop / Unstop
+        if cstr(d.prevdoc_doctype) == 'Indent' and not is_stopped:
+          # get qty and pending_qty of prevdoc 
+          curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Indent Detail', 'Indent - Purchase Order', self.doc.name)
+          max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[0]), 0
+          
+          if flt(qty) + flt(po_qty) > flt(max_qty):
+            curr_qty = flt(max_qty) - flt(qty)
+            # special case as there is no restriction for Indent - Purchase Order 
+            curr_qty = (curr_qty > 0) and curr_qty or 0
+          else:
+            curr_qty = flt(po_qty)
+          
+          ind_qty = -flt(curr_qty)
+
+        #==> Update Bin's Indent Qty by +- ind_qty and Ordered Qty by +- qty
+        get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(po_qty), (is_submit and 1 or -1) * flt(ind_qty), 0, d.item_code, self.doc.transaction_date)
+
+  def check_modified_date(self):
+    mod_db = sql("select modified from `tabPurchase Order` where name = '%s'" % self.doc.name)
+    date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
+    
+    if date_diff and date_diff[0][0]:
+      msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
+      raise Exception
+
+  # On Close
+  #-------------------------------------------------------------------------------------------------
+  def update_status(self, status):
+    self.check_modified_date()
+    # step 1:=> Set Status
+    set(self.doc,'status',cstr(status))
+
+    # step 2:=> Update Bin
+    self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
+
+    # step 3:=> Acknowledge user
+    msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)))
+
+
+  # On Submit
+  def on_submit(self):
+    pc_obj = get_obj(dt ='Purchase Common')
+    
+    # Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly
+    pc_obj.update_prevdoc_detail(self, is_submit = 1)
+
+    # Step 2 :=> Update Bin 
+    self.update_bin(is_submit = 1, is_stopped = 0)
+    
+    # Step 3 :=> Check For Approval Authority
+    get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
+    
+    # Step 4 :=> Update Current PO No. in Supplier as last_purchase_order.
+    update_supplier = sql("update `tabSupplier` set last_purchase_order = '%s' where name = '%s'" % (self.doc.name, self.doc.supplier))
+
+    # Step 5 :=> Update last purchase rate
+    pc_obj.update_last_purchase_rate(self, is_submit = 1)
+
+    # Step 6 :=> Set Status
+    set(self.doc,'status','Submitted')
+    
+    self.doc.indent_no = '';
+  
+    # on submit notification
+    get_obj('Notification Control').notify_contact('Purchase Order', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
+   
+  # On Cancel
+  # -------------------------------------------------------------------------------------------------------
+  def on_cancel(self):
+    pc_obj = get_obj(dt = 'Purchase Common')
+    
+    # 1.Check if PO status is stopped
+    pc_obj.check_for_stopped_status(cstr(self.doc.doctype), cstr(self.doc.name))
+    
+    self.check_for_stopped_status(pc_obj)
+    
+    # 2.Check if Purchase Receipt has been submitted against current Purchase Order
+    pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Receipt', docname = self.doc.name, detail_doctype = 'Purchase Receipt Detail')
+
+    # 3.Check if Payable Voucher has been submitted against current Purchase Order
+    #pc_obj.check_docstatus(check = 'Next', doctype = 'Payable Voucher', docname = self.doc.name, detail_doctype = 'PV Detail')
+    
+    submitted = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_order = '%s' and t1.docstatus = 1" % self.doc.name)
+    if submitted:
+      msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
+      raise Exception
+
+    # 4.Set Status as Cancelled
+    set(self.doc,'status','Cancelled')
+
+    # 5.Update Indents Pending Qty and accordingly it's Status 
+    pc_obj.update_prevdoc_detail(self,is_submit = 0)
+    
+    # 6.Update Bin  
+    self.update_bin( is_submit = 0, is_stopped = 0)
+    
+    # Step 7 :=> Update last purchase rate 
+    pc_obj.update_last_purchase_rate(self, is_submit = 0)
+    
+#----------- code for Sub-contracted Items -------------------
+  #--------check for sub-contracted items and accordingly update PO raw material detail table--------
+  def update_rw_material_detail(self):
+    for d in getlist(self.doclist,'po_details'):
+      item_det = sql("select is_sub_contracted_item, is_purchase_item from `tabItem` where name = '%s'"%(d.item_code))
+      
+      if item_det[0][0] == 'Yes':
+        if item_det[0][1] == 'Yes':
+          if not self.doc.is_subcontracted:
+            msgprint("Please enter whether purchase order to be made for subcontracting or for purchasing in 'Is Subcontracted' field .")
+            raise Exception
+          if self.doc.is_subcontracted == 'Yes':
+            self.add_bom(d)
+          else:
+            self.doc.clear_table(self.doclist,'po_raw_material_details',1)
+            self.doc.save()
+        elif item_det[0][1] == 'No':
+          self.add_bom(d)
+        
+      self.delete_irrelevant_raw_material()
+      #---------------calculate amt in  PO Raw Material Detail-------------
+      self.calculate_amount(d)
+      
+  def add_bom(self, d):
+    #----- fetching default bom from Bill of Materials instead of Item Master --
+    bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.parent from `tabBill Of Materials` t1, `tabBOM Material` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1" % d.item_code)
+    
+    if not bom_det:
+      msgprint("No default BOM exists for item: %s" % d.item_code)
+      raise Exception
+    else:
+      #-------------- add child function--------------------
+      chgd_rqd_qty = []
+      for i in bom_det:
+        if i and not sql("select name from `tabPO Raw Material Detail` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
+
+          rm_child = addchild(self.doc, 'po_raw_material_details', 'PO Raw Material Detail', 1, self.doclist)
+
+          rm_child.reference_name = d.name
+          rm_child.bom_detail_no = i and i[6] or ''
+          rm_child.main_item_code = i and i[0] or ''
+          rm_child.rm_item_code = i and i[1] or ''
+          rm_child.stock_uom = i and i[5] or ''
+          rm_child.rate = i and flt(i[3]) or flt(i[4])
+          rm_child.conversion_factor = d.conversion_factor
+          rm_child.required_qty = flt(i  and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
+          rm_child.amount = flt(flt(rm_child.consumed_qty)*flt(rm_child.rate))
+          rm_child.save()
+          chgd_rqd_qty.append(cstr(i[1]))
+        else:
+          act_qty = flt(i  and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
+          for po_rmd in getlist(self.doclist, 'po_raw_material_details'):
+            if i and i[6] == po_rmd.bom_detail_no and (flt(act_qty) != flt(po_rmd.required_qty) or i[1] != po_rmd.rm_item_code):
+              chgd_rqd_qty.append(cstr(i[1]))
+              po_rmd.main_item_code = i[0]
+              po_rmd.rm_item_code = i[1]
+              po_rmd.stock_uom = i[5]
+              po_rmd.required_qty = flt(act_qty)
+              po_rmd.rate = i and flt(i[3]) or flt(i[4])
+              po_rmd.amount = flt(flt(po_rmd.consumed_qty)*flt(po_rmd.rate))
+              
+
+  # Delete irrelevant raw material from PR Raw material details
+  #--------------------------------------------------------------  
+  def delete_irrelevant_raw_material(self):
+    for d in getlist(self.doclist,'po_raw_material_details'):
+      if not sql("select name from `tabPO Detail` where name = '%s' and parent = '%s'and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
+        d.parent = 'old_par:'+self.doc.name
+        d.save()
+    
+  def calculate_amount(self, d):
+    amt = 0
+    for i in getlist(self.doclist,'po_raw_material_details'):
+      
+      if(i.reference_name == d.name):
+        i.amount = flt(i.required_qty)* flt(i.rate)
+        amt += i.amount
+    d.rm_supp_cost = amt
+
+  # On Update
+  # ----------------------------------------------------------------------------------------------------    
+  def on_update(self):
+    self.update_rw_material_detail()
+    
+
+# OTHER CHARGES TRIGGER FUNCTIONS
+# ====================================================================================
+  
+  # *********** Get Tax rate if account type is TAX ********************
+  def get_rate(self,arg):
+    return get_obj('Purchase Common').get_rate(arg,self)
+
+  # **** Pull details from other charges master (Get Other Charges) ****
+  def get_purchase_tax_details(self):
+    return get_obj('Purchase Common').get_purchase_tax_details(self)
+
+  # Repair Purchase Order
+  # ===========================================
+  def repair_purchase_order(self):
+    get_obj('Purchase Common', 'Purchase Common').repair_curr_doctype_details(self)
diff --git a/srm/doctype/purchase_order/purchase_order.txt b/srm/doctype/purchase_order/purchase_order.txt
new file mode 100644
index 0000000..daa70ed
--- /dev/null
+++ b/srm/doctype/purchase_order/purchase_order.txt
@@ -0,0 +1,2822 @@
+[
+	{
+		'_last_update': '1305629955',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Transaction',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': 1,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-17 16:29:14',
+		'modified_by': 'Guest',
+		'module': 'SRM',
+		'name': 'Purchase Order',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': 1,
+		'search_fields': 'status, transaction_date, supplier,grand_total',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': 'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 494
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-02-17 15:11:03',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00855',
+		'owner': 'umair@iwebnotes.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Production Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00411',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00412',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00413',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00414',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': 1,
+		'cancel': 0,
+		'create': 1,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 6,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00415',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 7,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00416',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'All',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 8,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00417',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Supplier',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:15',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 9,
+		'match': None,
+		'modified': '2011-05-11 17:19:19',
+		'modified_by': 'ravi@iwebnotes.com',
+		'name': 'PERM00418',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 2,
+		'read': 1,
+		'role': 'All',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter rates and quantity of items you want to purchase and send the purchase order to your supplier.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05241',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05242',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'To manage multiple series please go to Setup > Manage Series',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02372',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': '\nPO',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'Supplier (vendor) name as entered in supplier master',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Supplier',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02374',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier',
+		'oldfieldtype': 'Link',
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_address',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Supplier Address',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02375',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_person',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Contact Person',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02376',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-09-01 15:48:08',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Name',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL03864',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Address',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL05231',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_display',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Contact',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL05232',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_mobile',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL05233',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:58',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'contact_email',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Email',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL05234',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05243',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is made in system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'transaction_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Purchase Order Date',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02380',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'transaction_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Status',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02373',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'status',
+		'oldfieldtype': 'Select',
+		'options': '\nDraft\nSubmitted\nStopped\nCancelled',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:48:08',
+		'default': None,
+		'depends_on': None,
+		'description': 'Track this Purchase Order against any Project',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Project Name',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL03865',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'project_name',
+		'oldfieldtype': 'Link',
+		'options': 'Project',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': '% of materials received against this Purchase Order',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_received',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': '% Received',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02378',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'per_received',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': '% of materials billed against this Purchase Order.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'per_billed',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': '% Billed',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02379',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'per_billed',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Items',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05244',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'You can make a purchase order from multiple indents. Select indents one by one and click on the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'indent_no',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Select Indent',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02384',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'indent_no',
+		'oldfieldtype': 'Link',
+		'options': 'Indent',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Get Items',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02385',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_indent_details',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-29 15:27:12',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_subcontracted',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Is Subcontracted',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': '000002136',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nYes\nNo',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 22,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05245',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': "Supplier's currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'currency',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 23,
+		'in_filter': None,
+		'label': 'Currency',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02381',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'currency',
+		'oldfieldtype': 'Select',
+		'options': 'link:Currency',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': '1',
+		'depends_on': None,
+		'description': "Rate at which supplier's currency is converted to your currency",
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'conversion_rate',
+		'fieldtype': 'Currency',
+		'hidden': 0,
+		'icon': None,
+		'idx': 24,
+		'in_filter': None,
+		'label': 'Conversion Rate',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02382',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'conversion_rate',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 25,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05246',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 26,
+		'in_filter': None,
+		'label': 'PO Details',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02386',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'po_details',
+		'oldfieldtype': 'Table',
+		'options': 'PO Detail',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 27,
+		'in_filter': None,
+		'label': 'Get Last Purchase Rate',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02387',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 28,
+		'in_filter': None,
+		'label': 'Net Total*',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02425',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'net_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 29,
+		'in_filter': None,
+		'label': 'Re-Calculate Values',
+		'modified': '2011-05-25 12:44:58',
+		'modified_by': 'Guest',
+		'name': 'FL02395',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 30,
+		'in_filter': None,
+		'label': 'Note HTML',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05247',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 31,
+		'in_filter': None,
+		'label': 'Taxes',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05248',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'If you have created a standard template in Other Charges master, select one and click on the button below.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_other_charges',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 32,
+		'in_filter': None,
+		'label': 'Purchase Other Charges',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02397',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'purchase_other_charges',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Other Charges',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 33,
+		'in_filter': None,
+		'label': 'Get Tax Detail',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02398',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_purchase_tax_details',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_tax_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 34,
+		'in_filter': None,
+		'label': 'Purchase Tax Details',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02399',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'purchase_tax_details',
+		'oldfieldtype': 'Table',
+		'options': 'Purchase Tax Detail',
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 35,
+		'in_filter': None,
+		'label': 'Calculate Tax',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02400',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 36,
+		'in_filter': None,
+		'label': 'Tax Calculation',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05249',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'total_tax',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 37,
+		'in_filter': None,
+		'label': 'Total Tax*',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02402',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'total_tax',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 38,
+		'in_filter': None,
+		'label': 'Note HTML',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05250',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 39,
+		'in_filter': None,
+		'label': 'Totals',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05251',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 40,
+		'in_filter': None,
+		'label': 'Grand Total',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02426',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'grand_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 41,
+		'in_filter': None,
+		'label': 'Rounded Total',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02390',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'rounded_total',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words will be visible once you save the Purchase Order.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 42,
+		'in_filter': None,
+		'label': 'In Words',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02391',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_added',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 43,
+		'in_filter': None,
+		'label': 'Other Charges Added',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02422',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'other_charges_added',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_deducted',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 44,
+		'in_filter': None,
+		'label': 'Other Charges Deducted',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02423',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'other_charges_deducted',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 45,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05252',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'net_total_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 46,
+		'in_filter': None,
+		'label': 'Net Total (Import)',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02388',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'net_total_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'grand_total_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 47,
+		'in_filter': None,
+		'label': 'Grand Total (Import)',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02389',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'grand_total_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'In Words(Import) will be visible once you save the Purchase Order.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'in_words_import',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 48,
+		'in_filter': None,
+		'label': 'In Words(Import)',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02392',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'in_words_import',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_added_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 49,
+		'in_filter': None,
+		'label': 'Other Charges Added (Import)',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02393',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'other_charges_added_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'other_charges_deducted_import',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 50,
+		'in_filter': None,
+		'label': 'Other Charges Deducted (Import)',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02394',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'other_charges_deducted_import',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'wasim@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 51,
+		'in_filter': None,
+		'label': 'Terms',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05253',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-12-14 10:23:18',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 52,
+		'in_filter': None,
+		'label': 'Letter Head',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL04216',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'letter_head',
+		'oldfieldtype': 'Select',
+		'options': 'link:Letter Head',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tc_name',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 53,
+		'in_filter': None,
+		'label': 'Select Terms',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02404',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'tc_name',
+		'oldfieldtype': 'Link',
+		'options': 'Term',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 54,
+		'in_filter': None,
+		'label': 'Get Terms',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02405',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_tc_details',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 55,
+		'in_filter': None,
+		'label': 'Terms HTML',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05254',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': 'You can add Terms and Notes that will be printed in the Transaction',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'terms',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 56,
+		'in_filter': None,
+		'label': 'Terms1',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02407',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'terms',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 57,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05255',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'ref_sq',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 58,
+		'in_filter': None,
+		'label': 'Ref SQ',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02409',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'ref_sq',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 59,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02410',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'The date at which current entry is corrected in the system.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'icon': None,
+		'idx': 60,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02411',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': 'Select the relevant company name if you have multiple companies',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 61,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02412',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 62,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02413',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Select',
+		'options': 'link:Fiscal Year',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'select_print_heading',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 63,
+		'in_filter': None,
+		'label': 'Select Print Heading',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02414',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'select_print_heading',
+		'oldfieldtype': 'Link',
+		'options': 'Print Heading',
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'instructions',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 64,
+		'in_filter': None,
+		'label': 'Instructions',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02415',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'instructions',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'sneha@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 65,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05256',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'payment_terms',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 66,
+		'in_filter': None,
+		'label': 'Payment Terms',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02417',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'payment_terms',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 67,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02418',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'cancel_reason',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'icon': None,
+		'idx': 68,
+		'in_filter': None,
+		'label': 'Cancel Reason',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02419',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'cancel_reason',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:44:59',
+		'default': None,
+		'depends_on': None,
+		'description': 'Required raw materials issued to the supplier for producing a sub - contracted item.',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 69,
+		'in_filter': None,
+		'label': 'Raw Material Details',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL05257',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'po_raw_material_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 70,
+		'in_filter': None,
+		'label': 'PO Raw Material Details',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02428',
+		'no_column': None,
+		'no_copy': 0,
+		'oldfieldname': 'po_raw_material_details',
+		'oldfieldtype': 'Table',
+		'options': 'PO Raw Material Detail',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': 1,
+		'colour': None,
+		'creation': '2010-08-08 17:09:15',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 71,
+		'in_filter': None,
+		'label': 'Repair Purchase Order',
+		'modified': '2011-05-25 12:44:59',
+		'modified_by': 'Guest',
+		'name': 'FL02438',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'repair_purchase_order',
+		'owner': 'jai@webnotestech.com',
+		'parent': 'Purchase Order',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/srm/doctype/purchase_other_charges/__init__.py b/srm/doctype/purchase_other_charges/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/purchase_other_charges/__init__.py
diff --git a/srm/doctype/purchase_other_charges/purchase_other_charges.js b/srm/doctype/purchase_other_charges/purchase_other_charges.js
new file mode 100644
index 0000000..dcf00ab
--- /dev/null
+++ b/srm/doctype/purchase_other_charges/purchase_other_charges.js
@@ -0,0 +1,160 @@
+//$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.pformat.purchase_tax_details= function(doc){
+ 
+  //function to make row of table
+  var make_row = function(title,val,bold){
+    var bstart = '<b>'; var bend = '</b>';
+    return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+     +'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
+     +'<td style="width:25%;text-align:right;">'+val+'</td>'
+     +'</tr>'
+  }
+
+  function convert_rate(val){
+    var new_val = flt(val)/flt(doc.conversion_rate);
+    return new_val;
+  }
+
+  var cl = getchildren('Purchase Tax Detail',doc.name,'purchase_tax_details');
+
+  // outer table  
+  var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
+  
+  // main table
+  out +='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
+
+  // add rows
+  if(cl.length){
+    for(var i=0;i<cl.length;i++){
+      out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
+    }
+  }
+  
+  // grand total
+  out +=make_row('Grand Total',fmt_money(doc.grand_total_import),1)
+  if(doc.in_words_import){
+    out +='</table></td></tr>';
+    out += '<tr><td colspan = "2">';
+    out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
+    out+= '<td style="width:50%;">'+doc.in_words_import+'</td></tr>';
+  }
+  out +='</table></td></tr></table></div>';   
+  return out;
+}
+
+cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.category && d.add_deduct_tax){
+    alert("Please select Category first");
+    d.add_deduct_tax = '';
+  }
+  else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){
+    alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)");
+    d.add_deduct_tax = '';
+  }
+
+}
+
+cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.category && d.charge_type){
+    alert("Please select Category first");
+    d.charge_type = '';
+  }  
+  else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
+    alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
+    d.charge_type = '';
+  }
+  else if((d.category == 'For Valuation' || d.category == 'For Both') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
+    alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'For Total' option for previous row amount or previous row total")
+    d.charge_type = '';
+  }
+  validated = false;
+  refresh_field('charge_type',d.name,'purchase_tax_details');
+
+  cur_frm.cscript.row_id(doc, cdt, cdn);
+  cur_frm.cscript.rate(doc, cdt, cdn);
+  cur_frm.cscript.tax_amount(doc, cdt, cdn);
+}
+
+
+cur_frm.cscript.row_id = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.row_id){
+    alert("Please select Charge Type first");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
+    alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
+    if(d.row_id >= d.idx){
+      alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
+      d.row_id = '';
+    }
+  }
+  validated = false;
+  refresh_field('row_id',d.name,'purchase_tax_details');
+}
+
+/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
+
+cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND  tabAccount.name LIKE "%s"'
+}
+
+//--------------------filter other charges master company-wise-----------------------------------------
+/*
+cur_frm.fields_dict.charge.get_query = function(doc) {
+  return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus !=2 AND `tabOther Charges`.name LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
+}
+*/
+
+cur_frm.cscript.account_head = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.account_head){
+    alert("Please select Charge Type first");
+    validated = false;
+    d.account_head = '';
+  }
+  else if(d.account_head && d.charge_type) {
+    arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
+    get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
+  }
+  refresh_field('account_head',d.name,'purchase_tax_details');
+}
+
+cur_frm.cscript.rate = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.rate) {
+    alert("Please select Charge Type first");
+    d.rate = '';
+  }
+  validated = false;
+  refresh_field('rate',d.name,'purchase_tax_details');
+}
+
+cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.tax_amount){
+    alert("Please select Charge Type first");
+    d.tax_amount = '';
+  }
+  else if(d.charge_type && d.tax_amount) {
+    alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
+    d.tax_amount = '';
+  }
+  validated = false;
+  refresh_field('tax_amount',d.name,'purchase_tax_details');
+}
diff --git a/srm/doctype/purchase_other_charges/purchase_other_charges.py b/srm/doctype/purchase_other_charges/purchase_other_charges.py
new file mode 100644
index 0000000..6cda4d0
--- /dev/null
+++ b/srm/doctype/purchase_other_charges/purchase_other_charges.py
@@ -0,0 +1,28 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Get Tax Rate if account type is Tax
+  # ===================================================================
+  def get_rate(self, arg):
+    return get_obj('Purchase Common').get_rate(arg, self)
\ No newline at end of file
diff --git a/srm/doctype/purchase_other_charges/purchase_other_charges.txt b/srm/doctype/purchase_other_charges/purchase_other_charges.txt
new file mode 100644
index 0000000..02b5285
--- /dev/null
+++ b/srm/doctype/purchase_other_charges/purchase_other_charges.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-28 16:49:17', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'wasim@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 22, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'field:title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': 'Master', 'name': 'Purchase Other Charges', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 17:30:25', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00655', 'parent': 'Purchase Other Charges', 'read': 1, 'create': None, 'creation': '2010-01-28 16:49:17', 'modified': '2010-09-20 17:30:25', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00656', 'parent': 'Purchase Other Charges', 'read': 1, 'create': 0, 'creation': '2010-01-28 16:49:17', 'modified': '2010-09-20 17:30:25', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00657', 'parent': 'Purchase Other Charges', 'read': 1, 'create': 1, 'creation': '2010-01-28 16:49:17', 'modified': '2010-09-20 17:30:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'wasim@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00987', 'parent': 'Purchase Other Charges', 'read': 1, 'create': 1, 'creation': '2010-04-30 09:46:00', 'modified': '2010-09-20 17:30:25', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-28 16:49:17', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'wasim@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Other Charges', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL03891', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 17:30:25', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2010-01-28 16:49:17', 'doctype': 'DocField', 'oldfieldname': 'purchase_tax_details', 'owner': 'wasim@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Purchase Tax Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Purchase Other Charges', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03892', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 17:30:25', 'parenttype': 'DocType', 'fieldname': 'purchase_tax_details', 'fieldtype': 'Table', 'options': 'Purchase Tax Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/qa_inspection_report/__init__.py b/srm/doctype/qa_inspection_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/qa_inspection_report/__init__.py
diff --git a/srm/doctype/qa_inspection_report/qa_inspection_report.js b/srm/doctype/qa_inspection_report/qa_inspection_report.js
new file mode 100644
index 0000000..67281ee
--- /dev/null
+++ b/srm/doctype/qa_inspection_report/qa_inspection_report.js
@@ -0,0 +1,26 @@
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+  if (doc.item_code)
+    get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
+  if(doc.inspection_type == 'Incoming'){
+    doc.delivery_note_no = '';
+    hide_field('delivery_note_no');    
+    unhide_field('purchase_receipt_no');
+  }
+  else if(doc.inspection_type == 'Outgoing'){
+    doc.purchase_receipt_no = '';
+    unhide_field('delivery_note_no');
+    hide_field('purchase_receipt_no');
+
+  }
+  else {
+    doc.purchase_receipt_no = '';
+    doc.delivery_note_no = '';    
+    hide_field('purchase_receipt_no');
+    hide_field('delivery_note_no');
+  }
+}
+
+cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
\ No newline at end of file
diff --git a/srm/doctype/qa_inspection_report/qa_inspection_report.py b/srm/doctype/qa_inspection_report/qa_inspection_report.py
new file mode 100644
index 0000000..58ad248
--- /dev/null
+++ b/srm/doctype/qa_inspection_report/qa_inspection_report.py
@@ -0,0 +1,47 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+
+  def get_item_specification_details(self):
+    self.doc.clear_table(self.doclist, 'qa_specification_details')
+    specification = sql("select specification, value from `tabItem Specification Detail` where parent = '%s' order by idx" % (self.doc.item_code))
+    for d in specification:
+      child = addchild(self.doc, 'qa_specification_details', 'QA Specification Detail', 1, self.doclist)
+      child.specification = d[0]
+      child.value = d[1]
+      child.status = 'Accepted'
+
+  def on_submit(self):
+    if self.doc.purchase_receipt_no:
+      sql("update `tabPurchase Receipt Detail` set qa_no = '%s' where parent = '%s' and item_code = '%s'" % (self.doc.name, self.doc.purchase_receipt_no, self.doc.item_code))
+
+
+  def on_cancel(self):
+    if self.doc.purchase_receipt_no:
+      sql("update `tabPurchase Receipt Detail` set qa_no = '' where parent = '%s' and item_code = '%s'" % (self.doc.purchase_receipt_no, self.doc.item_code))
diff --git a/srm/doctype/qa_inspection_report/qa_inspection_report.txt b/srm/doctype/qa_inspection_report/qa_inspection_report.txt
new file mode 100644
index 0000000..2d01a9e
--- /dev/null
+++ b/srm/doctype/qa_inspection_report/qa_inspection_report.txt
@@ -0,0 +1,837 @@
+[
+	{
+		'_last_update': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': 'QAI/.######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-08 10:53:33',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'QA Inspection Report',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': 'Yes',
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'item_code, report_date, purchase_receipt_no, delivery_note_no',
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 37
+	},
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00431',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Quality Manager',
+		'submit': 1,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00432',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Quality Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'QA Inspection',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000407',
+		'no_copy': 0,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000408',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Naming Series',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000405',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '\nQAI/11-12/',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'inspection_type',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Inspection Type',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02590',
+		'no_copy': None,
+		'oldfieldname': 'inspection_type',
+		'oldfieldtype': 'Select',
+		'options': '\nIncoming\nOutgoing\nIn Process',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'report_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Report Date',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02591',
+		'no_copy': None,
+		'oldfieldname': 'report_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_code',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Item Code',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02592',
+		'no_copy': None,
+		'oldfieldname': 'item_code',
+		'oldfieldtype': 'Link',
+		'options': 'Item',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sample_size',
+		'fieldtype': 'Currency',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 0,
+		'label': 'Sample Size',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02593',
+		'no_copy': None,
+		'oldfieldname': 'sample_size',
+		'oldfieldtype': 'Currency',
+		'options': None,
+		'owner': 'jitesh',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'description',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Description',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02594',
+		'no_copy': None,
+		'oldfieldname': 'description',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000409',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'item_serial_no',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Item Serial No',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02596',
+		'no_copy': None,
+		'oldfieldname': 'item_serial_no',
+		'oldfieldtype': 'Link',
+		'options': 'Serial No',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'batch_no',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Batch No',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02597',
+		'no_copy': None,
+		'oldfieldname': 'batch_no',
+		'oldfieldtype': 'Link',
+		'options': 'Batch',
+		'owner': 'nabin@webnotestech.com',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'purchase_receipt_no',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 12,
+		'in_filter': 1,
+		'label': 'Purchase Receipt No',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02598',
+		'no_copy': None,
+		'oldfieldname': 'purchase_receipt_no',
+		'oldfieldtype': 'Link',
+		'options': 'Purchase Receipt',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_no',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'icon': None,
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Delivery Note No',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02599',
+		'no_copy': None,
+		'oldfieldname': 'delivery_note_no',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'inspected_by',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Inspected By',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02600',
+		'no_copy': None,
+		'oldfieldname': 'inspected_by',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'remarks',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Remarks',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02601',
+		'no_copy': 1,
+		'oldfieldname': 'remarks',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'verified_by',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Verified By',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02602',
+		'no_copy': None,
+		'oldfieldname': 'verified_by',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Amended From',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02603',
+		'no_copy': None,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Amendment Date',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02604',
+		'no_copy': None,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:25',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Specification Details',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': '000000410',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': 'Simple',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Button',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Get Specification Details',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02606',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Button',
+		'options': 'get_item_specification_details',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'qa_specification_details',
+		'fieldtype': 'Table',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'QA Specification Details',
+		'modified': '2011-05-09 11:04:25',
+		'modified_by': 'Administrator',
+		'name': 'FL02607',
+		'no_copy': None,
+		'oldfieldname': 'qa_specification_details',
+		'oldfieldtype': 'Table',
+		'options': 'QA Specification Detail',
+		'owner': 'Administrator',
+		'parent': 'QA Inspection Report',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/srm/doctype/qa_specification_detail/__init__.py b/srm/doctype/qa_specification_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/qa_specification_detail/__init__.py
diff --git a/srm/doctype/qa_specification_detail/qa_specification_detail.txt b/srm/doctype/qa_specification_detail/qa_specification_detail.txt
new file mode 100644
index 0000000..6cd4201
--- /dev/null
+++ b/srm/doctype/qa_specification_detail/qa_specification_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-28 12:39:12', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'QASD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'QA Specification Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'specification', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Parameter', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01523', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'specification', 'fieldtype': 'Data', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'value', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Acceptance Criteria', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01524', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_1', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01525', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_1', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_2', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 2', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01526', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_2', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_3', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 3', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01527', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_3', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_4', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 4', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01528', 'idx': 6, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_4', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_5', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 5', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01529', 'idx': 7, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_5', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_6', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 6', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01530', 'idx': 8, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_6', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_7', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 7', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01531', 'idx': 9, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_7', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_8', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 8', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01532', 'idx': 10, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_8', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:12', 'doctype': 'DocField', 'oldfieldname': 'reading_9', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 9', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01533', 'idx': 11, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_9', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-28 12:39:13', 'doctype': 'DocField', 'oldfieldname': 'reading_10', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reading 10', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01534', 'idx': 12, 'default': None, 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'reading_10', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-28 12:39:13', 'doctype': 'DocField', 'oldfieldname': 'status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'QA Specification Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01535', 'idx': 13, 'default': 'Accepted', 'colour': None, 'modified': '2009-06-01 18:12:10', 'parenttype': 'DocType', 'fieldname': 'status', 'fieldtype': 'Select', 'options': 'Accepted\nRejected', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/raw_materials_supplied/__init__.py b/srm/doctype/raw_materials_supplied/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/raw_materials_supplied/__init__.py
diff --git a/srm/doctype/raw_materials_supplied/raw_materials_supplied.txt b/srm/doctype/raw_materials_supplied/raw_materials_supplied.txt
new file mode 100644
index 0000000..3f2270d
--- /dev/null
+++ b/srm/doctype/raw_materials_supplied/raw_materials_supplied.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-09-10 15:57:46', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'RMS/.######', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Raw Materials Supplied', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'po_item', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'PO Item', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02946', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'po_item', 'fieldtype': 'Select', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'raw_material', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Raw Material', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02945', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'raw_material', 'fieldtype': 'Link', 'options': 'Item', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02948', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'stock_uom', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Stock UOM', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02949', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'stock_uom', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'source_warehouse', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Source Warehouse', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02947', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'source_warehouse', 'fieldtype': 'Select', 'options': 'link:Warehouse', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'qty', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Qty', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02951', 'idx': 6, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2009-09-10 15:57:46', 'doctype': 'DocField', 'oldfieldname': 'ma_valuation_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Valuation  Rate (MA)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02952', 'idx': 7, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'ma_valuation_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-09-11 11:27:29', 'doctype': 'DocField', 'oldfieldname': 'fifo_valuation_rate', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Valuation Rate (FIFO)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Raw Materials Supplied', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02954', 'idx': 8, 'default': None, 'colour': None, 'modified': '2009-09-11 17:10:14', 'parenttype': 'DocType', 'fieldname': 'fifo_valuation_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/doctype/supplier/__init__.py b/srm/doctype/supplier/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/supplier/__init__.py
diff --git a/srm/doctype/supplier/supplier.js b/srm/doctype/supplier/supplier.js
new file mode 100644
index 0000000..8043a96
--- /dev/null
+++ b/srm/doctype/supplier/supplier.js
@@ -0,0 +1,153 @@
+$import(Contact Control)
+
+cur_frm.cscript.onload = function(doc,dt,dn){
+
+	// history doctypes and scripts
+	cur_frm.history_dict = {
+		'Purchase Order' : 'cur_frm.cscript.make_po_list(this.body, this.doc)',
+		'Purchase Receipt' : 'cur_frm.cscript.make_pr_list(this.body, this.doc)',
+		'Purchase Invoice' : 'cur_frm.cscript.make_pi_list(this.body, this.doc)'
+	}
+	
+	// make contact, history list body
+	//cur_frm.cscript.make_cl_body();
+	cur_frm.cscript.make_hl_body();
+}
+
+cur_frm.cscript.refresh = function(doc,dt,dn) {
+  if(sys_defaults.supp_master_name == 'Supplier Name')
+    hide_field('naming_series');
+  else
+    unhide_field('naming_series'); 
+    
+  if(doc.__islocal){
+    	hide_field(['Address HTML','Contact HTML']); 
+  		//if(doc.country) cur_frm.cscript.get_states(doc,dt,dn);  	
+		// set message
+		//cur_frm.cscript.set_cl_msg(doc);
+		//cur_frm.cscript.set_hl_msg(doc);
+  }
+  else{
+	  	unhide_field(['Address HTML','Contact HTML']);
+		// make lists
+		cur_frm.cscript.make_address(doc,dt,dn);
+		cur_frm.cscript.make_contact(doc,dt,dn);
+		cur_frm.cscript.make_history(doc,dt,dn);  	
+  }
+}
+
+cur_frm.cscript.make_address = function() {
+	if(!cur_frm.address_list) {
+		cur_frm.address_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Address HTML'].wrapper,
+			page_length: 2,
+			new_doctype: "Address",
+			new_doc_onload: function(dn) {
+				ndoc = locals["Address"][dn];
+				ndoc.supplier = cur_frm.doc.name;
+				ndoc.supplier_name = cur_frm.doc.supplier_name;
+				ndoc.address_type = 'Office';								
+			},		
+			new_doc_onsave: function(dn) {				
+				cur_frm.address_list.run()
+			},	
+			get_query: function() {
+				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
+			},
+			as_dict: 1,
+			no_results_message: 'No addresses created',
+			render_row: function(wrapper, data) {
+				$(wrapper).css('padding','5px 0px');
+				var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
+				link.dn = data.name
+				
+				$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));
+				$a(wrapper,'div','',{marginTop:'5px', color:'#555'}, 
+					(data.address_line1 ? data.address_line1 + '<br />' : '') + 
+					(data.address_line2 ? data.address_line2 + '<br />' : '') + 
+					(data.city ? data.city + '<br />' : '') + 
+					(data.state ? data.state + ', ' : '') + 
+					(data.country ? data.country  + '<br />' : '') + 
+					(data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') + 
+					(data.phone ? 'Phone: ' + data.phone + '<br />' : '') + 
+					(data.fax ? 'Fax: ' + data.fax + '<br />' : '') + 
+					(data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));			
+			}
+		});
+	}
+	cur_frm.address_list.run();
+}
+
+cur_frm.cscript.make_contact = function() {
+	if(!cur_frm.contact_list) {
+		cur_frm.contact_list = new wn.widgets.Listing({
+			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
+			page_length: 2,
+			new_doctype: "Contact",
+			new_doc_onload: function(dn) {
+				ndoc = locals["Contact"][dn];
+				ndoc.supplier = cur_frm.doc.name;
+				ndoc.supplier_name = cur_frm.doc.supplier_name;
+			},
+			new_doc_onsave: function(dn) {				
+				cur_frm.contact_list.run()
+			},
+			get_query: function() {
+				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
+			},
+			as_dict: 1,
+			no_results_message: 'No contacts created',
+			render_row: function(wrapper, data) {
+				$(wrapper).css('padding', '5px 0px');
+				var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
+				link.dn = data.name
+
+				$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
+				$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
+			}
+		});
+	}
+	cur_frm.contact_list.run();
+}
+
+// make purchase order list
+cur_frm.cscript.make_po_list = function(parent, doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','25%','20%','25%','25%'];
+	lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency'];
+	lst.coloptions = ['','Purchase Order','','','',''];
+
+	var q = repl("select name,status,transaction_date, grand_total from `tabPurchase Order` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name});
+	var q_max = repl("select count(name) from `tabPurchase Order` where supplier='%(sup)s'", {'sup':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Order','Purchase Order');
+}
+
+// make purchase receipt list
+cur_frm.cscript.make_pr_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
+	lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
+	lst.coloptions = ['','Purchase Receipt','','','',''];
+	
+	var q = repl("select name,status,transaction_date,per_billed,grand_total from `tabPurchase Receipt` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name});
+	var q_max = repl("select count(name) from `tabPurchase Receipt` where supplier='%(sup)s'", {'sup':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Receipt','Purchase Receipt');
+}
+
+// make purchase invoice list
+cur_frm.cscript.make_pi_list = function(parent,doc){
+	var lst = new Listing();
+	lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
+	lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total'];
+	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
+	lst.coloptions = ['','Payable Voucher','','','',''];
+
+	var q = repl("select name, posting_date, credit_to, bill_date, grand_total from `tabPayable Voucher` where supplier='%(sup)s' order by posting_date desc", {'sup':doc.name});
+	var q_max = repl("select count(name) from `tabPayable Voucher` where supplier='%(sup)s'", {'sup':doc.name});
+	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Invoice','Payable Voucher');	
+}
diff --git a/srm/doctype/supplier/supplier.py b/srm/doctype/supplier/supplier.py
new file mode 100644
index 0000000..af5b85a
--- /dev/null
+++ b/srm/doctype/supplier/supplier.py
@@ -0,0 +1,135 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def autoname(self):
+    #get default naming conventional from control panel
+    supp_master_name = get_defaults()['supp_master_name']
+
+    if supp_master_name == 'Supplier Name':
+    
+      # filter out bad characters in name
+      supp = self.doc.supplier_name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
+      
+      cust = sql("select name from `tabCustomer` where name = '%s'" % (supp))
+      cust = cust and cust[0][0] or ''
+    
+      if cust:
+        msgprint("You already have a Customer with same name")
+        raise Exception
+      self.doc.name = supp
+      
+    else:
+      self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+  # ----------------------------------------
+  # update credit days and limit in account
+  # ----------------------------------------
+  def update_credit_days_limit(self):
+    sql("update tabAccount set credit_days = '%s' where name = '%s'" % (self.doc.credit_days, self.doc.name + " - " + self.get_company_abbr()))
+
+
+  def on_update(self):
+    if not self.doc.naming_series:
+      self.doc.naming_series = ''
+
+  
+    # create address
+    addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
+    address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
+    set(self.doc,'address', address_line)
+
+    # create account head
+    self.create_account_head()
+
+		# update credit days and limit in account
+    self.update_credit_days_limit()
+
+
+  def check_state(self):
+    return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
+  
+  # ACCOUNTS
+  # -------------------------------------------
+  def get_payables_group(self):
+    g = sql("select payables_group from tabCompany where name=%s", self.doc.company)
+    g = g and g[0][0] or ''
+    if not g:
+      msgprint("Update Company master, assign a default group for Payables")
+      raise Exception
+    return g
+
+  def add_account(self, ac, par, abbr):
+    arg = {'account_name':ac,'parent_account':par, 'group_or_ledger':'Group', 'company':self.doc.company,'account_type':'','tax_rate':'0'}
+    t = get_obj('GL Control').add_ac(cstr(arg))
+    msgprint("Created Group " + t)
+  
+  def get_company_abbr(self):
+    return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+  
+  def get_parent_account(self, abbr):
+    if (not self.doc.supplier_type):
+      msgprint("Supplier Type is mandatory")
+      raise Exception
+    
+    if not sql("select name from tabAccount where name=%s", (self.doc.supplier_type + " - " + abbr)):
+
+      # if not group created , create it
+      self.add_account(self.doc.supplier_type, self.get_payables_group(), abbr)
+    
+    return self.doc.supplier_type + " - " + abbr
+
+
+  def validate(self):
+    #validation for Naming Series mandatory field...
+    if get_defaults()['supp_master_name'] == 'Naming Series':
+      if not self.doc.naming_series:
+        msgprint("Series is Mandatory.")
+        raise Exception
+  
+  
+  # create accont head - in tree under zone + territory
+  # -------------------------------------------------------
+  def create_account_head(self):
+    if self.doc.company :
+      abbr = self.get_company_abbr() 
+            
+      if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
+        parent_account = self.get_parent_account(abbr)
+        
+        arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Supplier','master_name':self.doc.name,'address':self.doc.address}
+        # create
+        ac = get_obj('GL Control').add_ac(cstr(arg))
+        msgprint("Created Account Head: "+ac)
+        
+    else : 
+      msgprint("Please select Company under which you want to create account head")
+      
+      
+  def get_contacts(self,nm):
+    if nm:    
+      contact_details =convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where supplier = '%s'"%nm))
+   
+      return contact_details
+    else:
+      return ''
diff --git a/srm/doctype/supplier/supplier.txt b/srm/doctype/supplier/supplier.txt
new file mode 100644
index 0000000..4ec23b6
--- /dev/null
+++ b/srm/doctype/supplier/supplier.txt
@@ -0,0 +1,907 @@
+[
+	{
+		'_last_update': '1305029541',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:26',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-10 17:42:21',
+		'modified_by': 'Guest',
+		'module': 'SRM',
+		'name': 'Supplier',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': 'supplier_name,supplier_type',
+		'section_style': 'Tabbed',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': ' ',
+		'tag_fields': 'supplier_type',
+		'use_template': None,
+		'version': 86
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:26',
+		'modified_by': 'Administrator',
+		'name': 'PERM00566',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2010-08-08 17:09:26',
+		'modified_by': 'Administrator',
+		'name': 'PERM00567',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2010-08-08 17:09:26',
+		'modified_by': 'Administrator',
+		'name': 'PERM00568',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Purchase Master Manager',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:26',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': '',
+		'modified': '2010-08-08 17:09:26',
+		'modified_by': 'Administrator',
+		'name': 'PERM00569',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Basic Info',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05471',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Supplier Name',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03459',
+		'no_column': None,
+		'no_copy': 1,
+		'oldfieldname': 'supplier_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_type',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Supplier Type',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03460',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_type',
+		'oldfieldtype': 'Link',
+		'options': 'Supplier Type',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05472',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-24 14:45:43',
+		'default': 'SUPP',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Series',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03772',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'naming_series',
+		'oldfieldtype': 'Select',
+		'options': '\nSUPP\nSUPP/10-11/',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_status',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Supplier Status',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03461',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_status',
+		'oldfieldtype': 'Select',
+		'options': '\nApproved\nUnapproved',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Address & Contacts',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05473',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Address Desc',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05474',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<em>Addresses will appear only when you save the supplier</em>',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Address HTML',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05475',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05476',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': 'eval:doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Contact Desc',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05477',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': '<em>Contact Details will appear only when you save the supplier</em>',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Contact HTML',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05478',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'More Info',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05479',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter the company name under which Account Head will be created for this Supplier',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Company',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03475',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'company',
+		'oldfieldtype': 'Link',
+		'options': 'Company',
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': 'Statutory info and other general information about your Supplier',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_details',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Supplier Details',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03476',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'supplier_details',
+		'oldfieldtype': 'Code',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05480',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-03-31 13:35:57',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'credit_days',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Credit Days',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': '000002192',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'website',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Website',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03462',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'website',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Transaction History',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05481',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'yogesh@webnotestech.com',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:45:41',
+		'default': None,
+		'depends_on': 'eval:!doc.__islocal',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'HTML',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'History HTML',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL05482',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'HTML',
+		'options': None,
+		'owner': 'yogesh@webnotestech.com',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:26',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 21,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-25 12:45:41',
+		'modified_by': 'Guest',
+		'name': 'FL03457',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Supplier',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/srm/doctype/supplier_quotation/__init__.py b/srm/doctype/supplier_quotation/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/srm/doctype/supplier_quotation/__init__.py
diff --git a/srm/doctype/supplier_quotation/supplier_quotation.js b/srm/doctype/supplier_quotation/supplier_quotation.js
new file mode 100755
index 0000000..bf9bdc1
--- /dev/null
+++ b/srm/doctype/supplier_quotation/supplier_quotation.js
@@ -0,0 +1,82 @@
+cur_frm.cscript.tname = "Supplier Quotation Detail";
+cur_frm.cscript.fname = "supplier_quotation_details";
+
+$import(Purchase Common)
+
+// ======================= OnLoad =============================================
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+
+  
+  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+  if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+  if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1'});
+  if(!doc.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
+  
+  if(doc.__islocal && has_common(user_roles,['Partner','Supplier'])){
+    get_server_fields('get_contact_details','','',doc,cdt,cdn,1);
+  }
+  else if(doc.__islocal && doc.supplier){
+    get_server_fields('get_supplier_details',doc.supplier,'',doc,cdt,cdn,1);
+  }
+
+}
+
+//======================= Refresh ==============================================
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+
+  if(has_common(user_roles,['Purchase User','Purchase Manager'])){
+    unhide_field(['Approve / Unapprove']);
+    if(doc.approval_status == 'Approved' && doc.status == 'Submitted') { unhide_field(['Create PO']);}
+    else { hide_field(['Create PO']);}
+  }
+  else{ 
+    hide_field(['Create PO']);
+    hide_field(['Approve / Unapprove']);
+  }  
+}
+
+//======================= RFQ NO Get Query ===============================================
+cur_frm.fields_dict['rfq_no'].get_query = function(doc){
+  return 'SELECT DISTINCT `tabRFQ`.name FROM `tabRFQ` WHERE `tabRFQ`.docstatus = 1 AND `tabRFQ`.name LIKE "%s"';
+}
+
+// ***************** Get Contact Person based on supplier selected *****************
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+  return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_supplier = 1 AND `tabContact`.supplier = "'+ doc.supplier+'" AND `tabContact`.docstatus != 2 AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+}
+
+//=================== On Button Click Functions =====================
+
+//======================== Create Purchase Order =========================================
+cur_frm.cscript['Create PO'] = function(doc,cdt,cdn){
+  n = createLocal("Purchase Order");
+  $c('dt_map', args={
+    'docs':compress_doclist([locals["Purchase Order"][n]]),
+    'from_doctype':'Supplier Quotation',
+    'to_doctype':'Purchase Order',
+    'from_docname':doc.name,
+    'from_to_list':"[['Supplier Quotation', 'Purchase Order'], ['Supplier Quotation Detail', 'PO Detail']]"
+  }
+  , function(r,rt) {
+      loaddoc("Purchase Order", n);
+    }
+  );
+}
+
+//======================== Get Report ===================================================
+cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
+  var callback = function(report){
+  report.set_filter('PO Detail', 'Ref Doc',doc.name)
+ }
+ loadreport('PO Detail','Itemwise Purchase Details', callback);
+}
+
+cur_frm.cscript['Approve / Unapprove'] = function(doc, cdt, cdn){
+  var d = locals[cdt][cdn];
+  
+  $c_obj(make_doclist(doc.doctype, doc.name),'update_approval_status','', function(r,rt){  
+    refresh_field('approval_status');
+    doc.approval_status = r.message;
+    cur_frm.cscript.refresh(d, d.cdt, d.cdn);
+  });
+}
\ No newline at end of file
diff --git a/srm/doctype/supplier_quotation/supplier_quotation.py b/srm/doctype/supplier_quotation/supplier_quotation.py
new file mode 100755
index 0000000..0c659bc
--- /dev/null
+++ b/srm/doctype/supplier_quotation/supplier_quotation.py
@@ -0,0 +1,104 @@
+class DocType:
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.fname = 'supplier_quotation_details'
+    self.tname = 'Supplier Quotation Detail'
+
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+  def get_contact_details(self):
+    cd = sql("select concat_ws(' ',t2.first_name,t2.last_name),t2.contact_no, t2.email_id, t2.supplier, t2.supplier_name, t2.supplier_address from `tabProfile` t1, `tabContact` t2 where t1.email=t2.email_id and t1.name=%s", session['user'])
+    ret = {
+      'contact_person'  : cd and cd[0][0] or '',
+      'contact_no'      : cd and cd[0][1] or '',
+      'email'           : cd and cd[0][2] or '',
+      'supplier'   : cd and cd[0][3] or '',
+      'supplier_name'   : cd and cd[0][4] or '',
+      'supplier_address': cd and cd[0][5] or ''
+    }
+    return cstr(ret)
+
+  def get_rfq_details(self):
+    self.doc.clear_table(self.doclist, 'supplier_quotation_details')
+    get_obj('DocType Mapper','RFQ-Supplier Quotation').dt_map('RFQ','Supplier Quotation',self.doc.rfq_no, self.doc, self.doclist, "[['RFQ Detail', 'Supplier Quotation Detail']]")
+
+  #update approval status
+  def update_approval_status(self):
+    if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
+      set(self.doc, 'approval_status','Approved')
+      return cstr(self.doc.approval_status)
+    elif self.doc.approval_status == 'Approved':
+      pc_obj = get_obj('Purchase Common')
+      pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
+      set(self.doc, 'approval_status', 'Not Approved')
+      return cstr(self.doc.approval_status)
+  
+  def validate_item_list(self):
+    if not getlist(self.doclist, 'supplier_quotation_details'):
+      msgprint("Please fetch RFQ details against which this quotation is prapared")
+      raise Exception
+  
+  # On Validate
+  #---------------------------------------------------------------------------------------------------------
+  def validate(self):
+    self.validate_item_list()
+    pc_obj = get_obj(dt='Purchase Common')
+    pc_obj.validate_for_items(self)
+    pc_obj.validate_conversion_rate(self)
+    pc_obj.validate_doc(obj = self, prevdoc_doctype = 'RFQ', prevdoc_docname = self.doc.rfq_no)
+  
+  def on_update(self):
+    set(self.doc, 'status', 'Draft')
+  
+  # checks whether previous documents doctstatus is submitted.
+  def check_previous_docstatus(self):
+    pc_obj = get_obj(dt = 'Purchase Common')
+    for d in getlist(self.doclist, 'rfq_details'):
+      if d.prevdoc_docname:
+        pc_obj.check_docstatus(check = 'Previous', doctype = 'Indent', docname = d.prevdoc_docname)
+  
+  #update rfq
+  def update_rfq(self, status):
+    prevdoc=''
+    for d in getlist(self.doclist, 'supplier_quotation_details'):
+      if d.prevdoc_docname:
+        prevdoc = d.prevdoc_docname
+    
+    if status == 'Submitted':
+      sql("update `tabRFQ` set status = 'Quotation Received' where name=%s", prevdoc)
+    elif status == 'Cancelled':
+      sql("update `tabRFQ` set status = 'Submitted' where name=%s", prevdoc)
+  
+  # On Submit
+  def on_submit(self):
+    # checks whether previous documents doctstatus is submitted.
+    self.check_previous_docstatus() 
+    set(self.doc, 'status', 'Submitted')
+    self.update_rfq('Submitted')
+  
+  # On Cancel
+  #---------------------------------------------------------------------------------------------------------
+  #def check_next_docstatus(self):
+  #  submitted = sql("selct name from `tabPurchase Order` where ref_sq = '%s' and docstatus = 1" % self.doc.name)
+  #  if submitted:
+  #    msgprint("Purchase Order : " + cstr(submitted[0][0]) + " has already been submitted !")
+  #    raise Exception
+    
+  def on_cancel(self):
+    pc_obj = get_obj('Purchase Common')
+    pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
+    #self.check_next_docstatus()
+    set(self.doc, 'status', 'Cancelled')
+    self.update_rfq('Cancelled')
+
+  # GET TERMS & CONDITIONS
+  # =====================================================================================
+  def get_tc_details(self):
+    return get_obj('Purchase Common').get_tc_details(self)
+
+  # Get Supplier Details
+  # --------------------
+  def get_supplier_details(self, name = ''):
+    return cstr(get_obj('Purchase Common').get_supplier_details(name))
\ No newline at end of file
diff --git a/srm/doctype/supplier_quotation/supplier_quotation.txt b/srm/doctype/supplier_quotation/supplier_quotation.txt
new file mode 100755
index 0000000..3f94f21
--- /dev/null
+++ b/srm/doctype/supplier_quotation/supplier_quotation.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-06-30 15:39:38', 'search_fields': None, 'module': 'SRM', 'doctype': 'DocType', 'change_log': None, 'print_outline': None, 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 242, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'SQ.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Supplier Quotation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2011-01-28 11:41:36', 'server_code_error': ' ', 'name_case': None, 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00336', 'parent': 'Supplier Quotation', 'read': 1, 'create': 1, 'creation': '2009-06-30 16:09:56', 'modified': '2011-01-28 11:41:36', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00337', 'parent': 'Supplier Quotation', 'read': 1, 'create': 1, 'creation': '2009-06-30 16:09:56', 'modified': '2011-01-28 11:41:36', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Supplier', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 1, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00425', 'parent': 'Supplier Quotation', 'read': 1, 'create': 1, 'creation': '2009-09-17 15:14:42', 'modified': '2011-01-28 11:41:36', 'submit': 1, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00426', 'parent': 'Supplier Quotation', 'read': 1, 'create': None, 'creation': '2009-09-17 15:14:42', 'modified': '2011-01-28 11:41:36', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00339', 'parent': 'Supplier Quotation', 'read': 1, 'create': None, 'creation': '2009-06-30 16:46:11', 'modified': '2011-01-28 11:41:36', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 5, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00352', 'parent': 'Supplier Quotation', 'read': 1, 'create': None, 'creation': '2009-07-13 15:34:08', 'modified': '2011-01-28 11:41:36', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 6, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00353', 'parent': 'Supplier Quotation', 'read': 1, 'create': None, 'creation': '2009-07-13 15:34:08', 'modified': '2011-01-28 11:41:36', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 7, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 2, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-07-02 18:36:46', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Create PO', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL02520', 'idx': 1, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Basic Info', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Enter item rates and details of supplier who is providing quotation', 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02466', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2009-06-30 16:09:56', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02472', 'idx': 3, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-10-05 16:22:12', 'doctype': 'DocField', 'oldfieldname': 'naming_series', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06217', 'idx': 4, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'naming_series', 'fieldtype': 'Select', 'options': '\nSQTN', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-10-05 16:22:12', 'doctype': 'DocField', 'oldfieldname': 'status', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Quotation', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL06216', 'idx': 5, 'default': 'Draft', 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'status', 'fieldtype': 'Select', 'options': '\nDraft\nQuotation Sent\nOrder Confirmed\nCancelled', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-06-30 16:09:56', 'doctype': 'DocField', 'oldfieldname': 'transaction_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Quotation Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'The date at which current entry is made in system.', 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02471', 'idx': 6, 'default': 'Today', 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'transaction_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-10-04 12:45:02', 'doctype': 'DocField', 'oldfieldname': 'activity_log_text', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Activity Log Text', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06184', 'idx': 7, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'activity_log_text', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-09-15 15:06:53', 'doctype': 'DocField', 'oldfieldname': 'company', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'For Company', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02993', 'idx': 8, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'company', 'fieldtype': 'Link', 'options': 'Company', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-09-15 15:06:53', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02992', 'idx': 9, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Data', 'creation': '2010-10-11 14:18:04', 'doctype': 'DocField', 'oldfieldname': 'amended_from', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Amended From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06247', 'idx': 10, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'amended_from', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Date', 'creation': '2010-10-11 14:18:04', 'doctype': 'DocField', 'oldfieldname': 'amendment_date', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Amendment Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 1, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06246', 'idx': 11, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'amendment_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2009-06-30 16:09:56', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02473', 'idx': 12, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-07-15 11:45:33', 'doctype': 'DocField', 'oldfieldname': 'approval_status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Approval Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': 'You can create PO when quotation gets approved.', 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': 0, 'icon': None, 'name': 'FL02577', 'idx': 13, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'approval_status', 'fieldtype': 'Select', 'options': '\nApproved\nNot Approved', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-09-15 11:38:56', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Approve / Unapprove', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 2, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL02990', 'idx': 14, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'supplier', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Supplier', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02460', 'idx': 15, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'supplier', 'fieldtype': 'Link', 'options': 'Supplier', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-10-05 16:22:12', 'doctype': 'DocField', 'oldfieldname': 'supplier_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Supplier Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06218', 'idx': 16, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'supplier_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'supplier_address', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Supplier Address', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02461', 'idx': 17, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'supplier_address', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'contact_person', 'owner': 'Administrator', 'reqd': None, 'in_filter': 0, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Contact Person', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02462', 'idx': 18, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'contact_person', 'fieldtype': 'Link', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'contact_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Contact No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02463', 'idx': 19, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'contact_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'email', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Email', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02464', 'idx': 20, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'email', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02465', 'idx': 21, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'rfq_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'RFQ No', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02459', 'idx': 22, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'rfq_no', 'fieldtype': 'Link', 'options': 'RFQ', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-09-15 11:38:56', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get Items', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02989', 'idx': 23, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_rfq_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Column Break', 'creation': '2010-10-12 11:46:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06271', 'idx': 24, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-10-12 11:46:18', 'doctype': 'DocField', 'oldfieldname': 'currency', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Currency', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': "Supplier's currency", 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06274', 'idx': 25, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'currency', 'fieldtype': 'Select', 'options': 'link:Currency', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-10-12 11:46:18', 'doctype': 'DocField', 'oldfieldname': 'conversion_rate', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Conversion Rate', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': "Rate at which supplier's currency is converted to your currency", 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06273', 'idx': 26, 'default': '1', 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'conversion_rate', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-10-12 11:46:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06272', 'idx': 27, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': 'Simple', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'supplier_quotation_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Quotation Details1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02468', 'idx': 28, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'supplier_quotation_details', 'fieldtype': 'Table', 'options': 'Supplier Quotation Detail', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'net_total', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Net Total', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02469', 'idx': 29, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'net_total', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-10-05 16:22:12', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Terms', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Enter terms and conditions which you want to include', 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06219', 'idx': 30, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-10-11 09:25:18', 'doctype': 'DocField', 'oldfieldname': 'tc_name', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Select Terms', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06243', 'idx': 31, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'tc_name', 'fieldtype': 'Link', 'options': 'Term', 'report_hide': 1, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2010-10-11 09:25:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get Terms', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06244', 'idx': 32, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': 'get_tc_details', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2010-10-11 09:25:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Terms HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06245', 'idx': 33, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': 'You can add Terms and Notes that will be printed in the Transaction', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2009-06-30 15:39:38', 'doctype': 'DocField', 'oldfieldname': 'terms', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Terms and Conditions', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02470', 'idx': 34, 'default': None, 'colour': None, 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': 'terms', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-10-06 08:50:05', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Next Steps', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': "Next steps will be visible when you submit the supplier quotation and approval status is 'Approved'", 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06234', 'idx': 35, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-09-01 11:18:39', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Get Report', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Quotation', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL02910', 'idx': 36, 'default': None, 'colour': 'White:FFF', 'modified': '2011-01-28 11:41:36', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/srm/page/__init__.py b/srm/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/page/__init__.py
diff --git a/srm/search_criteria/__init__.py b/srm/search_criteria/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/search_criteria/__init__.py
diff --git a/srm/search_criteria/itemwise_purchase_details/__init__.py b/srm/search_criteria/itemwise_purchase_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/search_criteria/itemwise_purchase_details/__init__.py
diff --git a/srm/search_criteria/itemwise_purchase_details/itemwise_purchase_details.js b/srm/search_criteria/itemwise_purchase_details/itemwise_purchase_details.js
new file mode 100644
index 0000000..66a1e82
--- /dev/null
+++ b/srm/search_criteria/itemwise_purchase_details/itemwise_purchase_details.js
@@ -0,0 +1,5 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'From PO Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'To PO Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+
+}
\ No newline at end of file
diff --git a/srm/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt b/srm/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
new file mode 100644
index 0000000..25e1124
--- /dev/null
+++ b/srm/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Purchase Order\x01ID,Purchase Order\x01PO Date,Purchase Order\x01Grand Total,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Quantity,PO Detail\x01Stock UOM,PO Detail\x01Purchase Rate,PO Detail\x01Amount,PO Detail\x01Warehouse',
+		'creation': '2010-08-08 17:09:31',
+		'criteria_name': 'Itemwise Purchase Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'PO Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Company Name':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-03-31 12:39:57',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'itemwise_purchase_details',
+		'owner': 'Administrator',
+		'page_len': None,
+		'parent': None,
+		'parent_doc_type': 'Purchase Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabPurchase Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/srm/search_criteria/itemwise_receipt_details/__init__.py b/srm/search_criteria/itemwise_receipt_details/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/search_criteria/itemwise_receipt_details/__init__.py
diff --git a/srm/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js b/srm/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js
new file mode 100644
index 0000000..426b8bc
--- /dev/null
+++ b/srm/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js
@@ -0,0 +1,9 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From Transaction Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To Transaction Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+
+}
\ No newline at end of file
diff --git a/srm/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt b/srm/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt
new file mode 100644
index 0000000..d851dc5
--- /dev/null
+++ b/srm/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': None,
+		'add_cond': None,
+		'add_tab': None,
+		'columns': 'Purchase Receipt\x01ID,Purchase Receipt\x01Posting Date,Purchase Receipt Detail\x01Item Code,Purchase Receipt Detail\x01Item Name,Purchase Receipt Detail\x01Accepted Quantity,Purchase Receipt Detail\x01Rejected Quantity,Purchase Receipt Detail\x01Accepted Warehouse,Purchase Receipt Detail\x01Rejected Warehouse,Purchase Receipt Detail\x01Amount',
+		'creation': '2010-12-14 10:33:08',
+		'criteria_name': 'Itemwise Receipt Details',
+		'custom_query': '',
+		'description': None,
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Purchase Receipt Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Receipt\x01Saved':1,'Purchase Receipt\x01Submitted':1,'Purchase Receipt\x01Status':'','Purchase Receipt\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2010-10-22 14:36:11',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'itemwise_receipt_details',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Purchase Receipt',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabPurchase Receipt`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/srm/search_criteria/pending_po_items_to_bill/__init__.py b/srm/search_criteria/pending_po_items_to_bill/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_bill/__init__.py
diff --git a/srm/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.js b/srm/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.js
new file mode 100644
index 0000000..79ebc20
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/srm/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt b/srm/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
new file mode 100644
index 0000000..98847a8
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '(CASE WHEN (`tabPO Detail`.qty- ifnull(`tabPO Detail`.billed_qty, 0) > 0 ) THEN (`tabPO Detail`.qty-ifnull(`tabPO Detail`.billed_qty, 0) ) ELSE 0 END) AS "Pending To Bill"',
+		'add_cond': '(`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) > 0 or `tabPO Detail`.qty - ifnull(`tabPO Detail`.billed_qty, 0) > 0)\n`tabPurchase Order`.status != "Stopped"',
+		'add_tab': None,
+		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,PO Detail\x01Indent No,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Description,PO Detail\x01Quantity,PO Detail\x01UOM,PO Detail\x01Received Qty',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Pending PO Items To Bill',
+		'custom_query': '',
+		'description': 'Pending PO Items To Bill',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'PO Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-03-29 14:26:49',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'pending_po_items_to_bill',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Purchase Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabPurchase Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/srm/search_criteria/pending_po_items_to_receive/__init__.py b/srm/search_criteria/pending_po_items_to_receive/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_receive/__init__.py
diff --git a/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.js b/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.js
new file mode 100644
index 0000000..79ebc20
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.js
@@ -0,0 +1,4 @@
+report.customize_filters = function() {
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
+}
\ No newline at end of file
diff --git a/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py b/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
new file mode 100644
index 0000000..486cc6d
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
@@ -0,0 +1,2 @@
+colwidths[col_idx['Pending Quantity To Receive']] = '200px'
+colwidths[col_idx['Pending Amount To Receive']] = '200px'
\ No newline at end of file
diff --git a/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt b/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
new file mode 100644
index 0000000..563711f
--- /dev/null
+++ b/srm/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) AS "Pending Quantity To Receive"\n(`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0)) * `tabPO Detail`.purchase_rate AS "Pending Amount To Receive"',
+		'add_cond': '`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) > 0 \n`tabPurchase Order`.status != "Stopped"',
+		'add_tab': None,
+		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,PO Detail\x01Indent No,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Description,PO Detail\x01Quantity,PO Detail\x01UOM,PO Detail\x01Received Qty',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Pending PO Items To Receive',
+		'custom_query': '',
+		'description': 'Pending PO Items To Receive',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'PO Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-04-01 17:19:03',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'pending_po_items_to_receive',
+		'owner': 'dhanalekshmi@webnotestech.com',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Purchase Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabPurchase Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/srm/search_criteria/purchase_in_transit/__init__.py b/srm/search_criteria/purchase_in_transit/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/srm/search_criteria/purchase_in_transit/__init__.py
diff --git a/srm/search_criteria/purchase_in_transit/purchase_in_transit.js b/srm/search_criteria/purchase_in_transit/purchase_in_transit.js
new file mode 100644
index 0000000..6aba209
--- /dev/null
+++ b/srm/search_criteria/purchase_in_transit/purchase_in_transit.js
@@ -0,0 +1,32 @@
+report.customize_filters = function() {
+
+  this.hide_all_filters();
+
+
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Credit To'].df.filter_hide = 0;
+
+
+  this.add_filter({fieldname:'pr_posting_date', label:'PR Posting Date', fieldtype:'Date', ignore : 1, parent:'Purchase Receipt'});
+
+
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Credit To'].df.in_first_page = 0;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+
+  
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df.ignore = 1;
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df.ignore = 1;
+
+
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+
+}
+
+this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/srm/search_criteria/purchase_in_transit/purchase_in_transit.py b/srm/search_criteria/purchase_in_transit/purchase_in_transit.py
new file mode 100644
index 0000000..7708fbb
--- /dev/null
+++ b/srm/search_criteria/purchase_in_transit/purchase_in_transit.py
@@ -0,0 +1,7 @@
+#check mendatory
+if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
+  msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
+  raise Exception
+else:
+  from_date = filter_values.get('posting_date')
+  to_date = filter_values.get('posting_date1')
\ No newline at end of file
diff --git a/srm/search_criteria/purchase_in_transit/purchase_in_transit.txt b/srm/search_criteria/purchase_in_transit/purchase_in_transit.txt
new file mode 100644
index 0000000..c8c32aa
--- /dev/null
+++ b/srm/search_criteria/purchase_in_transit/purchase_in_transit.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': "`tabPurchase Receipt`.`posting_date` AS 'PR Posting Date'",
+		'add_cond': "`tabPV Detail`.`purchase_receipt`  = `tabPurchase Receipt`.`name`\n`tabPurchase Receipt`.`posting_date` >= '%(pr_posting_date)s'\n`tabPurchase Receipt`.`posting_date` <= '%(pr_posting_date1)s'\n`tabPurchase Receipt`.`posting_date` > `tabPayable Voucher`.`posting_date`",
+		'add_tab': '`tabPurchase Receipt`',
+		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Posting Date,Payable Voucher\x01Credit To,PV Detail\x01Rate,PV Detail\x01Qty,PV Detail\x01Amount,PV Detail\x01Pur Order,PV Detail\x01Pur Receipt',
+		'creation': '2010-09-01 15:47:57',
+		'criteria_name': 'Purchase in Transit',
+		'custom_query': '',
+		'description': 'List of PR whose posting date is after PV posting date',
+		'dis_filters': '`tabPurchase Receipt`.`pr_posting_date`',
+		'disabled': None,
+		'doc_type': 'PV Detail',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01From Posting Date\x01lower':'2009-04-01','Payable Voucher\x01To Posting Date\x01upper':'2010-01-11','Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':'','Payable Voucher\x01Company':'','Purchase Receipt\x01From PR Posting Date\x01lower':'2009-04-01','Purchase Receipt\x01To PR Posting Date\x01upper':'2010-01-11'}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': '',
+		'idx': None,
+		'modified': '2010-08-30 13:04:44',
+		'modified_by': 'Administrator',
+		'module': 'SRM',
+		'name': 'purchase_in_transit',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Payable Voucher',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabPayable Voucher`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
\ No newline at end of file
diff --git a/startup/__init__.py b/startup/__init__.py
new file mode 100644
index 0000000..5fd6ccd
--- /dev/null
+++ b/startup/__init__.py
@@ -0,0 +1,15 @@
+# add startup propertes
+
+add_in_head = """
+<style>
+h1, h2, h3, h4 {
+	font-family: Tahoma, Sans Serif;
+	font-weight: bold;
+}
+
+body, span, div, td, input, textarea, button, select {
+	font-family: Verdana, Arial, Sans Serif;
+}
+
+</style>
+"""
\ No newline at end of file
diff --git a/startup/startup.comp.js b/startup/startup.comp.js
new file mode 100644
index 0000000..d73fc2f
--- /dev/null
+++ b/startup/startup.comp.js
@@ -0,0 +1,75 @@
+
+if(user=='Guest'){$dh(page_body.left_sidebar);}
+var current_module;var is_system_manager=0;var module_content_dict={};var user_full_nm={};if(inList(user_roles,'System Manager'))is_system_manager=1;function startup_setup(){pscript.is_erpnext_saas=cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
+if(get_url_arg('embed')){$dh(page_body.banner_area);$dh(page_body.wntoolbar);$dh(page_body.footer);return;}
+if(user=='Guest'&&!get_url_arg('akey')){if(pscript.is_erpnext_saas){window.location.href='https://www.erpnext.com';return;}}
+$td(page_body.wntoolbar.body_tab,0,0).innerHTML='<i><b>erp</b>next</i>';$y($td(page_body.wntoolbar.body_tab,0,0),{width:'140px',color:'#FFF',paddingLeft:'8px',paddingRight:'8px',fontSize:'14px'})
+$dh(page_body.banner_area);pscript.startup_make_sidebar();$dh(page_body.footer);var callback=function(r,rt){if(r.message){login_file=r.message;}
+else{login_file='https://www.erpnext.com';}
+pscript.startup_setup_toolbar();}
+$c_obj('Home Control','get_login_url','',callback);}
+pscript.startup_make_sidebar=function(){$y(page_body.left_sidebar,{width:(100/6)+'%',paddingTop:'8px'});var callback=function(r,rt){var ml=r.message;page_body.left_sidebar.innerHTML='';for(var m=0;m<ml.length;m++){if(ml[m]){new SidebarItem(ml[m]);}}
+if(in_list(user_roles,'System Manager')){var div=$a(page_body.left_sidebar,'div','link_type',{padding:'8px',fontSize:'11px'});$(div).html('[edit]').click(pscript.startup_set_module_order)}
+nav_obj.observers.push({notify:function(t,dt,dn){pscript.select_sidebar_menu(t,dt,dn);}});var no=nav_obj.ol[nav_obj.ol.length-1];if(no&&menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
+pscript.select_sidebar_menu(decodeURIComponent(no[0]),decodeURIComponent(no[1]));}
+$c_obj('Home Control','get_modules','',callback);}
+cur_menu_pointer=null;var menu_item_map={'Form':{},'Page':{},'Report':{},'List':{}}
+pscript.select_sidebar_menu=function(t,dt,dn){if(menu_item_map[t][dt]){menu_item_map[t][dt].select();}else{if(cur_menu_pointer)
+cur_menu_pointer.deselect();}}
+var body_background='#e2e2e2';MenuPointer=function(parent,label){this.wrapper=$a(parent,'div','',{padding:'0px',cursor:'pointer',margin:'2px 0px'});$br(this.wrapper,'3px');this.tab=make_table($a(this.wrapper,'div'),1,2,'100%',['','11px'],{height:'22px',verticalAlign:'middle',padding:'0px'},{borderCollapse:'collapse',tableLayout:'fixed'});$y($td(this.tab,0,0),{padding:'0px 4px',color:'#444',whiteSpace:'nowrap'});this.tab.triangle_div=$a($td(this.tab,0,1),'div','',{borderColor:body_background+' '+body_background+' '+body_background+' '+'transparent',borderWidth:'11px',borderStyle:'solid',height:'0px',width:'0px',marginRight:'-11px'});this.label_area=$a($td(this.tab,0,0),'span','','',label);$(this.wrapper).hover(function(){if(!this.selected)$bg(this,'#eee');},function(){if(!this.selected)$bg(this,body_background);})
+$y($td(this.tab,0,0),{borderBottom:'1px solid #ddd'});}
+MenuPointer.prototype.select=function(grey){$y($td(this.tab,0,0),{color:'#fff',borderBottom:'0px solid #000'});$gr(this.wrapper,'#888','#666');this.selected=1;if(cur_menu_pointer&&cur_menu_pointer!=this)
+cur_menu_pointer.deselect();cur_menu_pointer=this;}
+MenuPointer.prototype.deselect=function(){$y($td(this.tab,0,0),{color:'#444',borderBottom:'1px solid #ddd'});$gr(this.wrapper,body_background,body_background);this.selected=0;}
+var cur_sidebar_item=null;SidebarItem=function(det){var me=this;this.det=det;this.wrapper=$a(page_body.left_sidebar,'div','',{marginRight:'12px'});this.body=$a(this.wrapper,'div');this.tab=make_table(this.body,1,2,'100%',['24px',null],{verticalAlign:'middle'},{tableLayout:'fixed'});var ic=$a($td(this.tab,0,0),'div','module-icons module-icons-'+det.module_label.toLowerCase(),{marginLeft:'3px',marginBottom:'-2px'});this.pointer=new MenuPointer($td(this.tab,0,1),det.module_label);$y($td(this.pointer.tab,0,0),{fontWeight:'bold'});if(det.module_page){menu_item_map.Page[det.module_page]=this.pointer;}
+this.items_area=$a(this.wrapper,'div');this.body.onclick=function(){me.onclick();}}
+SidebarItem.prototype.onclick=function(){var me=this;if(this.det.module_page){this.pointer.select();$item_set_working(me.pointer.label_area);loadpage(this.det.module_page,function(){$item_done_working(me.pointer.label_area);});}else{this.toggle();}}
+SidebarItem.prototype.collapse=function(){$(this.items_area).slideUp();this.is_open=0;$fg(this.pointer.label_area,'#444')}
+SidebarItem.prototype.toggle=function(){if(this.loading)return;if(this.is_open){this.collapse();}else{if(this.loaded)$(this.items_area).slideDown();else this.show_items();this.is_open=1;$fg(this.pointer.label_area,'#000')
+if(cur_sidebar_item&&cur_sidebar_item!=this){cur_sidebar_item.collapse();}
+cur_sidebar_item=this;}}
+SidebarItem.prototype.show_items=function(){this.loading=1;var me=this;$item_set_working(this.pointer.label_area);var callback=function(r,rt){me.loaded=1;me.loading=0;var smi=null;var has_reports=0;var has_tools=0;$item_done_working(me.pointer.label_area);if(r.message.il){me.il=r.message.il;for(var i=0;i<me.il.length;i++){if(me.il[i].doc_type=='Forms'){if(in_list(profile.can_read,me.il[i].doc_name)){var smi=new SidebarModuleItem(me,me.il[i]);menu_item_map['Form'][me.il[i].doc_name]=smi.pointer;menu_item_map['List'][me.il[i].doc_name]=smi.pointer;}}
+if(me.il[i].doc_type=='Reports')has_reports=1;if(in_list(['Single DocType','Pages','Setup Forms'],me.il[i].doc_type))has_tools=1;}
+if(has_reports){var smi=new SidebarModuleItem(me,{doc_name:'Reports',doc_type:'Reports'});menu_item_map['Page'][me.det.module_label+' Reports']=smi.pointer;}
+if(has_tools){var smi=new SidebarModuleItem(me,{doc_name:'Tools',doc_type:'Tools'});menu_item_map['Page'][me.det.module_label+' Tools']=smi.pointer;}
+if(r.message.custom_reports.length){me.il=add_lists(r.message.il,r.message.custom_reports);var smi=new SidebarModuleItem(me,{doc_name:'Custom Reports',doc_type:'Custom Reports'});menu_item_map['Page'][me.det.module_label+' Custom Reports']=smi.pointer;}}
+$(me.items_area).slideDown();var no=nav_obj.ol[nav_obj.ol.length-1];if(no&&menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
+pscript.select_sidebar_menu(decodeURIComponent(no[0]),decodeURIComponent(no[1]));}
+$c_obj('Home Control','get_module_details',me.det.name,callback);}
+SidebarItem.prototype.show_section=function(sec_type){var me=this;var label=this.det.module_label+' '+sec_type;var type_map={'Reports':'Reports','Custom Reports':'Custom Reports','Pages':'Tools','Single DocType':'Tools','Setup Forms':'Tools'}
+if(page_body.pages[label]){loadpage(label,null,1);}else{var page=page_body.add_page(label);this.wrapper=$a(page,'div','layout_wrapper');this.head=new PageHeader(this.wrapper,label);this.body1=$a(this.wrapper,'div','',{marginTop:'16px'});var add_link=function(det){var div=$a(me.body1,'div','',{marginBottom:'6px'});var span=$a(div,'span','link_type');span.innerHTML=det.display_name;span.det=det;if(sec_type=='Reports'||sec_type=='Custom Reports'){span.onclick=function(){loadreport(this.det.doc_name,this.det.display_name);}}else{if(det.doc_type=='Pages'){if(det.click_function){span.onclick=function(){eval(this.det.click_function)}
+span.click_function=det.click_function;}else{span.onclick=function(){loadpage(this.det.doc_name);}}}else if(det.doc_type=='Setup Forms'){span.onclick=function(){loaddocbrowser(this.det.doc_name);}}else{span.onclick=function(){loaddoc(this.det.doc_name,this.det.doc_name);}}}}
+for(var i=0;i<me.il.length;i++){if(type_map[me.il[i].doc_type]==sec_type){add_link(me.il[i]);}}
+loadpage(label,null,1);}}
+SidebarModuleItem=function(si,det){this.det=det;var me=this;this.pointer=new MenuPointer(si.items_area,get_doctype_label(det.doc_name));$y(si.items_area,{marginLeft:'32px'})
+$y($td(this.pointer.tab,0,0),{fontSize:'11px'});this.pointer.wrapper.onclick=function(){if(me.det.doc_type=='Forms')
+loaddocbrowser(det.doc_name);else
+si.show_section(me.det.doc_type);}}
+pscript.startup_set_module_order=function(){var update_order=function(ml){mdict={};for(var i=0;i<ml.length;i++){mdict[ml[i][3][3]]={'module_seq':ml[i][1],'is_hidden':(ml[i][2]?'No':'Yes')}}
+$c_obj('Home Control','set_module_order',JSON.stringify(mdict),function(r,rt){pscript.startup_make_sidebar();})}
+var callback=function(r,rt){var ml=[];for(var i=0;i<r.message.length;i++){var det=r.message[i];ml.push([det[1],det[2],(det[3]!='No'?0:1),det[0]]);}
+new ListSelector('Set Module Sequence','Select items and set the order you want them to appear'+'<br><b>Note:</b> <i>These changes will apply to all users!</i>',ml,update_order,1);}
+$c_obj('Home Control','get_module_order','',callback)}
+pscript.startup_setup_toolbar=function(){var menu_tab=page_body.wntoolbar.menu_table_right;$td(menu_tab,0,0).innerHTML='<a style="font-weight: bold; color: #FFF" href="javascript:'+"loadpage('profile-settings')"+'">'+user_fullname+'</a>';if(pscript.is_erpnext_saas){$td(menu_tab,0,1).innerHTML='<a style="font-weight: bold; color: #FFF" href="http://groups.google.com/group/erpnext-user-forum" target="_blank">Forum</a>';if(is_system_manager){$td(menu_tab,0,3).innerHTML='<a style="font-weight: bold; color: #FFF;" href="javascript:pscript.go_to_account_settings()">Billing</a>';}}
+else{$dh($td(menu_tab,0,1));$dh($td(menu_tab,0,3));}
+$td(menu_tab,0,2).innerHTML='<a style="font-weight: bold; color: #FFF" href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">Chat</a>';var cell=menu_tab.rows[0].insertCell(3);cell.innerHTML='<a style="font-weight: bold; color: #FFF" href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">Help</a>';$y(cell,page_body.wntoolbar.right_table_style);}
+pscript.go_to_account_settings=function(){callback=function(r,rt){if(r.exc){msgprint(r.exc);}
+else{msgprint('<a href="'+r.message+'" target="_blank">'
++'Click here to open Account Settings in a new page</a>')}}
+$c_page('my_company','my_company','get_account_settings_url','',callback)}
+show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);}
+else if(nm=='Accounts Browser')
+pscript.make_chart(chart_type);}
+loadpage(nm,call_back);}
+ModulePage=function(parent,module_name,module_label,help_page,callback){this.parent=parent;page_body.cur_page.module_page=this;this.wrapper=$a(parent,'div');this.module_name=module_name;this.transactions=[];this.page_head=new PageHeader(this.wrapper,module_label);if(help_page){var btn=this.page_head.add_button('Help',function(){loadpage(this.help_page)},1,'ui-icon-help')
+btn.help_page=help_page;}
+if(callback)this.callback=function(){callback();}}
+get_plural=function(str){if(str.charAt(str.length-1).toLowerCase()=='y')return str.substr(0,str.length-1)+'ies'
+else return str+'s';}
+pscript.set_user_fullname=function(ele,username,get_latest){var set_it=function(){if(ele)
+ele.innerHTML=user_full_nm[username];}
+if(get_latest){$c_obj('Home Control','get_user_fullname',username,function(r,rt){user_full_nm[username]=r.message;set_it();});}
+else{if(user_full_nm[username]){set_it();}
+else
+$c_obj('Home Control','get_user_fullname',username,function(r,rt){user_full_nm[username]=r.message;set_it();});}}
+startup_setup();
\ No newline at end of file
diff --git a/startup/startup.css b/startup/startup.css
new file mode 100644
index 0000000..f4fd39e
--- /dev/null
+++ b/startup/startup.css
@@ -0,0 +1,40 @@
+body {
+	background-color: #e2e2e2;
+}
+
+div.layout_wrapper {
+	padding: 13px;
+	margin: 7px;
+	-moz-box-shadow: 1px 1px 6px #AAA;
+	-webkit-box-shadow: 1px 1px 6px #AAA;
+	box-shadow: 1px 1px 6px #AAA;
+	background-color: #FFF;
+}
+
+#birthday_area {
+	display: none;
+	padding: 4px;
+	margin-bottom: 8px;
+	background-color: #FDD;
+	padding: 4px;
+	color: #644;
+}
+
+.module-icons {
+   background: url(images/user/module-icons.png) no-repeat top left;
+   width:16px;
+   height:16px;
+}
+
+.module-icons-accounts{ background-position: 0 0;  } 
+.module-icons-analysis{ background-position: 0 -66px;  } 
+.module-icons-buying{ background-position: 0 -132px;  } 
+.module-icons-home{ background-position: 0 -198px;  } 
+.module-icons-hr{ background-position: 0 -264px;  } 
+.module-icons-people{ background-position: 0 -330px;  } 
+.module-icons-production{ background-position: 0 -396px;  } 
+.module-icons-projects{ background-position: 0 -462px;  } 
+.module-icons-selling{ background-position: 0 -528px;  } 
+.module-icons-setup{ background-position: 0 -594px;  } 
+.module-icons-stock{ background-position: 0 -660px;  } 
+.module-icons-support{ background-position: 0 -726px;  } 
\ No newline at end of file
diff --git a/startup/startup.js b/startup/startup.js
new file mode 100644
index 0000000..3de570d
--- /dev/null
+++ b/startup/startup.js
@@ -0,0 +1,552 @@
+if(user == 'Guest'){
+  $dh(page_body.left_sidebar);
+}
+
+var current_module;
+var is_system_manager = 0;
+var module_content_dict = {};
+var user_full_nm = {};
+
+// check if session user is system manager
+if(inList(user_roles,'System Manager')) is_system_manager = 1;
+
+function startup_setup() {
+	pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
+	
+	
+	if(get_url_arg('embed')) {
+		// hide header, footer
+		$dh(page_body.banner_area);
+		$dh(page_body.wntoolbar);
+		$dh(page_body.footer);
+		return;
+	}
+
+	if(user=='Guest' && !get_url_arg('akey')) {
+		if(pscript.is_erpnext_saas) {
+			window.location.href = 'https://www.erpnext.com';
+			return;
+		}
+	}
+
+	// page structure
+	// --------------
+	$td(page_body.wntoolbar.body_tab,0,0).innerHTML = '<i><b>erp</b>next</i>';
+	$y($td(page_body.wntoolbar.body_tab,0,0), {width:'140px', color:'#FFF', paddingLeft:'8px', paddingRight:'8px', fontSize:'14px'})
+	$dh(page_body.banner_area);
+	
+	// sidebar
+	// -------
+	pscript.startup_make_sidebar();
+
+	// border to the body
+	// ------------------
+	$dh(page_body.footer);
+
+	// for logout and payment
+	var callback = function(r,rt) {
+		if(r.message){
+			login_file = r.message;
+		}
+		else {
+			
+			login_file = 'https://www.erpnext.com';
+			}
+		// setup toolbar
+		pscript.startup_setup_toolbar();
+	}
+	$c_obj('Home Control', 'get_login_url', '', callback);
+}
+
+// ====================================================================
+
+pscript.startup_make_sidebar = function() {
+	$y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
+
+	var callback = function(r,rt) {
+		// menu
+		var ml = r.message;
+		
+		// clear
+		page_body.left_sidebar.innerHTML = '';
+		
+		for(var m=0; m<ml.length; m++){
+			if(ml[m]) {
+				new SidebarItem(ml[m]);
+			}
+		}
+		if(in_list(user_roles, 'System Manager')) {
+			var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
+			$(div).html('[edit]').click(pscript.startup_set_module_order)
+		}
+		nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
+		
+		// select current
+		var no = nav_obj.ol[nav_obj.ol.length-1];
+		if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
+			pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
+	}
+	$c_obj('Home Control', 'get_modules', '', callback);	
+}
+
+// ====================================================================
+// Menu observer
+// ====================================================================
+
+cur_menu_pointer = null;
+var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
+
+pscript.select_sidebar_menu = function(t, dt, dn) {
+	// get menu item
+	if(menu_item_map[t][dt]) {			
+		// select
+		menu_item_map[t][dt].select();
+	} else {
+		// none found :-( Unselect
+		if(cur_menu_pointer)
+			cur_menu_pointer.deselect();		
+	}
+}
+
+// ====================================================================
+// Menu pointer
+// ====================================================================
+
+var body_background = '#e2e2e2';
+
+MenuPointer = function(parent, label) {
+
+	this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'}); 
+	$br(this.wrapper, '3px');
+		
+	this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px', 
+		verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
+
+	$y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
+	
+	// triangle border (?)
+	this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
+		borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent', 
+		borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
+	
+	this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
+
+	$(this.wrapper)
+		.hover(
+			function() { if(!this.selected)$bg(this, '#eee'); } ,
+			function() { if(!this.selected)$bg(this, body_background); }
+		)
+		
+	$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
+
+}
+
+// ====================================================================
+
+MenuPointer.prototype.select = function(grey) {
+	$y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
+	//$gr(this.wrapper, '#F84', '#F63');
+	$gr(this.wrapper, '#888', '#666');
+	this.selected = 1;
+
+	if(cur_menu_pointer && cur_menu_pointer != this)
+		cur_menu_pointer.deselect();
+	
+	cur_menu_pointer = this;
+}
+
+// ====================================================================
+
+MenuPointer.prototype.deselect = function() {
+	$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'}); 
+	$gr(this.wrapper, body_background, body_background);
+	this.selected = 0;
+}
+
+
+// ====================================================================
+// Sidebar Item
+// ====================================================================
+
+var cur_sidebar_item = null;
+
+SidebarItem = function(det) {
+	var me = this;
+	this.det = det;
+	this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
+
+	this.body = $a(this.wrapper, 'div');
+	this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
+	
+	// icon
+	var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
+
+	// pointer table
+	this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label); 
+	$y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
+	
+	// for page type
+	if(det.module_page) {
+		menu_item_map.Page[det.module_page] = this.pointer;
+	}
+	
+	// items area
+	this.items_area = $a(this.wrapper, 'div');
+
+	this.body.onclick = function() { me.onclick(); }
+}
+
+// ====================================================================
+
+SidebarItem.prototype.onclick = function() {
+	var me = this;
+
+	if(this.det.module_page) {
+		// page type
+		this.pointer.select();
+		
+		$item_set_working(me.pointer.label_area);
+		loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
+		
+	} else {
+		// show sub items
+		this.toggle();
+	}	
+}
+
+// ====================================================================
+
+SidebarItem.prototype.collapse = function() {
+	$(this.items_area).slideUp();
+	this.is_open = 0;
+	$fg(this.pointer.label_area, '#444')
+}
+
+// ====================================================================
+
+SidebarItem.prototype.toggle = function() {
+	if(this.loading) return;
+	
+	if(this.is_open) {
+		this.collapse();
+	} else {
+		if(this.loaded) $(this.items_area).slideDown();
+		else this.show_items();
+		this.is_open = 1;
+		$fg(this.pointer.label_area, '#000')
+		//this.pointer.select(1);
+		
+		// close existing open
+		if(cur_sidebar_item && cur_sidebar_item != this) {
+			cur_sidebar_item.collapse();
+		}
+		cur_sidebar_item = this;
+	}
+}
+
+// ====================================================================
+
+SidebarItem.prototype.show_items = function() {
+	this.loading = 1;
+	var me = this;
+	
+	$item_set_working(this.pointer.label_area);
+	var callback = function(r,rt){
+		me.loaded = 1;
+		me.loading = 0;
+		var smi = null;
+		var has_reports = 0;
+		var has_tools = 0;
+		
+		// widget code
+		$item_done_working(me.pointer.label_area);
+		
+		if(r.message.il) {
+			me.il = r.message.il;
+
+			// forms
+			for(var i=0; i<me.il.length;i++){
+				if(me.il[i].doc_type == 'Forms') {
+					if(in_list(profile.can_read, me.il[i].doc_name)) {
+						var smi = new SidebarModuleItem(me, me.il[i]);
+	
+						menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
+						menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
+					}
+				}
+				if(me.il[i].doc_type=='Reports') has_reports = 1;
+				if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;				
+			}
+			// reports
+			if(has_reports) {
+				var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
+
+				// add to menu-item mapper
+				menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
+			}
+
+			// tools
+			if(has_tools) {
+				var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
+
+				// add to menu-item mapper
+				menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
+			}
+			
+			// custom reports
+			if(r.message.custom_reports.length) {
+				me.il = add_lists(r.message.il, r.message.custom_reports);
+				var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
+
+				// add to menu-item mapper
+				menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
+
+			}
+	
+		}
+		$(me.items_area).slideDown();
+
+		// high light
+		var no = nav_obj.ol[nav_obj.ol.length-1];
+		if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
+			pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
+		
+	}
+	
+	$c_obj('Home Control', 'get_module_details', me.det.name, callback);
+}
+
+// ====================================================================
+// Show Reports
+// ====================================================================
+
+SidebarItem.prototype.show_section = function(sec_type) {
+	var me = this;
+	var label = this.det.module_label + ' ' + sec_type;
+	var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports', 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
+	
+	if(page_body.pages[label]) {
+		loadpage(label, null, 1);
+	} else {
+		// make the reports page
+		var page = page_body.add_page(label);
+		this.wrapper = $a(page,'div','layout_wrapper');
+
+		
+		// head
+		this.head = new PageHeader(this.wrapper, label);
+		
+		// body
+		this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
+
+		// add a report link
+		var add_link = function(det) {
+			var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
+			var span = $a(div, 'span', 'link_type');
+			
+			// tag the span
+			span.innerHTML = det.display_name; span.det = det;
+			if(sec_type=='Reports' || sec_type=='Custom Reports') {
+				// Reports
+				// -------
+				span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
+				
+			} else {
+				// Tools
+				// -----
+				
+				if(det.doc_type=='Pages') {
+					// Page
+					if(det.click_function) {
+						span.onclick = function() { eval(this.det.click_function) }
+						span.click_function = det.click_function;
+					} else {
+						span.onclick = function() { loadpage(this.det.doc_name); }
+					}
+				} else if(det.doc_type=='Setup Forms') {
+					// Doc Browser
+					span.onclick = function() { loaddocbrowser(this.det.doc_name); }				
+				} else {
+					// Single
+					span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }				
+				}
+			}
+		}
+		
+		// item list
+		for(var i=0; i<me.il.length;i++){
+			if(type_map[me.il[i].doc_type] == sec_type) {
+				add_link(me.il[i]);	
+			}
+		}
+		loadpage(label, null, 1);
+	}
+}
+
+
+// ====================================================================
+// Sidebar module item
+// ====================================================================
+
+SidebarModuleItem = function(si, det) {
+	this.det = det;
+	var me= this;
+	
+	this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name)); 
+	$y(si.items_area, {marginLeft:'32px'})
+	$y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
+			
+	this.pointer.wrapper.onclick = function() {
+		if(me.det.doc_type=='Forms')
+			loaddocbrowser(det.doc_name);
+		else
+			si.show_section(me.det.doc_type);
+	}
+}
+
+
+// ====================================================================
+// Drag & Drop order selection
+// ====================================================================
+
+pscript.startup_set_module_order = function() {
+	var update_order= function(ml) {
+		mdict = {};
+		for(var i=0; i<ml.length; i++) {
+			mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
+		}
+		$c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
+	}
+	
+	var callback = function(r, rt) {
+		var ml = [];
+		for(var i=0; i<r.message.length; i++) { 
+			var det = r.message[i];
+			ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
+		}
+		new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
+			'<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
+	}
+	$c_obj('Home Control', 'get_module_order', '', callback)
+	
+}
+
+// ====================================================================
+
+pscript.startup_setup_toolbar = function() {
+  var menu_tab = page_body.wntoolbar.menu_table_right;
+	// Profile
+  // ---------
+  $td(menu_tab,0,0).innerHTML = '<a style="font-weight: bold; color: #FFF" href="javascript:'+"loadpage('profile-settings')"+'">'+user_fullname+'</a>';
+	
+	if(pscript.is_erpnext_saas){
+		// Help
+  	// --------------
+		//var help_url = login_file + '#!helpdesk'
+		$td(menu_tab,0,1).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://groups.google.com/group/erpnext-user-forum" target="_blank">Forum</a>';
+
+		// Manage account
+		// --------------
+		if(is_system_manager) {
+			$td(menu_tab,0,3).innerHTML = '<a style="font-weight: bold; color: #FFF;" href="javascript:pscript.go_to_account_settings()">Billing</a>';
+		}
+	}
+	else{
+		$dh($td(menu_tab,0,1));
+		$dh($td(menu_tab,0,3));
+	}
+
+	// Live Chat Help
+	// --------------
+	$td(menu_tab,0,2).innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">Chat</a>';
+
+	// help
+	// ----
+	var cell = menu_tab.rows[0].insertCell(3);
+	cell.innerHTML = '<a style="font-weight: bold; color: #FFF" href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">Help</a>';
+	$y(cell, page_body.wntoolbar.right_table_style);
+
+}
+
+// ====================================================================
+
+pscript.go_to_account_settings = function() {
+	callback = function(r, rt) {
+		if(r.exc) { msgprint(r.exc); }
+		else { msgprint('<a href="' + r.message + '" target="_blank">'
+			+ 'Click here to open Account Settings in a new page</a>') }
+	}
+	$c_page('my_company', 'my_company', 'get_account_settings_url', '', callback)
+}
+
+// chart of accounts
+// ====================================================================
+show_chart_browser = function(nm, chart_type){
+
+  var call_back = function(){
+    if(nm == 'Sales Browser'){
+      var sb_obj = new SalesBrowser();
+      sb_obj.set_val(chart_type);   
+    }
+    else if(nm == 'Accounts Browser')
+      pscript.make_chart(chart_type);
+  }
+  loadpage(nm,call_back);
+}
+
+
+// Module Page
+// ====================================================================
+
+ModulePage = function(parent, module_name, module_label, help_page, callback) {
+	this.parent = parent;
+
+	// add to current page
+	page_body.cur_page.module_page = this;
+
+	this.wrapper = $a(parent,'div');
+	this.module_name = module_name;
+	this.transactions = [];
+	this.page_head = new PageHeader(this.wrapper, module_label);
+
+	if(help_page) {
+		var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
+		btn.help_page = help_page;
+	}
+	
+	if(callback) this.callback = function(){ callback(); }
+}
+
+
+// get plural
+// ====================================================================
+
+get_plural = function(str){
+	if(str.charAt(str.length-1).toLowerCase() == 'y')	return str.substr(0, str.length-1) + 'ies'
+	else return str + 's';
+}
+
+// set user fullname
+// ====================================================================
+pscript.set_user_fullname = function(ele,username,get_latest){
+	
+	var set_it = function(){
+		if(ele)
+			ele.innerHTML = user_full_nm[username];
+	}
+	
+	if(get_latest){
+		$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
+	}
+	else{
+		if(user_full_nm[username]){
+			set_it();
+		}
+		
+		else
+			$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
+	}
+}
+
+// ====================================================================
+startup_setup();
diff --git a/tools/Module Def/Tools/Tools.txt b/tools/Module Def/Tools/Tools.txt
new file mode 100644
index 0000000..428f079
--- /dev/null
+++ b/tools/Module Def/Tools/Tools.txt
@@ -0,0 +1,358 @@
+[
+	{
+		'_last_update': None,
+		'creation': '2010-11-30 22:45:03',
+		'disabled': 'Yes',
+		'docstatus': 0,
+		'doctype': 'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': '2011-02-12 11:57:57',
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module_desc': None,
+		'module_icon': 'id_card.png',
+		'module_label': 'Organize',
+		'module_name': 'Tools',
+		'module_page': 'Organize',
+		'module_seq': 3,
+		'name': 'Tools',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:45:03',
+		'description': 'Shared Calendar of important events, reminders',
+		'display_name': 'Calendar',
+		'doc_name': '_calendar',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'calendar.gif',
+		'idx': 1,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00252',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:45:03',
+		'description': 'Manage your contact details',
+		'display_name': 'Manage Contacts',
+		'doc_name': 'Contact Page',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'table.gif',
+		'idx': 2,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00253',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:45:03',
+		'description': 'Standardized business letters',
+		'display_name': 'Business Letters',
+		'doc_name': 'Business Letter',
+		'doc_type': 'Forms',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': 'to_contact\ntemplate',
+		'hide': None,
+		'icon': 'page.gif',
+		'idx': 3,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00254',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:45:03',
+		'description': 'Online storage of files in a folder structure that you can share with your users',
+		'display_name': 'File Uploads',
+		'doc_name': 'File Browser',
+		'doc_type': 'Pages',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': 'folder.gif',
+		'idx': 4,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00255',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'click_function': None,
+		'creation': '2010-11-30 22:45:03',
+		'description': None,
+		'display_name': 'SMS Center',
+		'doc_name': 'SMS Center',
+		'doc_type': 'Single DocType',
+		'docstatus': 0,
+		'doctype': 'Module Def Item',
+		'fields': None,
+		'hide': None,
+		'icon': None,
+		'idx': 5,
+		'modified': '2011-03-24 15:04:47',
+		'modified_by': 'Administrator',
+		'name': 'MDI00256',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00059',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts User'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 2,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00060',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Accounts Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 3,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00061',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'HR User'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 4,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00062',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'HR Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 5,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00063',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material User'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 6,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00064',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 7,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00065',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Material Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 8,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00066',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase User'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 9,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00067',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 10,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00068',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Purchase Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 11,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00069',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Production User'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 12,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00070',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Production Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 13,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00071',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'System Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 14,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00072',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales User'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 15,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00073',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Master Manager'
+	},
+	{
+		'creation': '2010-11-30 22:45:03',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 16,
+		'modified': '2010-11-30 22:45:03',
+		'modified_by': 'Administrator',
+		'name': 'MDR00074',
+		'owner': 'Administrator',
+		'parent': 'Tools',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'Sales Manager'
+	}
+]
\ No newline at end of file
diff --git a/tools/__init__.py b/tools/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/__init__.py
diff --git a/tools/doctype/__init__.py b/tools/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/__init__.py
diff --git a/tools/doctype/activity_dashboard_control/__init__.py b/tools/doctype/activity_dashboard_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/activity_dashboard_control/__init__.py
diff --git a/tools/doctype/activity_dashboard_control/activity_dashboard_control.py b/tools/doctype/activity_dashboard_control/activity_dashboard_control.py
new file mode 100644
index 0000000..fde7552
--- /dev/null
+++ b/tools/doctype/activity_dashboard_control/activity_dashboard_control.py
@@ -0,0 +1,95 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+    def __init__(self, doc, doclist=[]):
+        self.doc = doc
+        self.doclist = doclist
+    
+    
+    # get dashboard counts
+    # --------------------
+    def get_dashboard_counts(self, dt):
+        dtl = eval(dt)
+        dt = {}
+        
+        for d in dtl:
+            # if Lead
+            if d=='Lead':
+                dt[d] = {'To follow up':sql("select count(name) from tabLead where status!='Converted' and docstatus=1")[0][0] or 0}
+                
+            # if Enquiry
+            elif d=='Enquiries':
+                args = {}
+                args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no!=t2.name and t2.docstatus=1")[0][0] or 0
+                args['To follow up'] = sql("select count(name) from `tabQuotation` where docstatus=0")[0][0] or 0       #Draft
+                dt[d] = args
+                
+            # if Sales Order
+            elif d=='Sales Order':
+                args = {}
+                args['To be delivered'] = sql("select count(name) from `tabSales Order` where per_delivered<100 and delivery_date>now() and docstatus=1")[0][0] or 0
+                args['To be billed'] = sql("select count(name) from `tabSales Order` where per_billed<100 and docstatus=1")[0][0] or 0  
+                args['Overdue'] = sql("select count(name) from `tabSales Order` where per_delivered<100 and delivery_date<now() and docstatus=1")[0][0] or 0
+                args['To be submitted'] = sql("select count(name) from `tabSales Order` where status='Draft'")[0][0] or 0       #Draft
+                dt[d] = args
+            
+            # if Invoice
+            elif d=='Invoices':
+                args = {}
+                args['To receive payment'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date>now() and outstanding_amount!=0")[0][0] or 0
+                args['Overdue'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date<now() and outstanding_amount!=0")[0][0] or 0  
+                args['To be submitted'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=0")[0][0] or 0       #Draft
+                dt[d] = args
+            
+            # if Indent 
+            elif d=='Indent':
+                args = {}
+                args['Purchase Order to be made'] = sql("select count(name) from `tabIndent` where per_ordered<100 and docstatus=1")[0][0] or 0
+                args['To be submitted'] = sql("select count(name) from `tabIndent` where status='Draft'")[0][0] or 0       #Draft
+                dt[d] = args
+                
+            # if Purchase Order    
+            elif d=='Purchase Order':
+                args = {}
+                args['To receive items'] = sql("select count(name) from `tabPurchase Order` where per_received<100 and docstatus=1")[0][0] or 0
+                args['To be billed'] = sql("select count(name) from `tabPurchase Order` where per_billed<100 and docstatus=1")[0][0] or 0
+                args['To be submitted'] = sql("select count(name) from `tabPurchase Order` where status='Draft'")[0][0] or 0        #Draft
+                dt[d] = args
+            
+            # if Bills
+            elif d=='Bills':
+                args = {}
+                args['To be payed'] = sql("select count(name) from `tabPayable Voucher` where docstatus=1 and outstanding_amount!=0")[0][0] or 0
+                args['To be submitted'] = sql("select count(name) from `tabPayable Voucher` where docstatus=0")[0][0] or 0       #Draft
+                dt[d] = args
+                
+            # if Tasks
+            elif d=='Tasks':
+                dt[d] = {'Open': sql("select count(name) from `tabTicket` where status='Open'")[0][0] or 0}
+                
+            # if Maintenance
+            elif d=='Serial No':
+              args = {}
+              args['AMC to expire this month'] = sql("select count(name) from `tabSerial No` where docstatus=1 and month(getdate()) = month(amc_expiry_date) and year(getdate()) = year(amc_expiry_date)")[0][0] or 0
+              args['Warranty to expire this month'] = ql("select count(name) from `tabSerial No` where docstatus=1 and month(getdate()) = month(warranty_expiry_date) and year(getdate())=year(warranty_expiry_date)")[0][0] or 0
+              dt[d] = args
+              
+        msgprint(dt)
+        return dt
\ No newline at end of file
diff --git a/tools/doctype/activity_dashboard_control/activity_dashboard_control.txt b/tools/doctype/activity_dashboard_control/activity_dashboard_control.txt
new file mode 100644
index 0000000..e55656d
--- /dev/null
+++ b/tools/doctype/activity_dashboard_control/activity_dashboard_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-29 14:44:17', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 43, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'nabin@webnotestech.com', 'document_type': None, 'name': 'Activity Dashboard Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/tools/doctype/address/__init__.py b/tools/doctype/address/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/address/__init__.py
diff --git a/tools/doctype/address/address.comp.js b/tools/doctype/address/address.comp.js
new file mode 100644
index 0000000..0f6be69
--- /dev/null
+++ b/tools/doctype/address/address.comp.js
@@ -0,0 +1,2 @@
+
+cur_frm.cscript.onload=function(doc,cdt,cdn){if(doc.customer)cur_frm.add_fetch('customer','customer_name','customer_name');if(doc.supplier)cur_frm.add_fetch('supplier','supplier_name','supplier_name');}
\ No newline at end of file
diff --git a/tools/doctype/address/address.js b/tools/doctype/address/address.js
new file mode 100644
index 0000000..aa1d871
--- /dev/null
+++ b/tools/doctype/address/address.js
@@ -0,0 +1,5 @@
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+	if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
+	if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
+}
+
diff --git a/tools/doctype/address/address.py b/tools/doctype/address/address.py
new file mode 100644
index 0000000..dc17743
--- /dev/null
+++ b/tools/doctype/address/address.py
@@ -0,0 +1,56 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.model.doc import Document
+from webnotes import session, form, msgprint, errprint
+
+sql = webnotes.conn.sql
+  
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def autoname(self):
+    if self.doc.customer:
+      self.doc.name = self.doc.customer + '-' + self.doc.address_type
+    elif self.doc.supplier:
+      self.doc.name = self.doc.supplier + '-' + self.doc.address_type
+    elif self.doc.sales_partner:
+      self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
+      
+    # filter out bad characters in name
+    self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
+
+#----------------------
+# Call to Validate
+#----------------------
+  def validate(self):
+    self.validate_primary_address()
+    self.validate_shipping_address()
+
+#----------------------
+# Validate that there can only be one primary address for particular customer, supplier
+#----------------------
+  def validate_primary_address(self):
+    if self.doc.is_primary_address == 1:
+      if self.doc.customer: 
+        sql("update tabAddress set is_primary_address=0 where customer = '%s'" % (self.doc.customer))
+      elif self.doc.supplier:
+        sql("update tabAddress set is_primary_address=0 where supplier = '%s'" % (self.doc.supplier))
+      elif self.doc.sales_partner:
+        sql("update tabAddress set is_primary_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
+        
+#----------------------
+# Validate that there can only be one shipping address for particular customer, supplier
+#----------------------
+  def validate_shipping_address(self):
+    if self.doc.is_shipping_address == 1:
+      if self.doc.customer: 
+        sql("update tabAddress set is_shipping_address=0 where customer = '%s'" % (self.doc.customer))
+      elif self.doc.supplier:
+        sql("update tabAddress set is_shipping_address=0 where supplier = '%s'" % (self.doc.supplier))      
+      elif self.doc.sales_partner:
+        sql("update tabAddress set is_shipping_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))      
diff --git a/tools/doctype/address/address.txt b/tools/doctype/address/address.txt
new file mode 100644
index 0000000..ee23f82
--- /dev/null
+++ b/tools/doctype/address/address.txt
@@ -0,0 +1,802 @@
+[
+	{
+		'_last_update': '1306307668',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': 1,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'module': 'Tools',
+		'name': 'Address',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': None,
+		'tag_fields': None,
+		'use_template': None,
+		'version': 41
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-05-25 12:59:30',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'PERM00884',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Address Details',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05072',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': '<em>e.g. Office, Billing, Shipping</em>',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_type',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Address Type',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05073',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_line1',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Address Line1',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05074',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'address_line2',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Address Line2',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05075',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'city',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'City/Town',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05076',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Suggest',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'pincode',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Pincode',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05077',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 1,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'country',
+		'fieldtype': 'Select',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Country',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05078',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'link:Country',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'state',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'State',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05079',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Suggest',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': 0,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05080',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'phone',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Phone',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05081',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': 'Email Id',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05082',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'fax',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Fax',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05083',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:30',
+		'default': None,
+		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05084',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Customer',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:31',
+		'default': None,
+		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05085',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:31',
+		'default': None,
+		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Supplier',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05086',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:31',
+		'default': None,
+		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Supplier Name',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05087',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:31',
+		'default': None,
+		'depends_on': 'eval:!doc.customer && !doc.supplier',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_partner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Sales Partner',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05088',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Sales Partner',
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:31',
+		'default': '0',
+		'depends_on': None,
+		'description': 'Check to make primary address',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_primary_address',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 18,
+		'in_filter': None,
+		'label': 'Is Primary Address',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05089',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-25 12:59:31',
+		'default': '0',
+		'depends_on': None,
+		'description': 'Check to make Shipping Address',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_shipping_address',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 19,
+		'in_filter': None,
+		'label': 'Is Shipping Address',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05090',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-25 12:59:31',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 20,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-26 17:45:25',
+		'modified_by': 'Administrator',
+		'name': 'FL05091',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Address',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/tools/doctype/business_letter/__init__.py b/tools/doctype/business_letter/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/business_letter/__init__.py
diff --git a/tools/doctype/business_letter/business_letter.js b/tools/doctype/business_letter/business_letter.js
new file mode 100644
index 0000000..35abc0f
--- /dev/null
+++ b/tools/doctype/business_letter/business_letter.js
@@ -0,0 +1,38 @@
+$import(Tips Common)
+
+cur_frm.fields_dict['template'].get_query=function(doc,cdt,cdn){
+  return "SELECT `tabBusiness Letter Template`.name FROM `tabBusiness Letter Template` WHERE `tabBusiness Letter Template`.letter_type='"+doc.letter_type+"' AND `tabBusiness Letter Template`.name like '%s' LIMIT 50"
+}
+
+cur_frm.cscript.template = function(doc,cdt,cdn){
+  //set title as like template
+  doc.title = doc.template;
+  refresh_field('title');
+
+  //set print heading as title 
+  cur_frm.pformat.print_heading=doc.title;
+  cur_frm.pformat.print_subheading = ' ';
+
+  //call set_content function to pull content as per template selected
+  $c_obj([doc], 'set_content', '',function(r, rt) { refresh_field('content');});
+}
+
+cur_frm.cscript.title= function(doc,cdt,cdn){
+  //set print heading on title change
+  cur_frm.pformat.print_heading=doc.title;
+  cur_frm.pformat.print_subheading = ' ';
+}
+
+cur_frm.cscript.refresh= function(doc,cdt,cdn){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  //set print heading on refresh
+  cur_frm.pformat.print_heading=doc.title;
+  cur_frm.pformat.print_subheading = ' ';
+}
+
+cur_frm.cscript.onload= function(doc,cdt,cdn){
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+  //set print heading
+  cur_frm.pformat.print_heading=doc.title;
+  cur_frm.pformat.print_subheading = ' ';
+}
diff --git a/tools/doctype/business_letter/business_letter.py b/tools/doctype/business_letter/business_letter.py
new file mode 100644
index 0000000..47de45c
--- /dev/null
+++ b/tools/doctype/business_letter/business_letter.py
@@ -0,0 +1,29 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  #init function
+  def __init__(self,doc,doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def set_content(self):
+    ret_content = sql("select content from `tabBusiness Letter Template` where name ='%s'"%self.doc.template)
+    if ret_content: self.doc.content = ret_content[0][0]
+    return ''
\ No newline at end of file
diff --git a/tools/doctype/business_letter/business_letter.txt b/tools/doctype/business_letter/business_letter.txt
new file mode 100644
index 0000000..7be0aba
--- /dev/null
+++ b/tools/doctype/business_letter/business_letter.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 11:10:52', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'Letter/.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': 'Master', 'name': 'Business Letter', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-22 10:37:10', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': 1, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00843', 'parent': 'Business Letter', 'read': 1, 'create': 1, 'creation': '2010-04-20 11:10:52', 'modified': '2010-10-22 10:37:10', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': 'owner', 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00844', 'parent': 'Business Letter', 'read': 1, 'create': 1, 'creation': '2010-04-20 11:10:52', 'modified': '2010-10-22 10:37:10', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-20 11:10:52', 'doctype': 'DocField', 'oldfieldname': 'letter_type', 'owner': 'harshada@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Letter Type', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04796', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-22 10:37:10', 'parenttype': 'DocType', 'fieldname': 'letter_type', 'fieldtype': 'Select', 'options': 'link:Business Letter Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-20 11:10:52', 'doctype': 'DocField', 'oldfieldname': 'template', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Template', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04797', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-22 10:37:10', 'parenttype': 'DocType', 'fieldname': 'template', 'fieldtype': 'Link', 'options': 'Business Letter Template', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-20 11:10:52', 'doctype': 'DocField', 'oldfieldname': 'to_contact', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'To Contact', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04798', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-22 10:37:10', 'parenttype': 'DocType', 'fieldname': 'to_contact', 'fieldtype': 'Link', 'options': 'Contact', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 11:42:39', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': 1, 'modified_by': 'harshada@webnotestech.com', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04800', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-10-22 10:37:10', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2010-04-20 11:10:52', 'doctype': 'DocField', 'oldfieldname': 'content', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Content', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04799', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-10-22 10:37:10', 'parenttype': 'DocType', 'fieldname': 'content', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/business_letter_template/__init__.py b/tools/doctype/business_letter_template/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/business_letter_template/__init__.py
diff --git a/tools/doctype/business_letter_template/business_letter_template.js b/tools/doctype/business_letter_template/business_letter_template.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/tools/doctype/business_letter_template/business_letter_template.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/tools/doctype/business_letter_template/business_letter_template.txt b/tools/doctype/business_letter_template/business_letter_template.txt
new file mode 100644
index 0000000..90af060
--- /dev/null
+++ b/tools/doctype/business_letter_template/business_letter_template.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 11:06:16', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:title', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Business Letter Template', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00840', 'parent': 'Business Letter Template', 'read': 1, 'create': 1, 'creation': '2010-04-20 11:06:16', 'modified': '2010-09-20 09:03:29', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00841', 'parent': 'Business Letter Template', 'read': 1, 'create': None, 'creation': '2010-04-20 11:06:16', 'modified': '2010-09-20 09:03:29', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 11:06:16', 'doctype': 'DocField', 'oldfieldname': 'title', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Title', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04792', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:29', 'parenttype': 'DocType', 'fieldname': 'title', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-20 11:06:16', 'doctype': 'DocField', 'oldfieldname': 'letter_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Letter Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04794', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:29', 'parenttype': 'DocType', 'fieldname': 'letter_type', 'fieldtype': 'Link', 'options': 'Business Letter Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2010-04-20 11:06:16', 'doctype': 'DocField', 'oldfieldname': 'content', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Content', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04793', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:29', 'parenttype': 'DocType', 'fieldname': 'content', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/business_letter_type/__init__.py b/tools/doctype/business_letter_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/business_letter_type/__init__.py
diff --git a/tools/doctype/business_letter_type/business_letter_type.js b/tools/doctype/business_letter_type/business_letter_type.js
new file mode 100644
index 0000000..fe1457d
--- /dev/null
+++ b/tools/doctype/business_letter_type/business_letter_type.js
@@ -0,0 +1,10 @@
+$import(Tips Common)
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  cur_frm.cscript.get_tips(doc, cdt, cdn);
+}
\ No newline at end of file
diff --git a/tools/doctype/business_letter_type/business_letter_type.txt b/tools/doctype/business_letter_type/business_letter_type.txt
new file mode 100644
index 0000000..38a11b8
--- /dev/null
+++ b/tools/doctype/business_letter_type/business_letter_type.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 11:03:59', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:letter_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Business Letter Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00839', 'parent': 'Business Letter Type', 'read': 1, 'create': 1, 'creation': '2010-04-20 11:03:59', 'modified': '2010-09-20 09:03:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00842', 'parent': 'Business Letter Type', 'read': 1, 'create': None, 'creation': '2010-04-20 11:06:28', 'modified': '2010-09-20 09:03:40', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 2, 'parenttype': 'DocType', 'role': 'All', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-20 11:03:59', 'doctype': 'DocField', 'oldfieldname': 'letter_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Letter Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Business Letter Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04791', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:03:40', 'parenttype': 'DocType', 'fieldname': 'letter_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/contact/__init__.py b/tools/doctype/contact/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/contact/__init__.py
diff --git a/tools/doctype/contact/contact.js b/tools/doctype/contact/contact.js
new file mode 100644
index 0000000..bca1615
--- /dev/null
+++ b/tools/doctype/contact/contact.js
@@ -0,0 +1,54 @@
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+	if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
+	if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
+}
+/*
+//---------- on refresh ----------------------
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+	
+}
+
+
+//------------- Trigger on customer ---------------------
+cur_frm.cscript.is_customer = function(doc,cdt,cdn){
+	if(!doc.is_customer){
+		doc.customer = doc.customer_name = doc.customer_address = doc.customer_group = '';
+		refresh_many(['customer','customer_name','customer_address','customer_group']);
+	}
+}
+
+//------------- Trigger on supplier -----------------------
+cur_frm.cscript.is_supplier = function(doc,cdt,cdn){
+	if(!doc.is_supplier){
+		doc.supplier = doc.supplier_name = doc.supplier_address = doc.supplier_type = ''; 
+		refresh_many(['supplier','supplier_address','supplier_name','supplier_type']);
+	}
+}
+	
+//--------------- Trigger on sales partner ---------------------
+cur_frm.cscript.is_sales_partner = function(doc,cdt,cdn){
+	if(!doc.is_sales_partner){
+		doc.sales_partner = doc.sales_partner_address = doc.partner_type = '';
+		refresh_many(['sales_partner','sales_partner_address','partner_type']);
+	}
+}
+
+//----------- Trigger on supplier name ------------------------
+cur_frm.cscript.supplier = function(doc,cdt,cdn){
+	arg = {'dt':'Supplier','dn':doc.supplier,'nm':'supplier_name','fld':'supplier_address','type':'supplier_type'};
+	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
+}
+
+//------------ Trigger on customer name ------------------------
+cur_frm.cscript.customer = function(doc,cdt,cdn){
+	arg = {'dt':'Customer','dn':doc.customer,'nm':'customer_name','fld':'customer_address','type':'customer_group'};
+	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
+}
+
+//------------ Trigger on sales partner ------------------------
+cur_frm.cscript.sales_partner = function(doc,cdt,cdn){
+	arg = {'dt':'Sales Partner','dn':doc.sales_partner,'nm':'partner_name','fld':'sales_partner_address','type':'partner_type'};
+	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
+}
+*/
diff --git a/tools/doctype/contact/contact.py b/tools/doctype/contact/contact.py
new file mode 100644
index 0000000..7498619
--- /dev/null
+++ b/tools/doctype/contact/contact.py
@@ -0,0 +1,43 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.model.doc import Document
+from webnotes import session, form, msgprint, errprint
+
+sql = webnotes.conn.sql
+  
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  def autoname(self):
+    if self.doc.customer:
+      self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
+    elif self.doc.supplier:
+      self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
+    elif self.doc.sales_partner:
+      self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner  
+    
+    # filter out bad characters in name
+    self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','')      
+
+#----------------------
+# Call to Validate
+#----------------------
+  def validate(self):
+    self.validate_primary_contact()
+
+#----------------------
+# Validate that there can only be one primary contact for particular customer, supplier
+#----------------------
+  def validate_primary_contact(self):
+    if self.doc.is_primary_contact == 1:
+      if self.doc.customer:
+        sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
+      elif self.doc.supplier:
+        sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))  
+      elif self.doc.sales_partner:
+        sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))  
diff --git a/tools/doctype/contact/contact.txt b/tools/doctype/contact/contact.txt
new file mode 100644
index 0000000..81a97a3
--- /dev/null
+++ b/tools/doctype/contact/contact.txt
@@ -0,0 +1,786 @@
+[
+	{
+		'_last_update': '1306748466',
+		'_user_tags': None,
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:55',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': 'Master',
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': 1,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'module': 'Tools',
+		'name': 'Contact',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'subject': '%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
+		'tag_fields': None,
+		'use_template': None,
+		'version': 245
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-10-27 14:40:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'PERM00721',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-10-27 14:40:07',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'PERM00722',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase User',
+		'submit': None,
+		'write': None
+	},
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 3,
+		'match': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'PERM00125',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 4,
+		'match': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'PERM00128',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Purchase Master Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:08:55',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 5,
+		'match': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'PERM00129',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'System Manager',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-27 18:28:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Section Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Contact Details',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL04808',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Section Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-27 18:28:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL04809',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'first_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'First Name',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL00758',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'first_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'last_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Last Name',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL00759',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'last_name',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-09-01 15:47:57',
+		'default': None,
+		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Customer',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL03855',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'customer',
+		'oldfieldtype': 'Link',
+		'options': 'Customer',
+		'owner': 'harshada@webnotestech.com',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-17 14:03:55',
+		'default': None,
+		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'customer_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Customer Name',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': '000001020',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-25 18:42:39',
+		'default': None,
+		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Supplier',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': '000000574',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Supplier',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': 'Client',
+		'width': None
+	},
+	{
+		'allow_on_submit': 0,
+		'colour': 'White:FFF',
+		'creation': '2011-05-17 14:03:55',
+		'default': None,
+		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'supplier_name',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Supplier Name',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': '000001021',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-17 14:43:27',
+		'default': None,
+		'depends_on': 'eval:!doc.customer && !doc.supplier',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'sales_partner',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'Sales Partner',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': '000001030',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Sales Partner',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:08:56',
+		'default': '0',
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'is_primary_contact',
+		'fieldtype': 'Check',
+		'hidden': None,
+		'icon': None,
+		'idx': 10,
+		'in_filter': None,
+		'label': 'Is Primary Contact',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL00776',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'is_primary_contact',
+		'oldfieldtype': 'Select',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-27 18:28:50',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': None,
+		'fieldtype': 'Column Break',
+		'hidden': None,
+		'icon': None,
+		'idx': 11,
+		'in_filter': None,
+		'label': None,
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL04810',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': 'Column Break',
+		'options': None,
+		'owner': 'ashwini@webnotestech.com',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': '50%'
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'email_id',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 12,
+		'in_filter': None,
+		'label': 'Email Id',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL00779',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'email_id',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'phone',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 13,
+		'in_filter': None,
+		'label': 'Phone',
+		'modified': '2011-05-30 16:34:29',
+		'modified_by': 'Administrator',
+		'name': 'FL00778',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'contact_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': 1,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:56',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'mobile_no',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 14,
+		'in_filter': None,
+		'label': 'Mobile No',
+		'modified': '2011-05-30 16:34:30',
+		'modified_by': 'Administrator',
+		'name': 'FL00780',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'mobile_no',
+		'oldfieldtype': 'Data',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-26 12:04:54',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter department to which this Contact belongs',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 15,
+		'in_filter': None,
+		'label': 'Department',
+		'modified': '2011-05-30 16:34:30',
+		'modified_by': 'Administrator',
+		'name': '000000575',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Suggest',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': 'White:FFF',
+		'creation': '2011-04-26 12:04:54',
+		'default': None,
+		'depends_on': None,
+		'description': 'Enter designation of this Contact',
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Data',
+		'hidden': None,
+		'icon': None,
+		'idx': 16,
+		'in_filter': None,
+		'label': 'Designation',
+		'modified': '2011-05-30 16:34:30',
+		'modified_by': 'Administrator',
+		'name': '000000576',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Suggest',
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:08:55',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'trash_reason',
+		'fieldtype': 'Small Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 17,
+		'in_filter': None,
+		'label': 'Trash Reason',
+		'modified': '2011-05-30 16:34:30',
+		'modified_by': 'Administrator',
+		'name': 'FL00755',
+		'no_column': None,
+		'no_copy': None,
+		'oldfieldname': 'trash_reason',
+		'oldfieldtype': 'Small Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Contact',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/tools/doctype/contact_detail/__init__.py b/tools/doctype/contact_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/contact_detail/__init__.py
diff --git a/tools/doctype/contact_detail/contact_detail.txt b/tools/doctype/contact_detail/contact_detail.txt
new file mode 100644
index 0000000..6f58968
--- /dev/null
+++ b/tools/doctype/contact_detail/contact_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-30 18:16:41', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'CD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Contact Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 18:16:41', 'doctype': 'DocField', 'oldfieldname': 'contact_person', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Contact Person', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01574', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'contact_person', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 18:16:41', 'doctype': 'DocField', 'oldfieldname': 'contact_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Contact No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01575', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'contact_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-30 18:16:41', 'doctype': 'DocField', 'oldfieldname': 'department', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Department', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01576', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'department', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-05-06 17:14:06', 'doctype': 'DocField', 'oldfieldname': 'designation', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02006', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'designation', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2009-05-19 10:57:20', 'doctype': 'DocField', 'oldfieldname': 'email_id', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Email Id', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02092', 'idx': 5, 'default': None, 'colour': None, 'modified': '2009-07-20 19:14:16', 'parenttype': 'DocType', 'fieldname': 'email_id', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/file_browser_control/__init__.py b/tools/doctype/file_browser_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/file_browser_control/__init__.py
diff --git a/tools/doctype/file_browser_control/file_browser_control.py b/tools/doctype/file_browser_control/file_browser_control.py
new file mode 100644
index 0000000..8008ae9
--- /dev/null
+++ b/tools/doctype/file_browser_control/file_browser_control.py
@@ -0,0 +1,198 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+    def __init__(self,doc,doclist=[]):
+        self.doc = doc
+        self.doclist = doclist
+        
+    # All root file groups(where parent_group is null).
+    def get_root_file_grps(self):
+        fl_grp = convert_to_lists(sql("select name,group_name,ifnull(can_edit,''),ifnull(can_view,''),owner from `tabFile Group` where (parent_group='' or parent_group is null)"))
+        return fl_grp
+    
+    # Get children of selected file group.
+    def get_children(self,grp):
+        ret = {}
+        ret['parent_grp'] = grp
+            
+        fl_grp = convert_to_lists(sql("select name,group_name,ifnull(can_edit,''),ifnull(can_view,''),owner from `tabFile Group` where parent_group=%s",grp))
+        ret['fl_grp'] = fl_grp or ''
+        fl = convert_to_lists(sql("select name,ifnull(file_name,''),ifnull(file_list,''),ifnull(can_edit,''),ifnull(can_view,''),owner from tabFile where file_group=%s and (file_name != '' and file_name is not null)",grp))
+        ret['fl'] = fl or ''
+
+        return ret
+    
+    # Create a new file group.
+    def create_new_grp(self,arg):
+        arg = eval(arg)
+        
+        grp = Document('File Group')
+        grp.group_name = arg['grp_nm']
+        grp.parent_group = arg['parent_grp']
+        grp.description = arg['desc']
+        grp.name = arg['grp_nm']
+        grp.save(1)
+        msgprint('Created a New Group')
+        return grp.name
+    
+    # Create a new file.
+    def create_new_file(self,arg):
+        arg = eval(arg)
+        
+        f = Document('File')
+        f.file_name = arg['file_name']
+        f.description = arg['desc']
+        f.type = arg['type']
+        f.file_group = arg['file_grp']
+        f_obj = get_obj(doc=f)
+        f_obj.validate()
+        f_obj.doc.save(1)
+        msgprint('Created a New File')
+        ret = {
+            'name'  :   f_obj.doc.name,
+            'label' :   f_obj.doc.file_name
+        }
+        return cstr(ret)
+    
+    # Update changes done to selected file group.
+    def update_grp(self,arg):
+        arg = eval(arg)
+        sql("update `tabFile Group` set group_name=%s, parent_group=%s, description=%s where name=%s",(arg['grp_nm'],arg['parent_grp'],arg['desc'],arg['name']))
+        msgprint("Changes are saved.")
+        return arg['name']
+
+    # Update changes done to selected file.
+    def update_file(self,arg):
+        arg = eval(arg)
+        sql("update `tabFile` set description=%s, file_group=%s where name=%s",(arg['desc'],arg['file_grp'],arg['name']))
+        msgprint("Changes are saved.")        
+        return arg['name']
+        
+    # Get details of selected file.
+    def get_file_details(self,file_id):
+        file_det = convert_to_lists(sql("select name,file_name, description, file_group, file_list from tabFile where name=%s",file_id))
+        file_det = {
+            'name' : file_det[0][0] or '',
+            'file_name' : file_det[0][1] or '',
+            'description' : file_det[0][2] or '',
+            'file_group' : file_det[0][3] or '',
+            'file_list' : file_det[0][4] or ''
+        }
+        return file_det
+    
+    # Delete File Data and File record.
+    def delete(self,arg):
+        arg = eval(arg)
+        if arg['dt'] == 'File Group':
+            sql("delete from `tabFile Group` where name= %s", arg['dn'])
+        elif arg['dt'] == 'File':
+			file_list = sql("select file_list from tabFile where name=%s", arg['dn'])[0][0] or ''
+			f_id = file_list.split(',')[-1]
+			if f_id:
+				sql("delete from `tabFile Data` where name=%s", f_id)
+				sql("delete from tabFile where name = %s", arg['dn'])	
+        else:
+            pass
+			
+    #Move to another group.
+    def move(self,arg):
+        msgprint('need to write code')
+
+    # Upload Image
+    def upload_many(self,form):
+        import os
+        # from file browser
+        if form.getvalue('form_name') == 'File Browser':
+            if form.getvalue('filedata'):
+                i = form['filedata']
+
+                #creat file data                
+                fd = Document('File Data')
+                fd.blob_content = i.file.read()
+                fd.file_name = i.filename
+                
+                file_det = form.getvalue('file_det').split('~~')
+                
+                if(file_det[0] == 'NIL'):
+                    file_desc = ''
+                else:
+                    file_desc = file_det[0]
+                
+                if(file_det[1] == 'NIL'):
+                    file_grp = ''
+                    return 'File Group is mandatory.'
+                    raise Exception
+                else:
+                    file_grp = file_det[1]
+                
+                if "" in fd.file_name:
+                  fd.file_name = fd.file_name.split("")[-1]
+                if '/' in fd.file_name:
+                  fd.file_name = fd.file_name.split('/')[-1]
+                fd.save(1)
+                
+                f = Document('File')
+                f.file_list = fd.file_name + ',' + fd.name
+                f.file_name = fd.file_name
+                f.description = file_desc
+                f.file_group = file_grp
+                f.save(1)
+                
+                ret = {
+                    'name'  :   f.name,
+                    'file_name' :   f.file_name
+                }
+                    
+                return cstr(ret)
+            else:
+                return 'No file found.'
+        else:
+            return 'No file found.'
+    
+    # Get all system roles.
+    def get_all_roles(self):
+        roles = convert_to_lists(sql("select name from tabRole"))
+        return roles
+    
+    # Get details for selected File Group.
+    def get_fg_details(self,grp):
+        grp_det = convert_to_lists(sql("select name,group_name, ifnull(parent_group,''), ifnull(description,''), ifnull(can_edit,''),ifnull(can_view,''),owner from `tabFile Group` where name=%s",grp))
+        grp_det = {
+            'Name' : grp_det[0][0] or '',
+            'Group Name' : grp_det[0][1] or '',
+            'Parent Group' : grp_det[0][2] or '',
+            'Description' : grp_det[0][3] or '',
+            'Can Edit' : grp_det[0][4] or '',
+            'Can View' : grp_det[0][5] or '',
+            'Owner' : grp_det[0][6] or ''
+        }
+        return grp_det
+    
+    # Update Edit/ View privileges to selected File/ File Group.
+    def update_privileges(self,arg):
+        arg = eval(arg)
+        sql("update `tab%s` set can_edit='%s', can_view='%s' where name='%s'" % (arg['type'],arg['edit_roles'], arg['view_roles'], arg['name']))
+        msgprint('Privileges updated.')
+    
+    # Get Edit/ View privileges from selected File/ File Group.
+    def get_privileges(self,arg):
+        arg = eval(arg)
+        privilege = convert_to_lists(sql("select ifnull(can_edit,''), ifnull(can_view,''),owner from `tab%s` where name='%s'" % (arg['dt'],arg['dn'])))
+        return privilege
\ No newline at end of file
diff --git a/tools/doctype/file_browser_control/file_browser_control.txt b/tools/doctype/file_browser_control/file_browser_control.txt
new file mode 100644
index 0000000..08b7f59
--- /dev/null
+++ b/tools/doctype/file_browser_control/file_browser_control.txt
@@ -0,0 +1,55 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2009-10-28 10:25:03',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': None,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2010-09-20 14:06:57',
+		'modified_by': 'Administrator',
+		'module': 'Tools',
+		'name': 'File Browser Control',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': None,
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 81
+	}
+]
\ No newline at end of file
diff --git a/tools/doctype/rating_template/__init__.py b/tools/doctype/rating_template/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/rating_template/__init__.py
diff --git a/tools/doctype/rating_template/rating_template.txt b/tools/doctype/rating_template/rating_template.txt
new file mode 100644
index 0000000..870e125
--- /dev/null
+++ b/tools/doctype/rating_template/rating_template.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:12:18', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:template_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Template', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00516', 'parent': 'Rating Template', 'read': 1, 'create': 1, 'creation': '2009-11-12 18:12:18', 'modified': '2010-08-06 01:21:20', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': 'template_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Template Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03336', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': 'template_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': 'total_stars', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Total Stars', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03337', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': 'total_stars', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Template Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03338', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Table', 'creation': '2009-11-12 18:12:18', 'doctype': 'DocField', 'oldfieldname': 'rating_template_details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Template Details1', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03339', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:20', 'parenttype': 'DocType', 'fieldname': 'rating_template_details', 'fieldtype': 'Table', 'options': 'Rating Template Detail', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/rating_template_detail/__init__.py b/tools/doctype/rating_template_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/rating_template_detail/__init__.py
diff --git a/tools/doctype/rating_template_detail/rating_template_detail.txt b/tools/doctype/rating_template_detail/rating_template_detail.txt
new file mode 100644
index 0000000..31050a5
--- /dev/null
+++ b/tools/doctype/rating_template_detail/rating_template_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:13:41', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'RTD/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Template Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-11-12 18:13:41', 'doctype': 'DocField', 'oldfieldname': 'rating', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03340', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:10', 'parenttype': 'DocType', 'fieldname': 'rating', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:13:41', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Template Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03341', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 01:21:10', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/rating_widget_control/__init__.py b/tools/doctype/rating_widget_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/rating_widget_control/__init__.py
diff --git a/tools/doctype/rating_widget_control/rating_widget_control.py b/tools/doctype/rating_widget_control/rating_widget_control.py
new file mode 100644
index 0000000..d5c5bad
--- /dev/null
+++ b/tools/doctype/rating_widget_control/rating_widget_control.py
@@ -0,0 +1,51 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+    def __init__(self,d,dl):
+        self.doc, self.doclist = d, dl
+        
+    def show_my_rating(self,arg):
+        arg = eval(arg)
+        ret = {}
+        ret['total_stars'] = convert_to_lists(sql("select total_stars from `tabRating Template` where name = %s", arg['template']))
+        ret['avg_rating'] = convert_to_lists(sql("select count(name),round(sum(rating_stars)/count(name)) from `tabRating Widget Record` where rating_doctype = %s and rating_docname = %s and rating_template = %s",(arg['dt'], arg['dn'], arg['template'])))
+        rating_details = convert_to_lists(sql("select name, rating_stars, rating_description, rating_template, rating_by, rating_to, rating_date, rating_time, rating_doctype, rating_docname from `tabRating Widget Record` where rating_by = %s and rating_doctype = %s and rating_docname = %s and rating_template = %s",(arg['by'], arg['dt'], arg['dn'], arg['template'])))
+        if rating_details:
+            ret['rating_details'] = rating_details or ''
+            ret['flag'] = 1
+        else:
+            ret['rating_desc'] = convert_to_lists(sql("select rating, description from `tabRating Template Detail` where parent = %s", arg['template']))
+            ret['flag'] = 0
+        return ret
+        
+    def add_rating(self,arg):
+        import time
+        arg = eval(arg)
+        rw = Document('Rating Widget Record')
+        rw.rating_stars = arg['rating']
+        rw.rating_description = arg['desc']
+        rw.rating_template = arg['template']
+        rw.rating_by = arg['rating_by']
+        rw.rating_to = Document(arg['dt'],arg['dn']).owner
+        rw.rating_date = nowdate()
+        rw.rating_time = time.strftime('%H:%M')
+        rw.rating_doctype = arg['dt']
+        rw.rating_docname = arg['dn']
+        rw.save(1)
\ No newline at end of file
diff --git a/tools/doctype/rating_widget_control/rating_widget_control.txt b/tools/doctype/rating_widget_control/rating_widget_control.txt
new file mode 100644
index 0000000..34c6ccf
--- /dev/null
+++ b/tools/doctype/rating_widget_control/rating_widget_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:26:54', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Widget Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/tools/doctype/rating_widget_record/__init__.py b/tools/doctype/rating_widget_record/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/rating_widget_record/__init__.py
diff --git a/tools/doctype/rating_widget_record/rating_widget_record.txt b/tools/doctype/rating_widget_record/rating_widget_record.txt
new file mode 100644
index 0000000..6c6a0f3
--- /dev/null
+++ b/tools/doctype/rating_widget_record/rating_widget_record.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-11-12 18:16:40', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 3, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'RWR/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Rating Widget Record', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00517', 'parent': 'Rating Widget Record', 'read': 1, 'create': 1, 'creation': '2009-11-12 18:16:40', 'modified': '2010-08-06 01:20:33', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_stars', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Stars', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03342', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_stars', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03343', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_description', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_template', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Template', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03344', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_template', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_by', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03345', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_by', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_to', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating To', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03346', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_to', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03347', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_time', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Time', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03348', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_time', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_doctype', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Doctype', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03349', 'idx': 8, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_doctype', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-11-12 18:16:40', 'doctype': 'DocField', 'oldfieldname': 'rating_docname', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Rating Docname', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Rating Widget Record', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03350', 'idx': 9, 'default': None, 'colour': None, 'modified': '2010-08-06 01:20:33', 'parenttype': 'DocType', 'fieldname': 'rating_docname', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/receiver_detail/__init__.py b/tools/doctype/receiver_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/receiver_detail/__init__.py
diff --git a/tools/doctype/receiver_detail/receiver_detail.txt b/tools/doctype/receiver_detail/receiver_detail.txt
new file mode 100644
index 0000000..62d7ca2
--- /dev/null
+++ b/tools/doctype/receiver_detail/receiver_detail.txt
@@ -0,0 +1 @@
+[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-12 17:10:13', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Receiver Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-07-05 13:29:27', 'doctype': 'DocField', 'oldfieldname': 'customer_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Receiver Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05519', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-07-05 13:29:27', 'parenttype': 'DocType', 'fieldname': 'customer_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 17:10:13', 'doctype': 'DocField', 'oldfieldname': 'receiver_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Receiver Name', 'width': '350px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Receiver Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01344', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-07-05 13:29:27', 'parenttype': 'DocType', 'fieldname': 'receiver_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 17:10:13', 'doctype': 'DocField', 'oldfieldname': 'mobile_no', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Mobile No', 'width': '200px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Receiver Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01345', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-07-05 13:29:27', 'parenttype': 'DocType', 'fieldname': 'mobile_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/reposting_tool/__init__.py b/tools/doctype/reposting_tool/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/reposting_tool/__init__.py
diff --git a/tools/doctype/reposting_tool/reposting_tool.js b/tools/doctype/reposting_tool/reposting_tool.js
new file mode 100644
index 0000000..8a1d41f
--- /dev/null
+++ b/tools/doctype/reposting_tool/reposting_tool.js
@@ -0,0 +1,63 @@
+var bin_list = [];
+var msg = [];
+var binidx = 0;
+
+cur_frm.cscript['Repost Bin'] = function(doc,cdt,cdn) {
+  args = {'check': 'Bin'};
+  $c_obj('Reposting Tool','get_count_for_reposting', docstring(args), function(r,rt) {
+       bin_list = r.message;
+       repair_bin();
+    });
+} 
+
+function repair_single_bin(){
+  $c_obj('Reposting Tool', 'repair_bin', cstr(bin_list[binidx]), function(r,rt) {
+       for(i = 0; i < r.message.length ; i++){
+         msg.push(r.message[i]);
+       }
+       repair_bin();
+    });
+}
+
+function repair_bin(){
+   if(binidx >= 10) {
+       args = {'msg': msg, 'subject': 'Item Quantity'};
+       $c_obj('Reposting Tool', 'send_mail', docstring(args));
+       alert('Completed');
+       return;
+  }
+  repair_single_bin();
+  binidx ++;
+}
+
+// Batch for Account Balances
+//======================================================
+var acc_list = [];
+var accidx = 0;
+cur_frm.cscript['Repost Account Balances'] = function(doc,cdt,cdn) {
+  args = {'check': 'Account Balance'};
+  $c_obj('Reposting Tool','get_count_for_reposting', docstring(args), function(r,rt) {
+       acc_list = r.message;
+       repair_acc_bal();
+    });
+} 
+
+function repair_single_acc_bal(){
+  $c_obj('Reposting Tool', 'repair_acc_bal', cstr(acc_list[accidx]), function(r,rt) {
+       for(i = 0; i < r.message.length; i++){
+         msg.push(r.message[i]);
+       }
+       repair_acc_bal();
+    });
+}
+
+function repair_acc_bal(){
+  if(accidx >= 15) {
+     args = {'msg' : msg, 'subject': 'Account Balance'};
+     $c_obj('Reposting Tool', 'send_mail', docstring(args));
+     alert('Completed');
+     return;
+  }
+  repair_single_acc_bal();
+  accidx ++;
+}
\ No newline at end of file
diff --git a/tools/doctype/reposting_tool/reposting_tool.py b/tools/doctype/reposting_tool/reposting_tool.py
new file mode 100644
index 0000000..9560650
--- /dev/null
+++ b/tools/doctype/reposting_tool/reposting_tool.py
@@ -0,0 +1,156 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+    self.msg = []
+
+  def get_count_for_reposting(self, args):
+    args = eval(args)
+    if args['check'] == 'Bin':
+      return [d[0] for d in sql("select name from `tabBin` where item_code = 'Repost Item' " )]
+
+    if args['check'] == 'Account Balance':
+      # message
+      if not self.doc.past_year:
+        msgprint('<div style="color: ORANGE"> Warning: Opening balances were not imported </div>')
+
+      # do not repost from same year
+      if self.doc.past_year == self.doc.name:
+        msgprint("Cannot import from the current year")
+ 
+      return [d[0] for d in sql("select name from `tabAccount` ")]
+
+  def get_bin_qty(self, wh, item):
+    # get actual_qty
+    act_qty = sql("select ifnull(actual_qty, 0) from `tabBin` where warehouse = '%s' and item_code = '%s'" % (wh, item))
+    act_qty = act_qty and flt(act_qty[0][0]) or 0
+
+    # get indented_qty 
+    ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item))
+    ind_qty = ind_qty and flt(ind_qty[0][0]) or 0
+    
+    # get ordered_qty
+    ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s'" % (wh, item))
+    ord_qty = ord_qty and flt(ord_qty[0][0]) or 0
+
+    # get reserved_qty
+    res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where  t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' " % (wh, item))
+    res_qty = res_qty and flt(res_qty[0][0]) or 0
+
+    # get planned_qty 
+    plan_qty = sql("select sum(if ( ifnull(qty, 0) > ifnull(produced_qty,0), ifnull(qty, 0) - ifnull(produced_qty, 0), 0) ) from `tabProduction Order` where fg_warehouse = '%s' and production_item = '%s' and docstatus = 1" % (wh, item))
+    plan_qty = plan_qty and flt(plan_qty[0][0]) or 0
+
+    return {'actual_qty': act_qty, 'indented_qty': ind_qty, 'ordered_qty': ord_qty, 'reserved_qty': res_qty, 'planned_qty': plan_qty }
+
+  def check_bin_qty(self, bin_obj, qty_dict):
+    label_dict = {'actual_qty': 'Actual Qty', 'indented_qty': 'Indent Qty', 'ordered_qty': 'Ordered Qty', 'reserved_qty': 'Reserved Qty', 'planned_qty': 'Planned Qty'}
+    for f in qty_dict:
+      if flt(bin_obj.doc.fields[f]) != qty_dict[f]:
+        msgprint('<div style="color: RED"> Difference found in %s for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (label_dict[f], bin_obj.doc.item_code, bin_obj.doc.warehouse, cstr(bin_obj.doc.fields[f]), cstr(qty_dict[f])))
+        self.msg.append('<div style="color: RED"> Difference found in %s for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (label_dict[f], bin_obj.doc.item_code, bin_obj.doc.warehouse, cstr(bin_obj.doc.fields[f]), cstr(qty_dict[f])))
+    
+    # Check projected qty
+    projected_qty = flt(qty_dict['actual_qty']) + flt(qty_dict['indented_qty']) + flt(qty_dict['ordered_qty']) + flt(qty_dict['planned_qty']) - flt(qty_dict['reserved_qty'])
+    if flt(projected_qty) != flt(bin_obj.doc.projected_qty):
+      msgprint('<div style="color: RED">Difference found in Projected Qty for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse, bin_obj.doc.projected_qty, cstr(projected_qty)))
+      self.msg.append('<div style="color: RED">Difference found in Projected Qty for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse, bin_obj.doc.projected_qty, cstr(projected_qty)))
+
+  def repair_bin(self, bin):
+    import webnotes
+    bin_obj = get_obj('Bin',bin)
+    bin_act_qty =  flt(bin_obj.doc.actual_qty)
+    try:
+      # udpate actual qty and item valuation
+      bin_obj.update_item_valuation('', '2000-01-01', '00:00')
+      # get bin qty
+      qty_dict = self.get_bin_qty(bin_obj.doc.warehouse, bin_obj.doc.item_code)
+      
+      # check bin qty
+      self.check_bin_qty(bin_obj, qty_dict)
+
+      # update indented_qty, ordered_qty, reserved_qty, planned_qty
+      sql("update `tabBin` set indented_qty = '%s', ordered_qty = '%s', reserved_qty = '%s', planned_qty = '%s' where warehouse = '%s' and item_code = '%s'" % ( flt(qty_dict['indented_qty']), flt(qty_dict['ordered_qty']), flt(qty_dict['reserved_qty']), flt(qty_dict['planned_qty']),  bin_obj.doc.warehouse, bin_obj.doc.item_code))
+ 
+      # update projected_qty
+      sql("update `tabBin` set projected_qty = ifnull(indented_qty, 0) + ifnull(ordered_qty,0) + ifnull(actual_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty,0) where warehouse = '%s' and item_code = '%s' " % (bin_obj.doc.warehouse, bin_obj.doc.item_code))
+      if not self.msg:
+        msgprint('<div style="color: GREEN"> Reposting of Stock for Item %s and Warehouse %s completed Successfully. </div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse))
+    except Exception:
+      msgprint('<div style="color: RED"> Handle Item %s and Warehouse %s seprately. </div> <div style="color: RED"> ERROR: %s</div>' % (bin_obj.doc.item_code, bin_obj.doc.warehouse, str(webnotes.utils.getTraceback())))
+      self.msg.append('<div style="color: RED"> ERROR: %s</div>' % (str(webnotes.utils.getTraceback())))
+
+  def repair_opening_bal(self, d, acc_obj, past_yr, fiscal_yr):
+    # check opening balance
+    opbal = sql("select balance from `tabAccount Balance` where account=%s and period = %s", (acc_obj.doc.name, past_yr))
+    if flt(d.opening) != flt(opbal and flt(opbal[0][0]) or 0):
+      msgprint('<div style="color: RED"> Difference found in Opening of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>' % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.opening), opbal and flt(opbal[0][0]) or 0)) 
+      self.msg.append('<div style="color: RED"> Difference found in Opening of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>'  % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.opening), opbal and flt(opbal[0][0]) or 0))
+      sql("update `tabAccount Balance` set opening = '%s' where period = '%s' and account = '%s' " % (opbal and flt(opbal[0][0]) or 0, fiscal_yr, acc_obj.doc.name))
+
+  def repair_bal(self, d, acc_obj, fiscal_yr):
+    # check balances 
+    ysd = get_value('Fiscal Year', fiscal_yr, 'year_start_date')
+    bal = get_obj('GL Control').get_as_on_balance(acc_obj.doc.name, fiscal_yr, d.end_date, acc_obj.doc.debit_or_credit, acc_obj.doc.is_pl_account, acc_obj.doc.lft, acc_obj.doc.rgt, ysd)
+    if flt(d.balance) != flt(bal):
+      msgprint('<div style="color: RED"> Difference found in Balance of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>' % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.balance), flt(bal))) 
+      self.msg.append('<div style="color: RED"> Difference found in Balance of Account %s for Period %s in Fiscal Year %s (Before : %s; After : %s) </div>'  % (acc_obj.doc.name, d.period, fiscal_yr, flt(d.balance), flt(bal)))
+      sql("update `tabAccount Balance` set balance = '%s' where period = '%s' and account = '%s' " % (bal, d.period, acc_obj.doc.name))
+          
+  def repair_acc_bal(self, acc, past_yr = '' , fiscal_yr = ''):
+    # get account obj
+    acc_obj = get_obj('Account', acc, with_children = 1)
+  
+    # get fiscal yr & past yr
+    if not fiscal_yr:
+      import webnotes.utils
+      fiscal_yr = webnotes.utils.get_defaults()['fiscal_year']
+    if not past_yr: past_yr = get_value('Fiscal Year', fiscal_yr, 'past_year')
+
+    # Repair Opening and Balance For Account Balances
+    for d in getlist(acc_obj.doclist, 'account_balances'):
+      if d.fiscal_year == fiscal_yr:
+        if past_yr and (past_yr != fiscal_yr) and d.period == fiscal_yr:
+          self.repair_opening_bal(d, acc_obj, past_yr, fiscal_yr)
+        else:
+          self.repair_bal(d, acc_obj, fiscal_yr)
+
+    # Acknowledge USer
+    if not self.msg:
+      msgprint('<div style="color: GREEN"> Openings & Balances of Account %s for Fiscal Year %s updated successfully. </div>' % ( acc_obj.doc.name, fiscal_yr))
+
+    return self.msg
+  
+  def send_mail(self, args):
+    args = eval(args)
+    self.msg, subject = args['msg'], args['subject']
+    msgprint(self.msg)
+    if self.msg:
+      email_msg = """ Dear Administrator,
+
+In Account := %s User := %s has Reposted %s and following was found:-
+
+%s
+
+""" % (get_value('Control Panel', None,'account_id'), session['user'], subject, '\n'.join(self.msg))
+
+      sendmail(['saumil@iwebnotes.com','nabin@iwebnotes.com'], subject='Repair of ' + cstr(subject), parts = [('text/plain', email_msg)])
diff --git a/tools/doctype/reposting_tool/reposting_tool.txt b/tools/doctype/reposting_tool/reposting_tool.txt
new file mode 100644
index 0000000..9673e3a
--- /dev/null
+++ b/tools/doctype/reposting_tool/reposting_tool.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-13 09:24:32', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 1, 'allow_email': 1, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 173, 'menu_index': None, 'docstatus': 0, 'allow_copy': 1, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': 1, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Reposting Tool', 'idx': None, 'hide_toolbar': 1, 'colour': 'Light Blue:DEF', 'client_script': None, 'modified': '2010-10-14 12:15:59', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00769', 'parent': 'Reposting Tool', 'read': 1, 'create': 1, 'creation': '2010-04-13 09:24:32', 'modified': '2010-10-14 12:15:59', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-04-13 09:24:32', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Recalculate MAR & Actual Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Reposting Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04638', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-14 12:15:59', 'parenttype': 'DocType', 'fieldname': 'recalculate_mar_&_actual_qty', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-28 13:34:48', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Repost Bin', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Reposting Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05722', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-10-14 12:15:59', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2010-07-30 09:22:26', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'jai@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Repost Account Balances', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Reposting Tool', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05758', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-14 12:15:59', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/sms_control/__init__.py b/tools/doctype/sms_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/sms_control/__init__.py
diff --git a/tools/doctype/sms_control/sms_control.js b/tools/doctype/sms_control/sms_control.js
new file mode 100644
index 0000000..c6cc53e
--- /dev/null
+++ b/tools/doctype/sms_control/sms_control.js
@@ -0,0 +1,93 @@
+function SMSManager() {
+	var me = this;
+	this.get_contact_number = function(contact, key, value) {
+		$c_obj('SMS Control', 'get_contact_number', {
+				contact_name:contact, 
+				value:value,
+				key:key
+			}, function(r,rt) {
+				if(r.exc) { msgprint(r.exc); return; }
+				me.number = r.message;
+				me.show_dialog();
+			}
+		);
+	}
+	this.show = function(contact, key, value, mobile_nos, message) {
+		this.message = message;
+		if (mobile_nos) {
+
+			me.number = mobile_nos;
+			me.show_dialog();
+		} else if (contact){
+			this.get_contact_number(contact, key, value)
+		} else {
+			me.show_dialog();
+		}
+	}
+	this.show_dialog = function() {
+		if(!me.dialog) 
+			me.make_dialog();
+		me.dialog.set_values({
+			'message': me.message,
+			'number': me.number
+		})
+		me.dialog.show();
+	}
+	this.make_dialog = function() {
+		var d = new wn.widgets.Dialog({
+			title: 'Send SMS',
+			width: 400,
+			fields: [
+				{fieldname:'number', fieldtype:'Data', label:'Mobile Number', reqd:1},
+				{fieldname:'message', fieldtype:'Text', label:'Message', reqd:1},
+				{fieldname:'send', fieldtype:'Button', label:'Send'}
+			]
+		})
+		d.make();
+		d.fields_dict.send.input.onclick = function() {
+			var btn = d.fields_dict.send.input;
+			var v = me.dialog.get_values();
+			if(v) {
+				btn.set_working();
+				$c_obj('SMS Control', 'send_form_sms', v, function(r,rt) {
+					btn.done_working();
+					if(r.exc) {msgprint(r.exc); return; }
+					msgprint('Message Sent');
+					me.dialog.hide();
+				})
+			}
+		}
+		this.dialog = d;
+	}
+}
+
+cur_frm.cscript['Send SMS'] = function(doc,dt,dn) {
+	var doc = cur_frm.doc;
+	var sms_man = new SMSManager();
+	var default_msg = {
+		'Lead'				: '',
+		'Enquiry'			: 'Your enquiry has been logged into the system. Ref No: ' + doc.name,
+		'Quotation'			: 'Quotation ' + doc.name + ' has been sent via email. Thanks!',
+		'Sales Order'		: 'Sales Order ' + doc.name + ' has been created against ' 
+					+ (doc.quotation_no ? ('Quote No:' + doc.quotation_no) : '')
+					+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
+		'Delivery Note'		: 'Items has been delivered against delivery note: ' + doc.name
+					+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),		
+		'Receivable Voucher': 'Invoice ' + doc.name + ' has been sent via email '
+					+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
+		'Indent'			: 'Indent ' + doc.name + ' has been raised in the system',
+		'Purchase Order'	: 'Purchase Order ' + doc.name + ' has been sent via email',
+		'Purchase Receipt'	: 'Items has been received against purchase receipt: ' + doc.name
+	}
+
+	if (in_list(['Quotation', 'Sales Order', 'Delivery Note', 'Receivable Voucher'], doc.doctype))
+		sms_man.show(doc.contact_person, 'customer', doc.customer, '', default_msg[doc.doctype]);
+	else if (in_list(['Purchase Order', 'Purchase Receipt'], doc.doctype))
+		sms_man.show(doc.contact_person, 'supplier', doc.supplier, '', default_msg[doc.doctype]);
+	else if (doc.doctype == 'Lead')
+		sms_man.show('', '', '', doc.mobile_no, default_msg[doc.doctype]);
+	else if (doc.doctype == 'Enquiry')
+		sms_man.show('', '', '', doc.contact_no, default_msg[doc.doctype]);
+	else if (doc.doctype == 'Indent')
+		sms_man.show('', '', '', '', default_msg[doc.doctype]);
+}
diff --git a/tools/doctype/sms_control/sms_control.py b/tools/doctype/sms_control/sms_control.py
new file mode 100644
index 0000000..de11e90
--- /dev/null
+++ b/tools/doctype/sms_control/sms_control.py
@@ -0,0 +1,190 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import cint, flt, load_json, nowdate, cstr
+from webnotes.model.code import get_obj
+from webnotes.model.doc import Document
+from webnotes import session, msgprint
+from webnotes.model.doclist import getlist, copy_doclist
+
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+	
+# -----------------------------------------------------------------------------------------
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+	# validate receiver numbers
+	# =========================================================
+	def validate_receiver_nos(self,receiver_list):
+		validated_receiver_list = []
+		for d in receiver_list:
+			# remove invalid character
+			invalid_char_list = [' ', '+', '-', '(', ')']
+			for x in invalid_char_list:
+				d = d.replace(x, '')
+
+			# mobile no validation for erpnext gateway
+			if get_value('SMS Settings', None, 'sms_gateway_url'):
+				mob_no = d
+			else:
+				if not d.startswith("0") and len(d) == 10:
+					mob_no = "91" + d
+				elif d.startswith("0") and len(d) == 11:
+					mob_no = "91" + d[1:]
+				elif len(d) == 12:
+					mob_no = d
+				else:
+					msgprint("Invalid mobile no : " + cstr(d))
+					raise Exception
+
+				if not mob_no.isdigit():
+					msgprint("Invalid mobile no : " + cstr(mob_no))
+					raise Exception
+
+			validated_receiver_list.append(mob_no)
+
+		if not validated_receiver_list:
+			msgprint("Please enter valid mobile nos")
+			raise Exception
+
+		return validated_receiver_list
+
+
+	# Connect Gateway
+	# =========================================================
+	def connect_gateway(self):
+		"login to gateway"
+		from webnotes.utils.webservice import FrameworkServer
+		fw = FrameworkServer('www.erpnext.com','/','__system@webnotestech.com','password',https=1)
+		return fw
+
+	def get_sender_name(self):
+		"returns name as SMS sender"
+		return webnotes.conn.get_value('Manage Account', None, 'sms_sender_name') or 'ERPNext'
+	
+	def get_contact_number(self, arg):
+		"returns mobile number of the contact"
+		args = load_json(arg)
+		number = sql('select mobile_no, phone from tabContact where name=%s and %s=%s' % ('%s', args['key'], '%s'),\
+			(args['contact_name'], args['value']))
+		return number and (number[0][0] or number[0][1]) or ''
+	
+	def send_form_sms(self, arg):
+		"called from client side"
+		args = load_json(arg)
+		self.send_sms([str(args['number'])], str(args['message']))
+
+ 
+	# Send SMS
+	# =========================================================
+	def send_sms(self, receiver_list, msg, sender_name = ''):
+		receiver_list = self.validate_receiver_nos(receiver_list)
+
+		arg = { 'account_name'	: webnotes.conn.get_value('Control Panel',None,'account_id'),
+				'receiver_list' : receiver_list,
+				'message'		: msg,
+				'sender_name'	: sender_name or self.get_sender_name()
+			}
+
+		# personalized or erpnext gateway
+		if get_value('SMS Settings', None, 'sms_gateway_url'):
+			ret = self.send_via_personalized_gateway(arg)
+			msgprint(ret)
+		else:
+			ret = self.send_via_erpnext_gateway(arg)
+
+	# Send sms via personalized gateway
+	# ==========================================================
+	def send_via_personalized_gateway(self, arg):
+		ss = get_obj('SMS Settings', 'SMS Settings', with_children=1)
+		args = {ss.doc.message_parameter : arg.get('message')}
+		for d in getlist(ss.doclist, 'static_parameter_details'):
+			args[d.parameter] = d.value
+		
+		resp = []
+		for d in arg.get('receiver_list'):
+			args[ss.doc.receiver_parameter] = d
+			resp.append(self.send_request(ss.doc.sms_gateway_url, args))
+
+		return resp
+
+	# Send sms via ERPNext gateway
+	# ==========================================================
+	def send_via_erpnext_gateway(self, arg):
+		fw = self.connect_gateway()
+		ret = fw.run_method(method = 'erpnext_utils.sms_control.send_sms', args = arg)
+
+		if ret.get('exc'):
+			msgprint(ret['exc'])
+			raise Exception
+		elif ret['message']:
+			sms_sent = cint(ret['message']['sms_sent'])
+			sms_bal = cint(ret['message']['sms_balance'])
+			self.create_sms_log(arg, ret['message']['sms_sent'])
+
+			if not sms_sent:
+				if sms_bal < len(arg['receiver_list']):
+					msgprint("You do not have enough SMS balance. Current SMS Balance: " + cstr(sms_bal) + "\nYou can send mail to sales@erpnext.com to buy additional sms packages")
+					raise Exception
+				else:
+					msgprint("Message sent failed. May be numbers are invalid or some other issues.")
+			else:
+				msgprint(cstr(sms_sent) + " message sucessfully sent!\nCurrent SMS Balance: " + cstr(cint(ret['message']['sms_balance']) - cint(ret['message']['sms_sent'])))
+
+
+	# Send Request
+	# =========================================================
+	def send_request(self, gateway_url, args):
+		import httplib, urllib
+		server, api_url = self.scrub_gateway_url(gateway_url)
+		conn = httplib.HTTPConnection(server)  # open connection
+		headers = {}
+		headers['Accept'] = "text/plain, text/html, */*"
+		conn.request('GET', api_url + urllib.urlencode(args), headers = headers)    # send request
+		resp = conn.getresponse()     # get response
+		resp = resp.read()
+		return resp
+
+	# Split gateway url to server and api url
+	# =========================================================
+	def scrub_gateway_url(self, url):
+		url = url.replace('http://', '').strip().split('/')
+		server = url.pop(0)
+		api_url = '/' + '/'.join(url)
+		if not api_url.endswith('?'):
+			api_url += '?'
+		return server, api_url
+
+		
+
+
+	# Create SMS Log
+	# =========================================================
+	def create_sms_log(self, arg, sent_sms):
+		sl = Document('SMS Log')
+		sl.sender_name = arg['sender_name']
+		sl.sent_on = nowdate()
+		sl.receiver_list = cstr(arg['receiver_list'])
+		sl.message = arg['message']
+		sl.no_of_requested_sms = len(arg['receiver_list'])
+		sl.no_of_sent_sms = sent_sms
+		sl.save(new=1)
+
+	# Get SMS Balance
+	# =========================================================
+	def get_sms_balance(self):
+		arg = { 'account_name'	: webnotes.conn.get_value('Control Panel',None,'account_id') }
+		if get_value('SMS Settings', None, 'sms_gateway_url'):
+			ret = {}
+		else:
+			fw = self.connect_gateway()
+			ret = fw.run_method(mothod = 'erpnext_utils.sms_control.get_sms_balance', args = arg)
+
+		if ret.get('exc'):
+			msgprint(ret['exc'])
+			raise Exception
+		else:
+			msgprint("Current SMS Balance: " + cstr(ret['message']) + "\nYou can send mail to sales@erpnext.com to buy sms packages")
diff --git a/tools/doctype/sms_control/sms_control.txt b/tools/doctype/sms_control/sms_control.txt
new file mode 100644
index 0000000..727d41b
--- /dev/null
+++ b/tools/doctype/sms_control/sms_control.txt
@@ -0,0 +1,101 @@
+[
+	{
+		'allow_attach': None,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': None,
+		'autoname': None,
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:24',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 0,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': 1,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-08 16:53:02',
+		'modified_by': 'Administrator',
+		'module': 'Tools',
+		'name': 'SMS Control',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': '',
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': None,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 4
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': 1,
+		'creation': '2010-08-08 17:09:24',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-04-08 16:53:02',
+		'modified_by': 'Administrator',
+		'name': 'PERM00534',
+		'owner': 'Administrator',
+		'parent': 'SMS Control',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'amend': None,
+		'cancel': None,
+		'create': None,
+		'creation': '2010-08-08 17:09:24',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 2,
+		'match': None,
+		'modified': '2011-04-08 16:53:02',
+		'modified_by': 'Administrator',
+		'name': 'PERM00535',
+		'owner': 'Administrator',
+		'parent': 'SMS Control',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 1,
+		'read': 1,
+		'role': 'Administrator',
+		'submit': None,
+		'write': None
+	}
+]
\ No newline at end of file
diff --git a/tools/doctype/sms_log/__init__.py b/tools/doctype/sms_log/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/sms_log/__init__.py
diff --git a/tools/doctype/sms_log/sms_log.txt b/tools/doctype/sms_log/sms_log.txt
new file mode 100644
index 0000000..d53835b
--- /dev/null
+++ b/tools/doctype/sms_log/sms_log.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2011-01-11 12:28:39', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': None, 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'SMSLOG/.########', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'SMS Log', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2011-01-11 12:51:46', 'server_code_error': None, 'name_case': None, 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00792', 'parent': 'SMS Log', 'read': 1, 'create': 0, 'creation': '2011-01-11 12:28:58', 'modified': '2011-01-11 12:51:46', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04405', 'idx': 1, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Sender Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04399', 'idx': 2, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': 'sender_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Sent On', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04400', 'idx': 3, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': 'sent_on', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Receiver List', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04401', 'idx': 4, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': 'receiver_list', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': None, 'width': '50%', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04406', 'idx': 5, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Column Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'No of Requested SMS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04403', 'idx': 6, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': 'no_of_requested_sms', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'No of Sent SMS', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04404', 'idx': 7, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': 'no_of_sent_sms', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2011-01-11 12:28:40', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'SMS Log', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04402', 'idx': 8, 'default': None, 'colour': None, 'modified': '2011-01-11 12:51:46', 'parenttype': 'DocType', 'fieldname': 'message', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/todo_item/__init__.py b/tools/doctype/todo_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/todo_item/__init__.py
diff --git a/tools/doctype/todo_item/todo_item.txt b/tools/doctype/todo_item/todo_item.txt
new file mode 100644
index 0000000..d3d014c
--- /dev/null
+++ b/tools/doctype/todo_item/todo_item.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:01:55', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': None, 'allow_print': None, 'autoname': 'TDI.########', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'ToDo Item', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00019', 'parent': 'ToDo Item', 'read': 1, 'create': 1, 'creation': '2009-03-12 12:01:57', 'modified': '2010-05-06 18:12:29', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': None, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00227', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'date', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00228', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'priority', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Priority', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00229', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'priority', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'reference_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reference Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00230', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'reference_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'reference_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reference Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00231', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'reference_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Check', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'checked', 'owner': 'Administrator', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Checked', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00232', 'idx': 6, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'checked', 'fieldtype': 'Check', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-03-12 12:01:57', 'doctype': 'DocField', 'oldfieldname': 'role', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Role', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'ToDo Item', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00233', 'idx': 7, 'default': None, 'colour': None, 'modified': '2010-05-06 18:12:29', 'parenttype': 'DocType', 'fieldname': 'role', 'fieldtype': 'Link', 'options': 'Role', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/trash_control/__init__.py b/tools/doctype/trash_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/trash_control/__init__.py
diff --git a/tools/doctype/trash_control/trash_control.py b/tools/doctype/trash_control/trash_control.py
new file mode 100644
index 0000000..644a278
--- /dev/null
+++ b/tools/doctype/trash_control/trash_control.py
@@ -0,0 +1,59 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, d, dl):
+    self.doc, self.doclist = d, dl
+
+  
+  # Get Masters
+  # -----------
+  def get_masters(self):
+    mlist = []
+    res = sql("select distinct t1.name from tabDocType t1, tabDocPerm t2 where ifnull(t1.allow_trash, 0) = 1 and (ifnull(t2.write, 0) = 1 or ifnull(t2.create, 0) = 1) and t2.role in %s and t2.parent = t1.name and t1.module not in ('DocType','Application Internal','Recycle Bin','Development','Testing','Testing System','Test') ORDER BY t1.name" % cstr(tuple(webnotes.user.get_roles())))
+    for r in res:
+      mlist.append(r[0])
+    return mlist
+
+
+  # Get Trash Records
+  # -----------------
+  def get_trash_records(self, mast_name):
+    mlist = []
+    rec_dict = {}
+    if mast_name == 'All':
+      mlist = self.get_masters()
+    else:
+      mlist.append(mast_name)
+    for i in mlist:
+      rec = [r[0] for r in sql("select name from `tab%s` where docstatus = 2" % i)]
+      if rec:
+        rec_dict[i] = rec
+    return rec_dict
+
+
+  # Restore Records
+  # ---------------
+  def restore_records(self, arg):
+    arg = eval(arg)
+    for k in arg:
+      for r in arg[k]:
+        sql("update `tab%s` set docstatus = 0, modified = '%s', trash_reason = '' where name = '%s'" % (k, now(), r))
+        dt_obj = get_obj(k,r)
+        if hasattr(dt_obj, 'on_restore'): dt_obj.on_restore()
\ No newline at end of file
diff --git a/tools/doctype/trash_control/trash_control.txt b/tools/doctype/trash_control/trash_control.txt
new file mode 100644
index 0000000..b38d5a2
--- /dev/null
+++ b/tools/doctype/trash_control/trash_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-19 09:59:18', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 37, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Trash Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-13 16:35:49', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/tools/doctype/tweet/__init__.py b/tools/doctype/tweet/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/tweet/__init__.py
diff --git a/tools/doctype/tweet/tweet.txt b/tools/doctype/tweet/tweet.txt
new file mode 100644
index 0000000..5478912
--- /dev/null
+++ b/tools/doctype/tweet/tweet.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-05-13 12:23:54', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'TW.######', 'client_script_core': '', 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Tweet', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-17 12:48:20', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00289', 'parent': 'Tweet', 'read': 1, 'create': None, 'creation': '2009-05-13 12:23:54', 'modified': '2010-03-31 10:23:27', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-13 12:23:54', 'doctype': 'DocField', 'oldfieldname': 'by', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'By', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Tweet', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02041', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:23:27', 'parenttype': 'DocType', 'fieldname': 'by', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-05-13 12:23:54', 'doctype': 'DocField', 'oldfieldname': 'comment', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Comment', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Tweet', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02042', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-03-31 10:23:27', 'parenttype': 'DocType', 'fieldname': 'comment', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-08-26 01:31:48', 'doctype': 'DocField', 'oldfieldname': 'tag', 'owner': 'Administrator', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Tag', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Tweet', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02712', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 10:23:27', 'parenttype': 'DocType', 'fieldname': 'tag', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/while_you_were_out/__init__.py b/tools/doctype/while_you_were_out/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/while_you_were_out/__init__.py
diff --git a/tools/doctype/while_you_were_out/while_you_were_out.txt b/tools/doctype/while_you_were_out/while_you_were_out.txt
new file mode 100644
index 0000000..7dc7ccb
--- /dev/null
+++ b/tools/doctype/while_you_were_out/while_you_were_out.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-01-08 17:28:22', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'dhanalekshmi@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'WYWR/.####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'While You Were Out', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00569', 'parent': 'While You Were Out', 'read': 1, 'create': 1, 'creation': '2010-01-08 17:28:22', 'modified': '2010-03-31 09:47:12', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Section Break', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'While You Were Out', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03551', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Section Break', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': 'from_user', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'From', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03552', 'idx': 2, 'default': '__user', 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': 'from_user', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': 'to_user', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'To', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03553', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': 'to_user', 'fieldtype': 'Link', 'options': 'Profile', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-01-08 17:28:22', 'doctype': 'DocField', 'oldfieldname': 'message', 'owner': 'dhanalekshmi@webnotestech.com', 'reqd': None, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Message', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'While You Were Out', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03554', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-03-31 09:47:12', 'parenttype': 'DocType', 'fieldname': 'message', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/wiki_control/__init__.py b/tools/doctype/wiki_control/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/wiki_control/__init__.py
diff --git a/tools/doctype/wiki_control/wiki_control.py b/tools/doctype/wiki_control/wiki_control.py
new file mode 100644
index 0000000..254ca98
--- /dev/null
+++ b/tools/doctype/wiki_control/wiki_control.py
@@ -0,0 +1,32 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self,d,dl):
+    self.doc = d
+    self.doclist = dl
+  
+  def get_wiki_detail(self,arg):
+    arg = eval(arg)
+    ret = {}
+    latest_revision = sql("select max(revision) from `tabWiki History` where reference=%s", arg['dn'])[0][0]
+    
+    ret['detail'] = convert_to_lists(sql("select revision, modified_by,creation from `tabWiki History` where reference=%s and revision=%s", (arg['dn'],latest_revision)))
+    ret['contributors'] = convert_to_lists(sql("select distinct modified_by from `tabWiki History` where reference=%s", arg['dn']))
+    return ret
\ No newline at end of file
diff --git a/tools/doctype/wiki_control/wiki_control.txt b/tools/doctype/wiki_control/wiki_control.txt
new file mode 100644
index 0000000..70f6474
--- /dev/null
+++ b/tools/doctype/wiki_control/wiki_control.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-08 18:08:48', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 2, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Wiki Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00528', 'parent': 'Wiki Control', 'read': None, 'create': None, 'creation': '2009-12-08 18:08:48', 'modified': '2009-12-09 16:57:54', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}]
\ No newline at end of file
diff --git a/tools/doctype/wiki_history/__init__.py b/tools/doctype/wiki_history/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/wiki_history/__init__.py
diff --git a/tools/doctype/wiki_history/wiki_history.txt b/tools/doctype/wiki_history/wiki_history.txt
new file mode 100644
index 0000000..3bb1fab
--- /dev/null
+++ b/tools/doctype/wiki_history/wiki_history.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-08 11:22:40', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'WH/.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Wiki History', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00527', 'parent': 'Wiki History', 'read': 1, 'create': 1, 'creation': '2009-12-08 11:22:40', 'modified': '2009-12-09 16:57:44', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-08 11:22:40', 'doctype': 'DocField', 'oldfieldname': 'reference', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Reference', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03483', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'reference', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-08 11:22:40', 'doctype': 'DocField', 'oldfieldname': 'version_no', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': 1, 'modified_by': 'Administrator', 'label': 'Version No', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': 1, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03484', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'version_no', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Int', 'creation': '2009-12-08 17:57:57', 'doctype': 'DocField', 'oldfieldname': 'revision', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Revision', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03487', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'revision', 'fieldtype': 'Int', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2009-12-08 11:22:40', 'doctype': 'DocField', 'oldfieldname': 'editor', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Editor', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki History', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03485', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-12-09 16:57:44', 'parenttype': 'DocType', 'fieldname': 'editor', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/doctype/wiki_page/__init__.py b/tools/doctype/wiki_page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/doctype/wiki_page/__init__.py
diff --git a/tools/doctype/wiki_page/wiki_page.txt b/tools/doctype/wiki_page/wiki_page.txt
new file mode 100644
index 0000000..1a6bb4d
--- /dev/null
+++ b/tools/doctype/wiki_page/wiki_page.txt
@@ -0,0 +1 @@
+[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-12-04 10:56:29', 'search_fields': None, 'module': 'Tools', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': 1, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 43, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': 'class DocType:\n  def __init__(self, d, dl):\n    self.doc, self.doclist = d,dl\n\n  # replace $image\n  # ------------------\n  def validate(self):\n    import re\n    p = re.compile(\'\\$page\\( (?P<name> [^)]*) \\)\', re.VERBOSE)\n    i = re.compile(\'\\$image\\( (?P<name> [^)]*) \\)\', re.VERBOSE)\n    if self.doc.editor:\n      self.doc.editor = p.sub(self.replace_by_link, self.doc.editor)\n      self.doc.editor = i.sub(self.replace_by_img, self.doc.editor)\n  \n  def replace_by_link(self, match):\n    name = match.group(\'name\')\n    \n    # create wiki page if not created\n    if not db_exists(\'Wiki Page\', name):\n      w = Document(\'Wiki Page\')\n      w.page_name = name\n      w.save(1)\n    \n    return \'\'\'<a href="javascript:loaddoc(\'Wiki Page\',\'%s\')">%s</a>\'\'\' % (name, name)\n    \n  def replace_by_img(self, match):\n    name = match.group(\'name\')\n    return \'<img src="cgi-bin/getfile.cgi?ac=%s&name=%s">\' % (session[\'data\'][\'control_panel\'][\'account_id\'], name)    \n    \n  def on_update(self):\n    if not sql("select name from `tabWiki History` where reference=%s", self.doc.name):\n      latest_revision = 0\n      self.make_history(latest_revision)\n    else:\n      latest_revision = sql("select max(revision) from `tabWiki History` where reference=%s", self.doc.name)[0][0]\n      if latest_revision:\n        content = sql("select editor from `tabWiki History` where revision = %s and reference = %s", (latest_revision, self.doc.name))[0][0]\n        \n        if content == self.doc.editor:\n          pass\n        else:\n          self.make_history(latest_revision)\n\n  def make_history(self,revision):\n    wh = Document(\'Wiki History\')\n    wh.reference = self.doc.name\n    wh.editor = self.doc.editor\n    wh.revision = cint(revision) + 1\n    wh.save(1)', 'allow_trash': None, 'allow_print': None, 'autoname': 'field:page_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Wiki Page', 'idx': None, 'hide_toolbar': 1, 'colour': 'White:FFF', 'client_script': 'cur_frm.cscript.onload = function(doc,dt,dn) {\n  pscript.cur_doc = doc; pscript.cur_dt = dt; pscript.cur_dn = dn;\n  \n  set_field_options(\'Page HTML\', doc.editor);\n  set_field_options(\'Heading\', \'<h1>\'+doc.name+\'</h1>\');\n  \n\n  unhide_field(\'Page HTML\');\n  unhide_field(\'Edit\');\n\n  hide_field(\'editor\');\n  hide_field(\'Done\');\n  \n  pscript.show_wiki_history(doc,dt,dn);\n}\n\ncur_frm.cscript.refresh = function() {\n  \n}\n\ncur_frm.cscript.Edit = function(doc,dt,dn) {\n  hide_field(\'Page HTML\');\n  hide_field(\'Edit\');\n\n  unhide_field(\'editor\');\n  unhide_field(\'Done\');\n}\n\ncur_frm.cscript.Done = function(doc,dt,dn) {\n\n  unhide_field(\'Page HTML\');\n  unhide_field(\'Edit\');\n\n  hide_field(\'editor\');\n  hide_field(\'Done\');\n\n  cur_frm.save(\'Save\', function() {\n    set_field_options(\'Page HTML\', locals[\'Wiki Page\'][doc.name].editor);\n    pscript.show_wiki_history(doc,dt,dn);\n  });\n  //\n}\n\n// Showing wiki detail\npscript.show_wiki_history = function(doc,dt,dn){\n /* $c(\'runserverobj\',args={\'method\':\'get_wiki_detail\',\'docs\':compress_doclist([doc])},\n  function(r,rt){\n    alert(\'in callback\');\n    alert(r.message);\n    detail = r.message.detail;\n    contributors = r.message.contributors;\n    \n    var txt = \'<br>This is Revision - \' + detail[0][0] + \' of \' + dn +\'.\' + \'<br>Last modified by \' + detail[0][1] + \' on \' + dateutil.str_to_user(detail[0][2])\n                  + \'<br><br>Contributors : \' + contributors.join(\', \');\n    set_field_options(\'History HTML\', txt);\n  })*/\n  \n  var callback = function(r,rt){\n    detail = r.message.detail;\n    contributors = r.message.contributors;\n    \n    var txt = \'<br>This is Revision - \' + detail[0][0] + \' of \' + dn +\'.\' + \'<br>Last modified by \' + detail[0][1] + \' on \' + dateutil.str_to_user(detail[0][2])\n                  + \'<br><br>Contributors : \' + contributors.join(\', \');\n    set_field_options(\'History HTML\', txt);\n  }\n  \n  args = {};\n  args.doc = doc; args.dt = dt; args.dn = dn;\n  $c_obj(\'Wiki Control\',\'get_wiki_detail\', docstring(args),callback);\n}\n\n// showing page history (keep this we will use this later)\n/*\npscript.show_page_history = function(){\n  if(!pscript.history_list){\n    history_list = new Listing(\'\',1);\n    history_list.colwidths = [\'30%\',\'30%\',\'40%\'];\n    history_list.colnames = [\'Revision\', \'Date\', \'Modified By\'];\n    pscript.history_list = history_list;\n  }\n  \n  if(!pscript.history_div){ pscript.history_div = document.createElement(\'div\'); }\n  pscript.history_div.innerHTML = \'\';\n\n  pscript.history_list.get_query = function(){\n    this.query = repl("select version_no, creation, modified_by, name from `tabWiki History` where reference=\'%(ref)s\' order by version_no desc", {\'ref\':pscript.cur_dn});\n    this.query_max = repl("select count(name) from `tabWiki History` where reference=\'%(ref)s\'", {\'ref\':pscript.cur_dn});\n  }\n  \n  pscript.history_list.show_cell = function(cell,ri,ci,d){\n    if(ci==0){\n      alert(d[ri][3]);\n      \n      var revision = $a(cell,\'span\',\'link_type\');\n      revision.innerHTML = \'Revision - \' + d[ri][0];\n      revision.name = d[ri][3];\n      \n      revision.onclick = function(){ alert(1); alert(this.name); }\n    }\n    \n    if(ci==1){ cell.innerHTML = dateutil.str_to_user(d[ri][1]); }\n    \n    if(ci==2){ cell.innerHTML = d[ri][2]; }\n  }\n  \n  pscript.history_list.make(pscript.history_div);\n  \n  pscript.history_list.run();\n  \n  pscript.history_list.onrun = function(){\n    //set_field_options\n    var df = get_field(pscript.cur_dt, \'History HTML\', pscript.cur_dn);\n    if(df)df.options = pscript.history_div;\n    alert(df.options);\n    msgprint(df.options);\n    refresh_field(\'History HTML\');\n  }\n}\n\npscript.show_history_content = function(wh){\n  alert(wh);\n}\n*/', 'modified': '2010-09-20 14:06:57', 'server_code_error': '<pre style="text-align: left;"></pre>', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00526', 'parent': 'Wiki Page', 'read': 1, 'create': 1, 'creation': '2009-12-04 10:56:29', 'modified': '2009-12-09 18:18:55', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': 'page_name', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Page Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03472', 'idx': 1, 'default': None, 'colour': None, 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': 'page_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Heading', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03473', 'idx': 2, 'default': None, 'colour': None, 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Done', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03474', 'idx': 3, 'default': None, 'colour': None, 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Page HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03475', 'idx': 4, 'default': None, 'colour': None, 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text Editor', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': 'editor', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Editor', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03476', 'idx': 5, 'default': None, 'colour': 'White:FFF', 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': 'editor', 'fieldtype': 'Text Editor', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Button', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Edit', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03477', 'idx': 6, 'default': None, 'colour': 'White:FFF', 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2009-12-04 10:56:29', 'doctype': 'DocField', 'oldfieldname': '', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Footer HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03478', 'idx': 7, 'default': None, 'colour': None, 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': '', 'fieldtype': 'HTML', 'options': '<div style=\'border-top: 1px solid #AAA; margin-top: 32px; padding-top: 8px\'>To create / link another WIki Page, use <span style="font-family: Courier, fixed">$page(New Page Name)</span></div>\n\n<div>To add image, use <span style="font-family:Courier,fixed">$image(filename)</span></div>\n<!--\n<div><span class="link_type" onclick="pscript.show_page_history()">Show page history</span></div> -->', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'HTML', 'creation': '2009-12-07 16:49:50', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'History HTML', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Wiki Page', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL03482', 'idx': 8, 'default': None, 'colour': None, 'modified': '2009-12-09 18:18:55', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'HTML', 'options': '', 'report_hide': None, 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/tools/page/__init__.py b/tools/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/page/__init__.py
diff --git a/tools/page/file_browser/__init__.py b/tools/page/file_browser/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/page/file_browser/__init__.py
diff --git a/tools/page/file_browser/file_browser.html b/tools/page/file_browser/file_browser.html
new file mode 100644
index 0000000..d30409e
--- /dev/null
+++ b/tools/page/file_browser/file_browser.html
@@ -0,0 +1,55 @@
+<div style="margin: 0px;">
+<div id="fb_header">&nbsp;</div>
+<!--
+<table style="border: 1px solid #cccccc; width: 100%; background-color: #dfe1fd; vertical-align: middle; border-collapse: collapse;" border="0">
+<tbody>
+<tr>
+<td style="width: 70%; padding-left: 8px;">
+<h2>File Browser</h2>
+</td>
+<td style="width: 30%; text-align: right; padding-right: 8px; vertical-align: middle;"><span class="link_type" title="Close"> <img style="cursor:pointer" mce_style="cursor:pointer" onclick="nav_obj.show_last_open()" src="images/icons/close.gif" mce_src="images/icons/close.gif" alt="" /> </span></td>
+</tr>
+</tbody>
+</table>
+-->
+<div style="width: 100%;">
+<table style="border: 1px solid #cccccc; width: 100%; border-collapse: collapse;" border="0">
+<tbody>
+<tr>
+<td style="border: 1px solid #cccccc; padding: 8px; width: 40%; border-collapse: collapse;">
+<table style="width: 100%;" border="0">
+<tbody>
+<tr>
+<td id="fb_gen_action" style="width: 100%; vertical-align: middle;">&nbsp;</td>
+</tr>
+<tr>
+<td id="fb_tree_div" style="width: 100%; padding-top: 20px;">&nbsp;</td>
+</tr>
+</tbody>
+</table>
+</td>
+<td style="border: 1px solid #cccccc; padding: 8px; width: 60%; border-collapse: collapse;">
+<table style="width: 100%;" border="0">
+<tbody>
+<tr>
+<td id="fb_file_action" style="width: 100%; vertical-align: middle;">&nbsp;</td>
+</tr>
+<tr>
+<td id="fb_grp_action" style="width: 100%; vertical-align: middle;">&nbsp;</td>
+</tr>
+<tr>
+<td id="fb_display_div" style="width: 100%; vertical-align: middle;">&nbsp;</td>
+</tr>
+<tr>
+<td id="unselect">
+<h2 style="color:#AAA">You have not selected anything.</h2>
+</td>
+</tr>
+</tbody>
+</table>
+</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
\ No newline at end of file
diff --git a/tools/page/file_browser/file_browser.js b/tools/page/file_browser/file_browser.js
new file mode 100644
index 0000000..279bbed
--- /dev/null
+++ b/tools/page/file_browser/file_browser.js
@@ -0,0 +1,992 @@
+pscript['onload_File Browser'] = function(){
+	
+	// header and toolbar
+	var h = new PageHeader('fb_header','File Management','Upload and share your file across users');
+	//$dh(h.toolbar); $y(h.toolbar,{width:'0px', height:'0px'})
+	
+	if(!pscript.fb_tree)
+		pscript.create_browser_tree();
+	pscript.get_root_file_grps();
+	
+	pscript.create_action_widget();
+	pscript.create_display_div();
+
+	pscript.create_n_file_grp_obj();
+	pscript.create_n_file_obj();
+	pscript.create_attach_obj();
+	
+	pscript.get_all_roles();
+	
+	$ds(pscript.gen_div);
+	$dh(pscript.grp_div);
+	$dh(pscript.file_div);
+	
+	$ds($i('unselect'));
+}
+
+// Get all roles
+pscript.get_all_roles = function(){
+	if(!pscript.fg_all_roles){
+		var callback = function(r,rt){
+			pscript.fg_all_roles = r.message ? r.message : '';
+			pscript.create_share_obj();
+			pscript.fg_share.make(r.message);
+		}
+		$c_obj('File Browser Control','get_all_roles','',callback);
+	}
+}
+
+
+// Creating File Browser tree.
+pscript.create_browser_tree = function() {
+
+	$i('fb_tree_div').innerHTML = '';
+	var tree = new Tree($i('fb_tree_div'), '100%');
+	pscript.fb_tree = tree;
+	
+	pscript.fb_tree.std_onclick = function(node) { /*pass*/ }		   // on click
+	pscript.fb_tree.std_onexp = function(node) { /*PASS*/ }			 // on expand
+	
+	$ds(pscript.gen_div);
+	$dh(pscript.grp_div);
+	$dh(pscript.file_div);
+	
+	$dh(pscript.f_file_display);
+}
+
+// Creating a Share Privilege object.
+pscript.create_share_obj = function(){
+	
+	var d = new Dialog(400,400,'Assign Privilege');
+	var me = d;
+	d.inputs = {};
+	
+	d.make_body([
+		['HTML','Privilege','<div id="fg_share_div" style="overflow-y:auto; height:300px"></div>'],
+		['Button','Update']
+	]);
+	
+	
+	d.make = function(all_roles){
+		optn_header = make_table('fg_share_div',1,2,'100%',['60%','40%'],{padding:'4px'});
+
+		for(var c=0;c<2;c++){
+			if(c==1)
+				$td(optn_header,0,c).innerHTML = '<b>Privilege</b>';
+			else
+				$td(optn_header,0,c).innerHTML = '<b>Role</b>';
+		}
+		
+		optn_tbl = make_table('fg_share_div',all_roles.length,2,'100%',['60%','40%'],{padding:'4px'});
+		
+		for(var i=0;i<all_roles.length;i++){
+
+			var v=$a($td(optn_tbl, i,0),'div');
+			v.innerHTML=all_roles[i];
+
+			// make select
+			var sel = $a($td(optn_tbl, i,1),'select');
+			add_sel_options(sel,['None','Edit','View'],'None');
+			
+			sel.r_nm = all_roles[i];
+			d.inputs[sel.r_nm] = sel;
+			
+			sel.onchange = function(){}
+		}
+	}
+
+	// Assigning roles in Share Privilege object.
+	d.assign = function(all_roles,edit_roles,view_roles){
+
+		if(all_roles == undefined) all_roles = '';		
+		if(edit_roles == undefined) edit_roles = '';
+		if(view_roles == undefined) view_roles = '';
+		
+		for(var i=0;i<all_roles.length;i++){
+			var ele = all_roles[i];
+			var sel = me.inputs[ele];
+			
+			if(in_list(edit_roles,ele))
+				sel.value = 'Edit';
+			else if(in_list(view_roles,ele))
+				sel.value = 'View';
+			else
+				sel.value = 'None';
+		}
+	}
+	
+	//on update
+	d.widgets['Update'].onclick = function(){
+		var edit_roles = []; var view_roles = [];
+		
+		for(var i=0;i<pscript.fg_all_roles.length;i++){
+			var ele = pscript.fg_all_roles[i]; var sel = me.inputs[ele];
+
+			if(sel_val(sel) == 'Edit')
+				edit_roles.push(ele)
+			else if(sel_val(sel) == 'View')
+				view_roles.push(ele)
+		}
+
+		var args = {}; args.name = pscript.f_cur_node_name; args.type = pscript.f_cur_node_type;
+		args.edit_roles = edit_roles.join(','); args.view_roles = view_roles.join(',');
+		
+		$c_obj('File Browser Control','update_privileges',docstring(args),function(r,rt){me.hide();});
+	}
+	
+	d.onshow = function(){}	
+	d.onhide = function(){}
+	pscript.fg_share = d;
+}
+
+// Action Widget
+pscript.create_action_widget = function(){
+
+	// General Actions.
+	// new action widget
+	pscript.gen_div = $i('fb_gen_action');
+	
+	//refresh tree
+	f_refresh = $a(pscript.gen_div,'span','',{marginRight:'15px'});
+	f_refresh.innerHTML = '<img src="images/icons/page_refresh.gif" style="margin-right:5px; vertical-align:middle"/><span class="link_type" style="vertical-align:middle">Refresh</span>';
+	f_refresh.onclick = function(){
+		pscript.fb_refresh(); 
+		$dh(pscript.f_file_display);
+	}
+
+	// new group
+	f_new_grp = $a(pscript.gen_div,'span','',{marginRight:'15px'});
+	f_new_grp.innerHTML = '<img src="images/icons/folder.gif" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">New</span>';
+	f_new_grp.onclick = function(){ pscript.fb_show_grp(''); $ds(pscript.f_file_display); $dh($i('unselect')); }
+
+	// Group actions.	
+	pscript.grp_div = $i('fb_grp_action');
+	
+	// share group
+	f_share_grp = $a(pscript.grp_div,'span','',{marginRight:'15px'});
+	f_share_grp.innerHTML = '<img src="images/icons/user.png" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">Share</span>';
+	f_share_grp.onclick = function(){ pscript.fb_share(); }
+	
+	//Delete group.
+	f_del_grp = $a(pscript.grp_div,'span','',{marginRight:'15px'});
+	f_del_grp.innerHTML = '<img src="images/icons/cancel.gif" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">Delete</span>';
+	f_del_grp.onclick = function(){ pscript.fb_delete(); }
+	
+	// Add file to group.
+	f_new_file = $a(pscript.grp_div,'span','',{marginRight:'15px'});
+	f_new_file.innerHTML = '<img src="images/icons/page_add.gif" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">Upload</span>';
+	f_new_file.onclick = function(){ pscript.fb_create_new_file(); }
+   // $dh(f_new_file);
+	
+	// file actions
+	pscript.file_div = $i('fb_file_action');
+
+
+	//share file
+	f_share_file = $a(pscript.file_div,'span','',{marginRight:'15px'});
+	f_share_file.innerHTML = '<img src="images/icons/user.png" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">Share</span>';
+	f_share_file.onclick = function(){ pscript.fb_share(); };
+	
+	// delete file
+	f_del_file = $a(pscript.file_div,'span','',{marginRight:'15px'});
+	f_del_file.innerHTML = '<img src="images/icons/cancel.gif" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">Delete</span>';
+	f_del_file.onclick = function(){ pscript.fb_delete(); };
+	
+		
+	//edit file
+	f_edit_file = $a(pscript.file_div,'span','',{marginRight:'15px'});
+	f_edit_file.innerHTML = '<img src="images/icons/table_edit.png" style="margin-right: 5px; vertical-align:middle"><span class="link_type" style="vertical-align:middle">Edit</span>';
+	f_edit_file.onclick = function(){ pscript.fb_edit_file(); };
+}
+
+
+// Refresh tree
+pscript.fb_refresh = function(){
+	pscript.create_browser_tree();
+	pscript.get_root_file_grps();
+	
+	$ds(pscript.gen_div);
+	$dh(pscript.grp_div);
+	$dh(pscript.file_div);
+	
+	if(!pscript.f_cur_node_name){ $dh($i('unselect')); } else{ $ds($i('unselect')); }
+}
+
+// Show selected / create a new file group.
+pscript.fb_show_grp = function(grp){
+	var parent = pscript.f_file_display;
+
+	if(!grp || grp == undefined){
+		parent.f_file_title.innerHTML = 'New File Group';
+		pscript.n_file_grp.show('');
+	}
+	else{
+		var callback = function(r,rt){
+
+			var grp_det = r.message ? r.message : '';
+
+			parent.f_file_title.innerHTML = grp_det['Group Name']; 
+			if(has_common(grp_det['Can Edit'].split(','),user_roles) || user==grp_det['Owner']){ $ds(pscript.grp_div); }
+			else{ $dh(pscript.grp_div); }
+			
+			pscript.n_file_grp.show(grp_det);
+		}
+		$c_obj('File Browser Control','get_fg_details',grp,callback);
+	}
+	$ds(parent); $ds(parent.f_file_content);
+}
+
+//share privileges.
+pscript.fb_share = function(){
+	var callback = function(r,rt){
+		pscript.fg_edit_roles = r.message[0][0] ? r.message[0][0].split(',') : '';
+		pscript.fg_view_roles = r.message[0][1] ? r.message[0][1].split(',') : '';
+		
+		pscript.fg_share.assign(pscript.fg_all_roles,pscript.fg_edit_roles,pscript.fg_view_roles);
+		pscript.fg_share.show();
+	}
+	var args = {};
+	args.dt = pscript.f_cur_node_type;
+	args.dn = pscript.f_cur_node_name;
+	$c_obj('File Browser Control','get_privileges',docstring(args),callback);
+}
+
+// delete group
+pscript.fb_delete = function(){
+	pscript.delete_node('File Browser Control',pscript.f_cur_node_type,pscript.f_cur_node_name,'');
+	$dh(pscript.f_file_display);
+}
+
+// Create a new file.
+pscript.fb_create_new_file = function(){
+	var parent = pscript.f_file_display;
+	
+	pscript.f_cur_parent = pscript.f_cur_node;
+	
+	parent.f_file_title.innerHTML = 'New File';
+	pscript.n_file.show(0,'frm_node');
+}
+
+// If file other than image then download file.
+pscript.fb_show_txt_file = function(){
+	$i('file_link').href = repl('cgi-bin/getfile.cgi?ac=%(acc)s&name=%(f_nm)s',{acc:session.account_name, f_nm:pscript.f_cur_node_file});
+	$i('file_link').target = "_blank";
+}
+
+// Area to display content.
+pscript.create_display_div = function(){
+
+	var d = $a($i('fb_display_div'),'div');
+	
+	d.f_file_title = $a(d,'div','',{fontSize:'14px',fontWeight:'bold'});
+	$y($a(d,'div'),{margin:'5px 0px 5px 0px',borderBottom:'1px solid #333'});
+
+	d.f_file_content = $a(d,'div','',{marginTop:'20px'});
+	pscript.f_file_display = d;
+	$dh(d);
+}
+
+// function to create a new File Group object.
+pscript.create_n_file_grp_obj = function(){
+	var n_file_grp = new pscript.n_file_grp_Obj();
+	pscript.n_file_grp = n_file_grp;
+}
+
+// Create a new File object.
+pscript.create_n_file_obj = function(){
+	var n_file = new pscript.n_file_Obj();
+	pscript.n_file = n_file;
+}
+
+// Create a new Attachement object.
+pscript.create_attach_obj = function(){
+	var attach_obj = new pscript.attach_Obj();
+	pscript.attach_obj = attach_obj;
+}
+
+// File Group object.
+pscript.n_file_grp_Obj = function() {
+  
+	this.inputs = {}; var me = this; this.fg_field_lst = [];
+	
+	this.make_section = function(label, tp, css) {
+
+		var div = $a(this.wrapper,'div','',{marginBottom:'8px'});
+		var t = make_table(div,1,2,'90%',['35%','65%']);
+
+		if(tp=='button'){
+			var element = $a($td(t,0,1), 'button', 'button');
+			element.innerHTML = label;
+		}
+		else if(tp == 'link'){
+			var element = make_field({fieldtype:'link', 'label':label, 'options':'File Group'}, '', $td(t,0,1), this, 0, 1);
+			$y($td(t,0,1),{width:'100%'})
+			element.in_filter = 1; element.refresh();
+			
+			$td(t,0,0).innerHTML = label;
+			element.display_div = $a($td(t,0,1),'div', '', {width:'80%'});
+			me.fg_field_lst.push(label);
+		}
+		else {
+			var element = $a($td(t,0,1),tp, '', {width:'80%'});
+			$td(t,0,0).innerHTML = label;
+			
+			element.display_div = $a($td(t,0,1),'div', '', {width:'80%'});
+			$dh(element.display_div);
+			me.fg_field_lst.push(label);
+		}
+		
+		if(css){
+			$y($td(t,0,0),css);
+		}
+		
+		element.wrapper = div;
+		
+		if(label) me.inputs[label] = element;
+		return element;
+	}
+  
+	this.make = function() {
+
+		this.wrapper = document.createElement('div');
+
+		this.make_section('Group Name','input',{color:'red'});
+		this.make_section('Parent Group','link');
+		this.make_section('Description','textarea');
+		$y(this.inputs['Description'],{height:'140px'});
+		
+		this.make_section('Save','button');
+
+		// cancel
+		this.inputs['Cancel'] = $a(this.inputs['Save'].parentNode, 'button', 'button');
+		this.inputs['Cancel'].innerHTML = 'Cancel';
+		$y(this.inputs['Cancel'], {marginLeft:'8px'});
+	}
+  
+	this.show = function(grp_det){
+		
+		if(! me.wrapper) me.make();
+
+		var field_lst = me.fg_field_lst;
+
+		if(!grp_det || grp_det == undefined){
+			pscript.fg_edit_roles = ''; pscript.fg_view_roles = ''; me.inputs['Save'].disabled = false;
+		
+			for(i in field_lst){
+				var fld_nm = field_lst[i] ? field_lst[i] : '';
+				var fld = me.inputs[fld_nm] ? me.inputs[fld_nm] : '';
+				fld.display_div.innerHTML = '';
+				
+				if(fld_nm == 'Parent Group'){ fld.txt.value = ''; $ds(fld.input_area); }
+				else{ fld.value = ''; $ds(fld); }
+				
+				$dh(fld.display_div); 
+			}
+			me.inputs['Save'].onclick = function(){ me.save(''); }
+		}
+		else{
+			pscript.fg_edit_roles = grp_det['Can Edit'] ? grp_det['Can Edit'].split(',') : '';
+			pscript.fg_view_roles = grp_det['Can View'] ? grp_det['Can View'].split(',') : '';		
+			for(i in field_lst){
+				var fld_nm = field_lst[i] ? field_lst[i] : '';
+				var fld = me.inputs[fld_nm] ? me.inputs[fld_nm] : '';
+				fld.display_div.innerHTML = grp_det[fld_nm] ? grp_det[fld_nm] : '';
+
+				if(fld_nm == 'Parent Group') fld.txt.value = grp_det[fld_nm] ? grp_det[fld_nm] : '';
+				else fld.value = grp_det[fld_nm] ? grp_det[fld_nm] : '';
+									
+				if(has_common(pscript.fg_edit_roles,user_roles) || user == grp_det['Owner']){
+					if(fld_nm == 'Parent Group') $ds(fld.input_area); else $ds(fld); 
+					$dh(fld.display_div); me.inputs['Save'].disabled = false;
+				}
+				else{
+					if(fld_nm == 'Parent Group') $dh(fld.input_area); else $dh(fld);
+					$ds(fld.display_div); me.inputs['Save'].disabled = true;
+				}
+			}
+			me.inputs['Save'].onclick = function(){ me.save(grp_det['Name']); }
+		}
+		me.show_as();
+		me.inputs['Cancel'].onclick = function() { me.cancel(); me.hide();}
+	}
+  
+	this.save = function(name) {
+		var grp_nm = me.inputs['Group Name'].value; grp_nm = strip(grp_nm," ");
+		var parent_grp = me.inputs['Parent Group'].get_value(); parent_grp = strip(parent_grp," ");
+		var desc = me.inputs['Description'].value; desc = strip(desc," ");
+		
+		if(grp_nm == '') msgprint('Please enter group name');
+		else{ var args = {}; args.grp_nm = grp_nm; args.parent_grp = parent_grp; args.desc = desc; }
+		
+		if(!name || name == undefined){
+			args.name = '';
+			var callback = function(r,rt){
+				pscript.f_cur_node_name = r.message ? r.message : '';
+				pscript.fb_show_grp(pscript.f_cur_node_name);
+				pscript.fb_refresh();
+				//if(!pscript.f_cur_parent){ pscript.fb_refresh(); pscript.f_cur_node_name = }
+				//else{ pscript.load_child_nodes(); }
+			}
+			$c_obj('File Browser Control','create_new_grp',docstring(args),callback);
+		}
+		else{
+			args.name = name;
+			var callback = function(r,rt){
+				var grp = r.message ? r.message : '';
+				pscript.fb_show_grp(grp);
+				pscript.fb_refresh();
+			}
+			$c_obj('File Browser Control','update_grp',docstring(args),callback);
+		}
+		
+	}
+  
+	this.cancel = function(){
+		$dh(pscript.f_file_display);this.hide();
+	}
+  
+	this.show_as = function() {
+		if(me.wrapper.parentNode) me.wrapper.parentNode.removeChild(me.wrapper);
+		
+		var parent = pscript.f_file_display;
+		pscript.remove_child_nodes(parent.f_file_content);
+
+		parent.f_file_content.appendChild(me.wrapper);
+		$ds(pscript.f_file_display); $ds(me.wrapper);
+	}
+  
+	this.hide = function() {
+		$dh(me.wrapper); me.display = 0;
+	}
+}
+
+// File Object.
+pscript.n_file_Obj = function() {
+
+	this.inputs = {};
+	var me = this;
+	
+	this.make_section = function(label, tp, css) {
+
+		var div = $a(this.wrapper,'div','',{marginBottom:'8px'});
+		var t = make_table(div,1,2,'90%',['38%','62%']);
+		
+		if(tp=='button'){
+			var element = $a($td(t,0,1), 'button', 'button');
+			element.innerHTML = label;
+		}
+		else if(tp=='Note'){
+			var element = $a($td(t,0,1),'span','',{color:'red'});
+			element.innerHTML = 'Fields in red are mandatory.'
+		}
+		else if(tp=='link'){
+			var element = make_field({fieldtype:'link', 'label':label, 'options':'File Group'}, '', $td(t,0,1), this, 0, 1);
+			$y($td(t,0,1),{width:'100%'})
+			element.in_filter = 1; element.refresh();
+			
+			$td(t,0,0).innerHTML = label;
+			element.display_div = $a($td(t,0,1),'div', '', {width:'80%'});
+			element.txt.onchange = function(){ pscript.set_file_det_value(pscript.attach_obj,pscript.n_file); }
+		}
+		else {
+			var element = $a($td(t,0,1),tp, '', {width:'95%'});
+			$td(t,0,0).innerHTML = label;
+			element.onchange = function(){ pscript.set_file_det_value(pscript.attach_obj,pscript.n_file); }
+		}
+
+		//---css to label---
+		if(css){
+			$y($td(t,0,0),css);
+		}
+	
+		element.wrapper = div;
+		
+		if(label) me.inputs[label] = element;
+		return element;
+	}
+
+	this.make = function() {
+
+		this.wrapper = document.createElement('div');
+		
+		// note
+		this.make_section('','Note');
+		
+		// upload area
+		this.ul_area = $a(this.wrapper,'div','',{marginBottom:'8px'});
+		$dh(this.ul_area);
+		
+		// file group and description
+		this.make_section('File Group','link',{color:'red'});
+		this.make_section('Description','textarea');
+		$y(this.inputs['Description'],{height:'140px'});
+
+		//save
+		this.make_section('Save','button');$dh(this.inputs['Save']);
+
+		// cancel
+		this.inputs['Cancel'] = $a(this.inputs['Save'].parentNode, 'button', 'button');
+		this.inputs['Cancel'].innerHTML = 'Cancel'; $dh(this.inputs['Cancel']);
+		$y(this.inputs['Cancel'], {marginLeft:'8px'});
+	}
+  
+	this.show = function(edit,frm){
+		if(! me.wrapper) me.make();
+		
+		if(edit){
+			var callback1 = function(r,rt){
+				file_det = r.message;
+			
+				me.inputs['Description'].value = file_det['description'] ? file_det['description'] : '';
+				me.inputs['File Group'].txt.value = file_det['file_group'] ? file_det['file_group'] : '';
+
+				pscript.f_cur_node_file = file_det['file_list'] ? file_det['file_list'].split(NEWLINE)[0].split(',')[1] : '';
+
+				me.inputs['Save'].file_id = file_det['name'] ? file_det['name'] : '';
+				me.inputs['Save'].onclick = function(){ me.save(this.file_id);}
+				pscript.attach_obj.show(me, me.ul_area, 1, file_det);
+			}
+			$ds(me.ul_area); $di(me.inputs['Save']); $di(me.inputs['Cancel']);
+			$c_obj('File Browser Control','get_file_details',pscript.f_cur_node_name,callback1);
+		}
+		else{
+			$ds(me.ul_area); $dh(me.inputs['Save']); $dh(me.inputs['Cancel']);
+
+			me.inputs['Description'].value = '';
+			if(frm == 'frm_node') me.inputs['File Group'].txt.value = pscript.f_cur_node_label;
+			var parent = pscript.f_file_display;
+			parent.f_file_title.innerHTML = 'New File';
+			
+			$ds(parent);
+			me.inputs['Save'].onclick = function(){ me.save('');}
+			pscript.attach_obj.show(me,me.ul_area,0,'');
+		}
+		me.inputs['Cancel'].onclick = function() { me.cancel(); me.hide(); }
+	}
+  
+	this.save = function(name) {
+
+		var desc = me.inputs['Description'].value; desc = strip(desc," ");
+		file_grp = me.inputs['File Group'].txt.value; file_grp = strip(file_grp," ");
+		
+		if(file_grp == '') msgprint('Please select file group');
+
+		var args = {}; args.desc = desc; args.file_grp = file_grp;
+		
+		if(name){
+			args.name = name;
+			var callback = function(){
+				//pscript.fb_edit_file();
+				
+				//refreshing parent
+				pscript.load_child_nodes();
+			}
+			$c_obj('File Browser Control','update_file',docstring(args),callback);
+		}
+		else{
+			args.name = ''
+			var callback = function(r,rt){
+				var f = eval('var a='+r.message+';a');
+				
+				//refreshing node
+				pscript.load_child_nodes();
+				
+				//pscript.f_cur_node_name = f.name; pscript.f_cur_node_label = f.label;
+				//pscript.fb_edit_file();
+			}
+			$c_obj('File Browser Control','create_new_file',docstring(args),callback);
+		}
+	}
+  
+	this.cancel = function(){
+		$dh(pscript.f_file_display); this.hide();
+	}
+  
+	this.show_as = function(edit) {
+	    if(me.wrapper.parentNode) me.wrapper.parentNode.removeChild(me.wrapper);
+	
+		var parent = pscript.f_file_display;
+		pscript.remove_child_nodes(parent.f_file_content);
+
+		parent.f_file_content.appendChild(me.wrapper);
+		$ds(pscript.f_file_display); $ds(parent.f_file_content);
+		$ds(me.wrapper);
+	}
+  
+	this.hide = function() {
+		$dh(me.wrapper);
+		me.display = 0;
+	}
+}
+
+// File Attachement object.
+pscript.attach_Obj = function(){
+
+	var me = this;
+		
+	this.show = function(obj,parent,edit,dict){
+		var me = this;
+		if(!me.wrapper) { me.make(); }
+
+		me.show_as(obj,parent,edit,dict);
+		obj.show_as(edit);
+	}
+
+	this.make = function(){
+		var me = this;
+		this.wrapper = document.createElement('div');
+		
+		var div = $a(this.wrapper,'div',{marginBottom:'8px', border:'1px solid #AAA'});
+		
+		var t1 = make_table(div,1,2,'90%',['38%','62%']);
+		
+		lbl_area = $a($td(t1,0,0),'div');
+		lbl_area.innerHTML = '<img src="images/icons/paperclip.gif"><span style="margin-left4px; color:red;">File:</span><br>';
+	
+		main_area = $a($td(t1,0,1),'div');
+		
+		this.upload_div = $a(main_area,'div');
+		this.download_div = $a(main_area,'div');
+			
+		me.make_ul_area();
+		me.make_dl_area();
+	}
+	
+	//image upload area
+	this.make_ul_area = function(){
+		var me = this;
+		
+		this.upload_div.innerHTML = '';
+
+		var div = $a(this.upload_div,'div');
+		div.innerHTML = '<iframe id="fb_iframe" name="fb_iframe" src="blank1.html" style="width:0px; height:0px; border:0px"></iframe>';
+
+		var div = $a(this.upload_div,'div');
+		div.innerHTML = '<form method="POST" enctype="multipart/form-data" action="'+outUrl+'" target="fb_iframe"></form>';
+
+		var ul_form = div.childNodes[0];
+		
+		this.upload_div.ul_form = ul_form;
+		
+		var f_list = [];
+
+		// file data
+		var inp_fdata = $a_input($a(ul_form,'span'),'file',{name:'filedata'});
+
+		var inp_btn = $a_input($a(ul_form,'span'),'hidden',{name:'cmd'}); inp_btn.value = 'upload_many';
+		var inp = $a_input($a(ul_form,'span'),'hidden',{name:'form_name'}); inp.value = 'File Browser';
+		var inp = $a_input($a(ul_form,'span'),'submit'); inp.value = 'Upload';
+		
+		this.inp_file = $a_input($a(ul_form,'span'),'hidden',{name:'file_id'});
+		this.file_det = $a_input($a(ul_form,'span'),'hidden',{name:'file_det'});
+
+		inp_btn.onclick = function(){
+			pscript.set_file_det_value(pscript.attach_obj,pscript.n_file);
+		}
+	}
+	
+	//download link
+	this.make_dl_area = function(){
+		var me = this;
+		var download_tbl = make_table(this.download_div,1,2,'100%',['70%','30%']);
+		
+		var download_link = $a($td(download_tbl,0,0),'a','link_type');
+		
+		this.download_div.download_link = download_link;
+		
+		var remove_link = $a($td(download_tbl,0,1),'span','link_type',{textAlign:'right',marginLeft:'20px'});
+		remove_link.innerHTML = 'Remove';
+		
+		this.download_div.remove_link = remove_link;		
+	}
+	
+	this.show_as = function(obj,parent,edit,dict){
+		var me = this;
+		
+		// add to parent
+		if(me.wrapper.parentNode) me.wrapper.parentNode.removeChild(me.wrapper);
+		parent.appendChild(me.wrapper);
+		$ds(me.wrapper);
+		
+		if(edit){
+			pscript.set_file_det_value(pscript.attach_obj,pscript.n_file);
+			me.inp_file.value = dict.name ? dict.name : '';
+   
+			if(dict.file_list){ $dh(me.upload_div); $ds(me.download_div); }
+			else{ $ds(me.upload_div); $dh(me.download_div); }
+			
+			// download
+			me.download_div.download_link.innerHTML = dict.file_list ? dict.file_list.split(',')[0] : '';
+			me.download_div.download_link.onclick = function(){
+				this.href = repl('cgi-bin/getfile.cgi?ac=%(acc)s&name=%(f_nm)s',{acc:session.account_name, f_nm:pscript.f_cur_node_file});
+				this.target = "_blank";
+			}
+			
+			// remove
+			me.download_div.remove_link.onclick = function(){
+				$c_obj('File Browser Control','remove_file',docstring(dict),function(r,rt){
+					pscript.n_file.show(0,'frm_remove');
+				});
+				$ds(me.upload_div); $dh(me.download_div);
+			}
+		}
+		else{
+			$ds(me.upload_div); $dh(me.download_div);
+			me.inp_file.value = '';
+			pscript.set_file_det_value(pscript.attach_obj,pscript.n_file);
+		}
+	}
+}
+
+// Get all root file groups(where Parent Group is null).
+pscript.get_root_file_grps = function(){
+
+	if (pscript.fb_tree){
+		pscript.fb_tree.body.innerHTML = '';
+	}
+  
+	var callback1 = function(r,rt){
+		var cl = r.message ? r.message : ''; var n = pscript.fb_tree.allnodes[cl]; var has_children = true;
+		
+		for(var i=0; i<cl.length;i++){
+			if(!cl[i][2] || cl[i][2] == undefined) cl[i][2] = ''; if(!cl[i][3] || cl[i][3] == undefined) cl[i][3] = '';
+			if(has_common(cl[i][2].split(','),user_roles) || has_common(cl[i][3].split(','),user_roles) || user == cl[i][4]){
+				var r = pscript.fb_tree.addNode(null, cl[i][0],'', pscript.show_hide_link , has_children ? pscript.fb_get_children : null, null, cl[i][1]);
+				r.rec = cl[i]; r.rec.name = cl[i][0]; r.rec.label = cl[i][1]; r.rec.parent_grp = ''; r.rec.file_list = ''; r.rec.type = 'File Group';
+			}
+		}
+	}
+	$c_obj('File Browser Control','get_root_file_grps','',callback1);
+}
+
+// Onclick of a tree node will show / hide corresponding actions from action widget.
+pscript.show_hide_link = function(node){
+
+	$dh($i('unselect'));
+	$dh(pscript.f_file_display);
+	
+	pscript.f_cur_node = node;
+	
+	if(node.parent){
+		pscript.f_cur_parent = node.parent;
+	}
+	else{ pscript.f_cur_parent = ''; }
+	
+	pscript.f_cur_node_name = node.rec.name;
+
+	if(node.rec.label){ pscript.f_cur_node_label = node.rec.label; }
+	else{ pscript.f_cur_node_label = ''; }
+	
+	if(node.rec.type){ pscript.f_cur_node_type = node.rec.type; }
+	else{ pscript.f_cur_node_type = ''; }
+	
+	if(node.rec.file_list){ pscript.f_cur_node_file = node.rec.file_list.split(NEWLINE)[0].split(',')[1]; }
+	else{ pscript.f_cur_node_file = ''; }
+
+	img_extns = ['jpg','jpeg','gif','png','biff','cgm','dpof','exif','img','mng','pcx','pic','pict','raw','tga','wmf']
+	extn = node.rec.file_list ? node.rec.file_list.split(NEWLINE)[0].split(',')[0].split('.')[1] : '';
+
+	var dsp_div = pscript.f_file_display;
+	dsp_div.f_file_title.innerHTML = pscript.f_cur_node_label;
+
+	if(node.rec.type == 'File Group'){
+		$dh(pscript.file_div);
+		$ds(pscript.grp_div);
+		pscript.fb_show_grp(pscript.f_cur_node_name);
+	}
+	else if(node.rec.type == 'File'){
+		$dh(pscript.grp_div);
+		$ds(pscript.file_div);
+		if(pscript.f_cur_node_file){
+			if(inList(img_extns,extn)){
+				pscript.fb_show_img();
+			}
+			else{
+				// IE FIX
+				pscript.remove_child_nodes(dsp_div.f_file_content);
+				
+				var div = document.createElement('div');
+				div.innerHTML = '<a class="link_type" onclick="pscript.fb_show_txt_file()" id="file_link">Click to Open/ Download file.</span>';				
+				dsp_div.f_file_content.appendChild(div);
+				$ds(dsp_div);
+			}
+		}
+		else{
+			dsp_div.f_file_content.innerHTML = 'No attachement found.';
+			$ds(pscript.f_file_display);
+			
+			$ds(pscript.file_div);
+			$dh(pscript.grp_div);			
+		}
+		pscript.show_edit_file_link(node.rec.name);
+	}
+	else{
+		$dh(pscript.grp_div);
+		$dh(pscript.file_div);
+	}
+}
+
+// Onexpand of a tree node get all childrens(Files / File Groups).
+pscript.fb_get_children = function(node){
+	if(node.expanded_once) return;
+	$ds(node.loading_div);
+	
+	var callback = function(r,rt){
+		var p = pscript.fb_tree.allnodes[r.message.parent_grp];
+		$dh(node.loading_div);
+
+		var fl = r.message.fl ? r.message.fl : '';
+		if(fl){
+			for(var i=0; i<fl.length; i++){
+				if(fl[i][3] == undefined) fl[i][3] = '';
+				if(fl[i][4] == undefined) fl[i][4] = '';
+				
+				if(has_common(fl[i][3].split(','),user_roles) || has_common(fl[i][4].split(','),user_roles) || (user == fl[i][5])){
+					var imgsrc = 'images/icons/page.gif'; var has_children = false; 
+					if(fl[i][1]) var label = fl[i][1]; else var label = fl[i][0];
+
+					var n = pscript.fb_tree.addNode(p,fl[i][0],imgsrc,pscript.show_hide_link,has_children ? pscript.fb_get_children:null,null,label);
+					n.rec = fl[i]; n.rec.name = fl[i][0]; n.rec.parent_grp = r.message.parent_grp;
+					n.rec.label = fl[i][1]; n.rec.file_list = fl[i][2]; n.rec.type = 'File';
+				}
+			}
+		}
+		
+		var fl_grp = r.message.fl_grp ? r.message.fl_grp : '';
+		if(fl_grp){
+			for(var i=0;i<fl_grp.length;i++){
+				if(fl_grp[i][2] == undefined) fl_grp[i][2] = '';
+				if(fl_grp[i][3] == undefined) fl_grp[i][3] = '';
+
+				if(has_common(fl_grp[i][2].split(','),user_roles) || has_common(fl_grp[i][3].split(','),user_roles) || (user == fl_grp[i][4])){
+					var imgsrc = 'images/icons/folder.gif'; var has_children = true;
+					var label = fl_grp[i][1] ? fl_grp[i][1] : fl_grp[i][0];
+
+					var n = pscript.fb_tree.addNode(p,fl_grp[i][0],imgsrc,pscript.show_hide_link,has_children ? pscript.fb_get_children:null,null,label);
+					n.rec = fl_grp[i]; n.rec.name = fl_grp[i][0]; n.rec.parent_grp = r.message.parent_grp;
+					n.rec.label = fl_grp[i][1]; n.rec.file_list = ''; n.rec.type='File Group';
+				}
+			}
+		}
+	}
+	$c_obj('File Browser Control','get_children',node.rec.name,callback);
+}
+
+// If image file then display image.
+pscript.fb_show_img = function(){
+
+	var parent = pscript.f_file_display;
+
+	parent.f_file_title.innerHTML = pscript.f_cur_node_label;
+	pscript.remove_child_nodes(parent.f_file_content);
+
+	var a = $a(parent.f_file_content,'a');
+	
+	var img = $a(a,'img','',{textAlign:'center',cursor:'pointer'}); 
+	img.src = repl('cgi-bin/getfile.cgi?ac=%(acc)s&name=%(f_nm)s&thumbnail=300',{acc:session.account_name, f_nm:pscript.f_cur_node_file});
+	$ds(pscript.f_file_display);
+
+	a.onclick = function(){
+		this.href = repl('cgi-bin/getfile.cgi?ac=%(acc)s&name=%(f_nm)s',{acc:session.account_name, f_nm:pscript.f_cur_node_file});
+		this.target = "_blank";
+	}
+}
+
+// Enable/ disable Edit File action.
+pscript.show_edit_file_link = function(){
+	
+	var callback = function(r,rt){
+			pscript.f_edit_roles = r.message[0][0] ? r.message[0][0].split(',') : '';
+			pscript.f_view_roles = r.message[0][1] ? r.message[0][1].split(',') : '';
+			
+			if(has_common(pscript.f_edit_roles,user_roles) || user == r.message[0][2]){
+				$ds(pscript.file_div);
+			}
+			else{ $dh(pscript.file_div); }
+	}
+	
+	var args = {};
+	args.dt = pscript.f_cur_node_type;
+	args.dn = pscript.f_cur_node_name;
+	$c_obj('File Browser Control','get_privileges',docstring(args),callback);
+}
+
+// Set file detail in attachement object.
+pscript.set_file_det_value = function(att,file){
+	if(file.inputs['Description'].value) file_desc = file.inputs['Description'].value; else file_desc = 'NIL';
+	if(file.inputs['File Group'].txt.value) file_grp = file.inputs['File Group'].txt.value; else file_grp = 'NIL';
+	att.file_det.value = file_desc + '~~' + file_grp;
+}
+
+// Edit selected file.
+pscript.fb_edit_file = function(){
+	var parent = pscript.f_file_display;
+	parent.f_file_title.innerHTML = pscript.f_cur_node_label;
+	pscript.n_file.show(1,'frm_node');
+}
+
+//delete dialog structure
+
+pscript.delete_node = function(sdt,dt,dn,callback){
+	if(!pscript.delete_dialog){
+		var delete_dialog = new Dialog(400,200);
+
+		delete_dialog.make_body([
+			['HTML','Message',''],
+			['HTML','Response',''],
+			['HTML','Delete Record','<div id="delete_record" style="height:25px"></div>']
+		]);
+		
+		delete_dialog.y_btn = $a($i('delete_record'),'button','button');
+		delete_dialog.y_btn.innerHTML = 'Ok';
+		delete_dialog.y_btn.onclick = function(){
+			delete_dialog.widgets['Response'].innerHTML = 'Deleting...';
+			var args = {};
+			args.dt = delete_dialog.dt; args.dn = delete_dialog.dn;
+			
+			var callback1 = function(r,rt){
+				delete_dialog.onhide = delete_dialog.callback;
+				delete_dialog.hide();
+				
+				//refreshing node
+				pscript.load_child_nodes();
+			}
+			$c_obj(sdt,'delete',docstring(args),callback1);
+		}
+		
+		delete_dialog.n_btn = $a($i('delete_record'),'button','button');
+		delete_dialog.n_btn.innerHTML = 'Cancel';
+		
+		delete_dialog.n_btn.onclick = function(){
+			delete_dialog.widgets['Response'].innerHTML = '';
+			delete_dialog.onhide = '';
+			delete_dialog.hide();
+		}
+
+		delete_dialog.widgets['Message'].innerHTML = 'Note: All data will be deleted permanantly. Do you want to continue?';
+		pscript.delete_dialog = delete_dialog;
+	}
+	//if(!delete_dialog.display) delete_dialog.show();
+	pscript.delete_dialog.show();
+	pscript.delete_dialog.widgets['Response'].innerHTML = '';
+	pscript.delete_dialog.sdt = sdt; pscript.delete_dialog.dt=dt; pscript.delete_dialog.dn=dn; pscript.delete_dialog.callback = callback;
+}
+
+pscript.remove_child_nodes = function(parent){
+	var len = parent.childNodes.length;
+	if(len){
+		for(l=0; l<len; l++){
+			var c = parent.childNodes[0];
+			parent.removeChild(c);
+		}
+	}
+}
+
+pscript.load_child_nodes = function(){
+	if(pscript.f_cur_parent){
+		pscript.f_cur_parent.clear_child_nodes();
+		pscript.f_cur_parent.expand();
+		pscript.f_cur_parent.select();
+	}
+	else{ pscript.fb_refresh(); }
+}
\ No newline at end of file
diff --git a/tools/page/file_browser/file_browser.txt b/tools/page/file_browser/file_browser.txt
new file mode 100644
index 0000000..fa4f4a1
--- /dev/null
+++ b/tools/page/file_browser/file_browser.txt
@@ -0,0 +1,194 @@
+[
+	{
+		'content': None,
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': '',
+		'idx': None,
+		'menu_index': None,
+		'modified': '2010-09-25 00:00:00',
+		'modified_by': 'Administrator',
+		'module': 'Tools',
+		'name': 'File Browser',
+		'owner': 'Administrator',
+		'page_name': 'File Browser',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': 1,
+		'standard': 'Yes',
+		'static_content': '',
+		'style': ''
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 1,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000031',
+		'owner': 'Administrator',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Administrator'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 2,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000032',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Sales User'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 3,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000033',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Sales Manager'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 4,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000034',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'System Manager'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 5,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000035',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Purchase User'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 6,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000036',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Purchase Manager'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 7,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000037',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Accounts User'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 8,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000038',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Accounts Manager'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 9,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000039',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Production User'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 10,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000040',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Production Manager'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 11,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000041',
+		'owner': 'saumil@webnotestech.com',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Material User'
+	},
+	{
+		'creation': '2010-11-30 17:25:41',
+		'docstatus': 0,
+		'doctype': 'Page Role',
+		'idx': 12,
+		'modified': '2010-11-30 17:25:41',
+		'modified_by': 'Administrator',
+		'name': 'PR000042',
+		'owner': 'Administrator',
+		'parent': 'File Browser',
+		'parentfield': 'roles',
+		'parenttype': 'Page',
+		'role': 'Customer'
+	}
+]
\ No newline at end of file
diff --git a/tools/page/messages/__init__.py b/tools/page/messages/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/page/messages/__init__.py
diff --git a/tools/page/messages/messages.html b/tools/page/messages/messages.html
new file mode 100644
index 0000000..ded3393
--- /dev/null
+++ b/tools/page/messages/messages.html
@@ -0,0 +1,2 @@
+<div id="message_header" style="margin-bottom: 8px"></div>
+<div id="inbox_tabs"></div>
\ No newline at end of file
diff --git a/tools/page/messages/messages.js b/tools/page/messages/messages.js
new file mode 100644
index 0000000..258961d
--- /dev/null
+++ b/tools/page/messages/messages.js
@@ -0,0 +1,929 @@
+pscript.onload_Messages = function() {
+  var p = new PageHeader($i('message_header'),'Messages');
+  pscript.msg_struct = new Message();
+}
+
+pscript.onshow_Messages = function() {
+  pscript.msg_struct.show_inbox();
+}
+
+function Message(){
+  if(!this.mytabs) this.make_body();
+}
+
+Message.prototype.make_body = function() {
+  var me = this;
+  this.mytabs = new TabbedPage($i('inbox_tabs'));
+  $y(this.mytabs.body_area, {padding:'16px'})
+
+  me.make_inbox();
+  me.make_compose();
+  me.make_sent();
+  
+  this.mytabs.tabs['Inbox'].show();
+}
+
+Message.prototype.make_inbox = function() {
+  var me = this;
+  
+  //inbox tab
+  me.mytabs.add_tab('Inbox', function() { 
+    me.inbox_lst.generate_unread_lst();
+    me.inbox_lst.msg_li.run(); 
+    me.cur_inbox_list = me.inbox_lst.msg_li; // for refresh
+  });
+  
+  if(!this.inbox_lst) this.inbox_lst = new MessageList(me.mytabs.tabs['Inbox'].tab_body, 'inbox msg');
+  this.inbox_lst.msg_li.get_query = function() {
+    //me.checked_msg_lst = [];
+    me.all_msg = {};
+    this.query = repl("select distinct t1.name, t1.last_updated_on, t1.last_updated_by, t1.subject, t3.first_name, t3.file_list, t1.message_date, t1.owner, t1.message, t1.previous_updated_by from `tabMail` t1, `tabMail Participant Details` t2, `tabProfile` t3 where t1.is_main_thread='Yes' and t2.participant_name='%(user)s' and (t2.delete_status is NULL or t2.delete_status = 'No') and t1.name = t2.parent and ((t1.last_updated_by = t3.name and t1.last_updated_by!='%(user)s') or (t1.previous_updated_by = t3.name and t1.previous_updated_by!='%(user)s')) order by t1.modified desc", {'user':user});
+    
+    this.query_max = repl("select distinct count(t1.name) from `tabMail` t1, `tabMail Participant Details` t2, `tabProfile` t3 where t1.is_main_thread='Yes' and t2.participant_name='%(user)s' and (t2.delete_status is NULL or t2.delete_status = 'No') and t1.name = t2.parent and ((t1.last_updated_by = t3.name and t1.last_updated_by!='%(user)s') or (t1.previous_updated_by = t3.name and t1.previous_updated_by!='%(user)s')) order by t1.modified desc", {'user':user});
+  }
+  
+  this.inbox_lst.generate_unread_lst();  
+  this.inbox_lst.msg_li.run();
+  this.inbox_lst.msg_li.onrun = function(){ me.inbox_lst.show_if_no_msg(me.inbox_lst.msg_li); }
+}
+
+Message.prototype.make_compose = function() {
+  var me = this;
+  
+  me.mytabs.add_tab('Compose', function() { 
+    if(!pscript.compose_msg_obj){
+      pscript.compose_msg_obj = new MessageThread(me.mytabs.tabs['Compose'].tab_body, me.mytabs.tabs['Inbox'], me.inbox_lst.lst_wrapper, 'My Inbox'); 
+      //pscript.compose_msg_obj.show_msg(0, me.mytabs.tabs['Compose'].tab_body, me.mytabs.tabs['Inbox'], me.inbox_lst.lst_wrapper, 'My Inbox', me.mytabs.tabs['Sent'], me.sent_lst.lst_wrapper);
+    }
+    pscript.compose_msg_obj.show_msg(0, me.mytabs.tabs['Compose'].tab_body, me.mytabs.tabs['Inbox'], me.inbox_lst.lst_wrapper, 'My Inbox', me.mytabs.tabs['Sent'], me.sent_lst.lst_wrapper);
+    
+    this.cur_inbox_list = null;
+  });
+}
+
+Message.prototype.make_sent = function() {
+  var me = this;
+  
+  // sent msg tab
+  me.mytabs.add_tab('Sent', function() { 
+    me.sent_lst.msg_li.run(); 
+    me.cur_inbox_list = me.sent_lst.msg_li; // for refresh
+  });
+  
+  if(!this.sent_lst) this.sent_lst = new MessageList(me.mytabs.tabs['Sent'].tab_body, 'sent msg');
+  this.sent_lst.msg_li.get_query = function() {
+    //me.checked_msg_lst = [];
+    me.all_msg = {};
+    
+    this.query = repl("select distinct t1.name, t1.last_updated_on, t1.last_updated_by, t1.subject, t3.first_name, t3.file_list, t1.message_date, t1.owner, t1.message from `tabMail` t1, `tabProfile` t3, `tabMail Participant Details` t2 where t1.is_main_thread='Yes' and t1.last_updated_by='%(user)s' and t1.last_updated_by = t3.name and t2.participant_name = '%(user)s' and (t2.delete_status is NULL or t2.delete_status = 'No') and t2.parent = t1.name order by t1.modified desc", {'user':user});
+    this.query_max = repl("select distinct count(t1.name) from `tabMail` t1, `tabProfile` t3, `tabMail Participant Details` t2 where t1.is_main_thread='Yes' and t1.last_updated_by='%(user)s' and t1.last_updated_by = t3.name and t2.participant_name = '%(user)s' and (t2.delete_status is NULL or t2.delete_status = 'No') and t2.parent = t1.name order by t1.modified desc", {'user':user});
+  }
+  this.sent_lst.msg_li.run();
+  this.sent_lst.msg_li.onrun = function(){ me.sent_lst.show_if_no_msg(me.sent_lst.msg_li); }
+}
+
+Message.prototype.show_inbox = function(){
+  var me = this;
+  if(me.inbox_lst){
+    me.inbox_lst.msg_li.run();
+  }
+  me.mytabs.tabs['Inbox'].show();
+}
+
+MessageList = function(parent_tab, req_frm) {
+  this.checked_msg_lst = [];
+  this.unread_msg_lst = [];
+  this.all_msg = {};
+  this.parent_tab = parent_tab;
+  this.req_frm = req_frm;
+  this.make();
+}
+
+MessageList.prototype.make = function(){
+  var me = this;
+  
+  this.lst_wrapper = $a(me.parent_tab, 'div');
+  
+  //toolbar
+  this.toolbar_area = $a(this.lst_wrapper, 'div', '', {paddingTop:'12px'});
+  this.create_toolbar();
+  
+  //no inbox msg div
+  this.no_lst_wrapper = $a(me.parent_tab, 'div', '', {padding:'8px',backgroundColor:'#FFE4AA'});
+  $dh(this.no_lst_wrapper);
+  
+  //view inbox msg div
+  this.view_msg_wrapper = $a(me.parent_tab, 'div');
+  
+  this.msg_li = new Listing("Recent Messages",1);
+  this.msg_li.colwidths = ['90%'];
+  this.msg_li.opts.no_border = 1;
+  this.msg_li.opts.show_empty_tab = 0;
+  this.msg_li.opts.no_border = 1;
+  
+  this.msg_li.show_cell = function(cell,ri,ci,d) {
+    if(ri % 2)$y(cell,{backgroundColor:'#E1E3DE'});
+    if(ci ==0){
+      this.msg_lst = new MessagePreview(cell, me.req_frm, d[ri][0], d[ri][1], d[ri][2], d[ri][3], d[ri][4], d[ri][5], d[ri][6], d[ri][7], d[ri][8], d[ri][9], me.lst_wrapper, me.view_msg_wrapper, me.unread_msg_lst, me.all_msg);
+    }
+  }
+  this.msg_li.make(this.lst_wrapper);
+  $dh(this.msg_li.btn_area);
+}
+
+MessageList.prototype.create_toolbar = function(){
+  var me = this;
+  
+  this.toolbar_tbl = make_table(me.toolbar_area, 1, 2, '100%', ['85%', '15%']);
+  
+  this.select_all_lnk = $a($td(this.toolbar_tbl, 0, 0), 'span', 'link_type');
+  this.select_all_lnk.innerHTML = 'Select All';
+  $dh(this.select_all_lnk);
+  
+  this.unselect_all_lnk = $a($td(this.toolbar_tbl, 0, 0), 'span', 'link_type');
+  this.unselect_all_lnk.innerHTML = 'Unselect All';
+  $dh(this.unselect_all_lnk);
+  
+  this.select_all_lnk.onclick = function(){
+    $ds(me.unselect_all_lnk);
+    $dh(me.select_all_lnk);
+    for(m in me.all_msg){
+      me.all_msg[m].checked = true;
+    }
+  }
+  
+  this.unselect_all_lnk.onclick = function(){
+    $ds(me.select_all_lnk);
+    $dh(me.unselect_all_lnk);
+    for(m in me.all_msg){
+      me.all_msg[m].checked = false;
+    }
+  }
+  
+  this.delete_selected_btn = $a($td(this.toolbar_tbl, 0, 1), 'button', 'button', {align:'right'});
+  this.delete_selected_btn.innerHTML = 'Delete Selected';
+  $dh(this.delete_selected_btn);
+  this.delete_selected_btn.onclick = function(){
+    me.checked_msg_lst = [];    
+    for(m in me.all_msg){
+      if(me.all_msg[m].checked == true)
+        me.checked_msg_lst.push(m);
+    }
+    me.delete_selected();
+  }
+}
+
+MessageList.prototype.show_if_no_msg = function(lst_data){
+  var me = this;
+  $dh(me.view_msg_wrapper);
+  
+  if(!lst_data.has_data()){  
+    $ds(me.no_lst_wrapper);
+    $dh(me.lst_wrapper);
+    if(me.req_frm == 'inbox msg'){
+      me.no_lst_wrapper.innerHTML = "You have no messages in your Inbox.";      
+    }
+    else if(me.req_frm == 'sent msg'){
+      me.no_lst_wrapper.innerHTML = "You have no messages in your Sent messages list.";
+    }
+  } else {    
+    $dh(me.no_lst_wrapper); 
+    $ds(me.lst_wrapper);
+    $dh(me.no_lst_wrapper); 
+    $ds(me.lst_wrapper);
+    $dh(this.unselect_all_lnk);
+    $ds(this.select_all_lnk);
+    $ds(this.delete_selected_btn);
+  }
+}
+
+MessageList.prototype.generate_unread_lst = function(){
+  var me = this;
+  
+  var msg_callback = function(r, rt){
+    if(r.message.ur_lst){
+      me.unread_msg_lst = r.message.ur_lst;
+    }
+  }
+  $c('runserverobj', {doctype:'Message Control',method:'get_unread_msg_lst',arg:user}, msg_callback);
+}
+
+MessageList.prototype.delete_selected = function(){
+  var me = this;
+  
+  if(me.checked_msg_lst.length >= 1) me.msg_li.msg_lst.delete_msg(me.checked_msg_lst);
+  else  msgprint("error:Please select the message to delete");
+}
+
+function MessagePreview(parent, req_frm, msg_id, last_updated_on, last_updated_by, subject, first_name, profile_pic, msg_date, msg_owner, message, previous_updated_by, lst_wrapper, view_msg_wrapper, unread_msg_lst, all_msg_dict) { 
+  this.create_structure(parent);
+  
+  if(req_frm) this.req_frm = req_frm;
+  this.msg_id = msg_id;
+  this.subject = subject;
+  this.message = message;
+  this.msg_date = msg_date;
+  this.msg_owner = msg_owner;
+  this.first_name = first_name;
+  this.lst_wrapper = lst_wrapper;
+  this.view_msg_wrapper = view_msg_wrapper;
+  if(profile_pic) this.profile_pic = profile_pic;
+  if(last_updated_on) this.last_updated_on = last_updated_on;
+  if(last_updated_by) this.last_updated_by = last_updated_by;
+  if(previous_updated_by) this.previous_updated_by = previous_updated_by;
+	this.unread_msg_lst = unread_msg_lst;
+  this.all_msg = all_msg_dict;
+  
+  this.show_msg_sender();
+  this.show_msg_subject();
+  this.show_delete_lnk();
+}
+
+MessagePreview.prototype.create_structure = function(parent){
+  this.wrapper = $a(parent,'div');
+  this.t = make_table(this.wrapper, 1, 4, '100%', ['5%','10%','80%','5%']);
+}
+
+MessagePreview.prototype.show_msg_sender = function(){
+  var me = this;
+  
+  // checkbox
+  var chk_box = $a($td(this.t, 0, 0),'div');
+  if(isIE) {
+    chk_box.innerHTML = '<input type="checkbox" style="border: 0px">'; // IE fix
+    this.inp = chk_box.childNodes[0];
+  } else {
+    this.inp = $a(chk_box, 'input');
+    this.inp.type = 'checkbox';
+  }
+  
+  this.inp.onclick = function() { 
+    for(m in me.all_msg){
+      if(m == me.msg_id)
+        me.all_msg[m].checked = me.inp.checked;
+    }
+  }
+  
+  me.all_msg[me.msg_id] = this.inp;
+  
+  //sender or receiver
+  // photo
+  if(this.profile_pic) {
+    var img = $a($td(this.t, 0, 1),'img');
+    var img_src = this.profile_pic.split(NEWLINE)[0].split(',')[0]
+    img.src = repl('cgi-bin/getfile.cgi?name=%(fn)s&thumbnail=32',{fn:img_src})
+  }
+  //name
+  var div = $a($td(this.t, 0, 1),'div');
+  div.innerHTML = this.first_name;
+}
+
+MessagePreview.prototype.show_msg_subject = function() {
+  var me = this;
+  // message
+  var div1 = $a($td(this.t, 0, 2),'div', '', {paddingBottom:'4px'});
+  var sp = $a(div1,'span','link_type', {fontSize:'12px'});
+  sp.innerHTML = 'Sub : ' +me.subject;
+  
+  var div = $a($td(this.t, 0, 2),'div', 'comment',{paddingBottom:'8px'});
+  div.innerHTML = 'created by: ' + me.msg_owner +' | created on: ' + dateutil.str_to_user(me.msg_date)+ ' | last updated on: ' + dateutil.str_to_user(me.last_updated_on);
+  
+  if (me.req_frm == 'inbox msg' && inList(me.unread_msg_lst, me.msg_id)) {
+    $y(sp,{fontWeight:'bold',color:'Black'});
+    $y(div,{fontWeight:'bold',color:'Black'});
+  }
+  
+  sp.style.cursor = 'pointer';
+  sp.msg_id = me.msg_id; sp.req_frm = me.req_frm;
+  
+  sp.onclick = function() {
+    $dh(me.lst_wrapper);
+    if(this.req_frm == 'inbox msg'){
+      if(!pscript.inbox_msg_obj){
+        pscript.inbox_msg_obj = new MessageThread(me.view_msg_wrapper, pscript.msg_struct.mytabs.tabs['Inbox'], me.lst_wrapper, 'My Inbox'); 
+      }
+      pscript.inbox_msg_obj.show_msg(this.msg_id, me.view_msg_wrapper, pscript.msg_struct.mytabs.tabs['Inbox'], me.lst_wrapper, 'My Inbox', pscript.msg_struct.mytabs.tabs['Sent'], me.lst_wrapper);
+      
+      //mark for already read
+      if (this.req_frm == 'inbox msg' && inList(me.unread_msg_lst,this.msg_id)) {
+        me.mark_as_read(this.msg_id);
+      }
+    }
+    else if(this.req_frm == 'sent msg'){
+      if(!pscript.sent_msg_obj){
+        pscript.sent_msg_obj = new MessageThread(me.view_msg_wrapper, pscript.msg_struct.mytabs.tabs['Sent'], me.lst_wrapper, 'My Inbox'); 
+      }
+      pscript.sent_msg_obj.show_msg(this.msg_id, me.view_msg_wrapper, pscript.msg_struct.mytabs.tabs['Sent'], me.lst_wrapper, 'My Inbox', pscript.msg_struct.mytabs.tabs['Sent'], me.lst_wrapper); 
+    }
+  }
+}
+
+MessagePreview.prototype.mark_as_read = function(msg_id){
+  this.msg_id = msg_id;
+  var me = this;
+  
+  args = {'user' : user, 'msg':this.msg_id,'read':'Yes'}
+  $c_obj('Message Control','read_unread_message',docstring(args),function(r,rt){
+    me.remove_element(me.unread_msg_lst, me.msg_id);
+  });
+}
+
+MessagePreview.prototype.delete_msg = function(msg_nm_lst){
+  this.msg_nm_lst = msg_nm_lst;
+  var me = this; 
+  var delete_msg_dialog;
+  
+  set_delete_msg_dialog = function() {
+    delete_msg_dialog = new Dialog(400, 200, 'Delete Message');
+    delete_msg_dialog.make_body([
+      ['HTML', 'Message', '<div class = "comment">Are you sure, you want to delete message(s) ?</div>'],
+      ['HTML', 'Response', '<div class = "comment" id="delete_msg_dialog_response"></div>'],
+      ['HTML', 'Delete Msg', '<div></div>']
+    ]);
+    
+    var delete_msg_btn1 = $a($i(delete_msg_dialog.widgets['Delete Msg']), 'button', 'button');
+    delete_msg_btn1.innerHTML = 'Yes';
+    delete_msg_btn1.onclick = function(){ delete_msg_dialog.add(); }
+    
+    var delete_msg_btn2 = $a($i(delete_msg_dialog.widgets['Delete Msg']), 'button', 'button');
+    delete_msg_btn2.innerHTML = 'No';
+    $y(delete_msg_btn2,{marginLeft:'4px'});
+    delete_msg_btn2.onclick = function(){ delete_msg_dialog.hide();}
+    
+    delete_msg_dialog.onshow = function() {
+      $i('delete_msg_dialog_response').innerHTML = '';
+    }
+    
+    delete_msg_dialog.add = function() {
+      // sending...
+      $i('delete_msg_dialog_response').innerHTML = 'Processing...';
+      var m_arg = user+ '~~' + this.msg_nm_lst;
+      
+      var call_back = function(r,rt) { 
+        if(r.message == 'true'){
+          $i('delete_msg_dialog_response').innerHTML = 'Message Deleted';
+          delete_msg_dialog.hide();
+          
+          for(m=0; m<me.msg_nm_lst.length; m++){
+            if(inList(me.unread_msg_lst, me.msg_nm_lst[m]))
+              me.remove_element(me.unread_msg_lst, me.msg_nm_lst[m]);
+          }
+          pscript.msg_struct.inbox_lst.msg_li.run();
+          pscript.msg_struct.sent_lst.msg_li.run();
+        }
+      }
+      $c('runserverobj', {doctype:'Message Control',method:'delete_message',arg:m_arg}, call_back); 
+    }
+  }  
+  
+  if(!delete_msg_dialog){
+    set_delete_msg_dialog();
+  }  
+  delete_msg_dialog.msg_nm_lst = this.msg_nm_lst;
+  delete_msg_dialog.show();
+}
+
+MessagePreview.prototype.remove_element = function(arrayName, arrayElement){
+  for(var i=0; i<arrayName.length;i++ )
+  { 
+    if(arrayName[i]==arrayElement)
+    arrayName.splice(i,1); 
+  }
+}
+
+MessagePreview.prototype.show_delete_lnk = function() {
+  var me = this;
+  var div = $a($td(this.t, 0, 3), 'span', 'link_type');
+  div.innerHTML = 'Delete';
+  div.msg_id = me.msg_id;
+  
+  div.onclick = function() {
+    me.delete_msg(me.msg_id);
+  }
+}
+
+MessagePart = function(parent){
+  var me = this;
+  
+  this.parent = parent;
+  this.inputs = {};
+  
+  me.make_header();
+  me.make_reply();
+  me.make_post();
+}
+
+MessagePart.prototype.make = function(label, ele, comment){
+  var me = this;
+  
+  var div = $a(this.parent,'div','',{marginBottom:'12px'});
+  var t = make_table(div,2,1,'70%',['100%']);
+  
+  if( ele == 'button'){
+    var element = $a($td(t,0,0), 'button');
+    element.innerHTML = label;
+  }
+  else {
+    var element = $a($td(t,1,0),ele);
+
+    // large fonts for inputs
+    if(in_list(['input','textarea'],ele.toLowerCase())) {
+      $y(element,{fontSize:'14px', width:'100%'})
+    }
+    $td(t,0,0).innerHTML = label;
+  }
+
+  if(comment) {
+    var div2 = $a(div,'div','',{fontSize:'11px', color:'#888', marginTop:'2px'});
+    div2.innerHTML = comment;
+  }
+  
+  element.wrapper = div;
+  if(label) me.inputs[label] = element;
+  return element;
+}
+
+MessagePart.prototype.make_header = function(){
+  var me = this;
+  
+  this.back_link_div = $a(me.make('','div'),'span', 'link_type', {paddingTop:'12px'});
+  this.back_link_div.innerHTML = 'Back to List';
+  
+  me.make('To','textarea','Enter Email Ids separated by commas (,)');
+  $y(me.inputs['To'],{overflow :'auto', height : '50px'});
+  me.make('Subject','input');
+}
+
+MessagePart.prototype.make_reply = function(){
+  var me = this;
+  this.inputs.Thread = $a(this.parent, 'div', '', {margin:'16px 0px'})
+}
+
+MessagePart.prototype.make_post = function(){
+  var me = this;
+  
+  me.make('Message','textarea');
+  $y(me.inputs['Message'],{height:'240px'});
+
+  // send + cancel
+  var d = $a(this.parent, 'div');
+  me.inputs.Send = $btn(d, 'Send');
+  me.inputs.Reply = $a(d, 'Reply')
+}
+
+MessagePart.prototype.add_header_values = function(to_list, subject){
+  var me = this;
+  
+  //thread_participants
+  me.inputs['To'].value = to_list.join(',');
+  me.inputs['To'].disabled = true;
+  
+  // subject
+  me.inputs['Subject'].value = subject;
+  me.inputs['Subject'].disabled = true;
+}
+
+MessagePart.prototype.add_reply_thread = function(thread){
+  var me = this;
+  // prev messages
+  var t = me.inputs['Thread'];
+  t.innerHTML = ''; // clear previous threads
+  
+  var w = $a(t,'div','',{width:'70%'});
+  var tab = make_table(w,thread.length,2,'100%',['20%','80%'], {padding:'8px 0px', borderBottom:'1px solid #AAA'});
+  
+  for(i=0;i<thread.length;i++) {
+    // ---- photo ---- 
+    if(thread[i][6]) {
+      var img = $a($td(tab,i,0),'img');
+      var img_src = thread[i][6].split(NEWLINE)[0].split(',')[0];
+      img.src = repl('cgi-bin/getfile.cgi?name=%(fn)s&thumbnail=32',{fn:img_src});
+    }
+    
+    // ---- sender name ---- 
+    var d = $a($td(tab,i,0),'div','',{fontSize:'11px'});
+    d.innerHTML = thread[i][5];
+    
+    //----- date ----
+    var d = $a($td(tab,i,1),'div', 'comment', {marginLeft:'8px', color:'#888', fontSize:'11px'}); 
+    d.innerHTML = dateutil.str_to_user(thread[i][3]);
+    
+    //------ message ------
+    var d = $a($td(tab,i,1),'div', 'comment', {fontSize:'14px', marginLeft:'8px'}); 
+    d.innerHTML = replace_newlines(thread[i][1]);
+    $y($td(tab,i,1), {paddingBottom: '8px'});
+  }
+}
+
+//++++++++++++++++++++++++ Message  ++++++++++++++++++++++++
+
+MessageThread = function(parent, view_list_tab, view_list_div, req_frm) {
+  var me = this;
+  this.wrapper = $a(parent,'div');
+  if(!this.msg_parts) this.make(view_list_tab, view_list_div, req_frm);
+}
+
+ 
+MessageThread.prototype.add_autosuggest = function() {
+  var me = this;
+  
+  // ---- add auto suggest ---- 
+  var opts = { script: '', json: true, maxresults: 10, timeout: 10000, delay:250, maxentries:500, cache:false};
+  
+  var as = new AutoSuggest(me.msg_parts.inputs['To'], opts);
+  as.custom_select = function(txt, sel) {
+    // ---- add to the last comma ---- 
+    
+    var r = '';
+    var tl = txt.split(',');
+    for(var i=0;i<tl.length-1;i++) r=r+tl[i]+',';
+    r = r+(r?' ':'')+sel+',';
+    if(r[r.length-1]==NEWLINE) { r=substr(0,r.length-1);}
+    return r;
+  }
+  
+  // ---- override server call ---- 
+  as.doAjaxRequest = function(txt) {
+    var pointer = as; var q = '';
+    
+    // ---- get last few letters typed ---- 
+    var last_txt = txt.split(',');
+    last_txt = last_txt[last_txt.length-1];
+    
+    // ---- show options ---- 
+    var call_back = function(r,rt) {
+      as.aSug = [];
+      var jsondata = r.message;  
+      for (var i=0;i<jsondata.results.length;i++) {
+        as.aSug.push({'id':jsondata.results[i].id, 'value':jsondata.results[i].value, 'info':jsondata.results[i].info});
+      }
+      as.idAs = "as_for_to_message";
+      
+      //old create list
+      as.createList(as.aSug);        
+    }
+    
+    $c_obj('Message Control', 'get_to_list', (last_txt ? last_txt : '%'), call_back);
+    return;
+  }  
+}
+  
+MessageThread.prototype.make = function(view_list_tab, view_list_div, req_frm) {
+  var me = this;
+  
+  me.view_list_tab = view_list_tab;
+  me.view_list_div = view_list_div;
+  me.req_frm = req_frm;
+  
+  this.msg_parts = new MessagePart(me.wrapper);
+
+  this.msg_parts.back_link_div.onclick = function() { 
+    me.hide(); 
+    
+    if(me.in_compose) {
+      if(me.req_frm == 'My Inbox') { me.view_list_tab.show(); $ds(me.view_list_div); }
+    }
+  }
+  
+  // autosuggest
+  me.add_autosuggest();
+}
+
+MessageThread.prototype.set_inbox_editor = function(editor) { 
+  pscript.inbox_text_editor_set = 1;
+}
+
+MessageThread.prototype.view_existing_msg = function(args){
+  var me = this;
+  
+  $c_obj('Message Control', 'get_thread_details', docstring(args), 
+    function(r, rt){
+      var tl = r.message.tl;
+      var to_list = r.message.to_list;
+      
+      //to and subject
+      me.msg_parts.add_header_values(to_list, tl[0][0]);
+      
+      //reply thread
+      me.msg_parts.add_reply_thread(tl);
+      
+      //post area
+      if(me.inbox_editor && pscript.inbox_text_editor_set == 1){
+        me.inbox_editor.editor.setContent('');
+      }
+      else{
+        me.msg_parts.inputs['Message'].value = '';
+      }
+      me.show_as(true);
+    }
+  );
+}
+
+MessageThread.prototype.view_blank_form = function(){
+  var me = this;
+  
+  $ds(me.msg_parts.inputs['To'].wrapper);
+  
+  me.msg_parts.inputs['To'].disabled = false;
+  me.msg_parts.inputs['To'].value = '';    
+  
+  me.msg_parts.inputs['Subject'].disabled = false;    
+  me.msg_parts.inputs['Subject'].value = '';
+  
+  me.msg_parts.inputs['Thread'].innerHTML = '';
+  
+  if(me.inbox_editor && pscript.inbox_text_editor_set == 1){
+    me.inbox_editor.editor.setContent('');
+  }
+  else{
+    me.msg_parts.inputs['Message'].value = '';
+  }    
+  me.show_as(false);
+}
+  
+//  msg_id = mesage id, 
+//  parent = div/tab from where msg will be shown, 
+//  view_list_tab = name of tab in which list will be viewed, 
+//  view_list_div = name of div in which list will be viewed, 
+//  req_frm = my inbox / group / event, 
+//  show_on_send_tab = tab to be viewed on sending/replying to msg, 
+//  show_on_send_div = div to be viewed on sending/replying to msg, 
+//  receiver_lst = list of msg receiver
+
+MessageThread.prototype.show_msg = function(msg_id, parent, view_list_tab, view_list_div, req_frm, show_on_send_tab, show_on_send_div, receiver_lst) {
+  var me = this;
+  
+  // set tinymce editor
+  if(!me.inbox_editor) {
+    pscript.inbox_text_editor_set = 0;
+    var theme_adv_btn1 ="fontselect,fontsizeselect,formatselect,indicime,indicimehelp,emotions";
+    var theme_adv_btn2 ="bold,italic,underline,|,undo,redo,|,code,forecolor,backcolor,link,unlink,hr,|,sub,sup,|,charmap";
+    var theme_adv_btn3 = "";
+    
+    me.inbox_editor = new TextAreaEditor(me.msg_parts.inputs["Message"], null, me.set_inbox_editor, theme_adv_btn1, theme_adv_btn2, theme_adv_btn3, '300px');
+  }
+  
+  me.req_frm = req_frm;
+  me.receiver_lst = receiver_lst;
+  me.parent = parent;
+  me.view_list_tab = view_list_tab;
+  me.view_list_div = view_list_div;
+  me.show_on_send_tab = show_on_send_tab;
+  me.show_on_send_div = show_on_send_div;
+  me.msg_parts.inputs['Send'].btn_click = 0;
+  me.msg_parts.inputs['Reply'].btn_click = 0;
+  
+  if(msg_id) {
+    this.cur_message_id = msg_id;
+    var args = {'user_name':user, 'cur_msg_id': this.cur_message_id};
+    me.view_existing_msg(args);      
+  } 
+  else {
+    this.cur_message_id = null;
+    me.view_blank_form();
+  }  
+  $ds(me.parent);
+  
+  // reply or send btn
+  me.msg_parts.inputs['Send'].onclick = function(){ 
+    if(!this.btn_click){
+      this.btn_click = 1;
+      me.send(me.req_frm, me.receiver_lst, me.show_on_send_tab, me.show_on_send_div); 
+    }
+  }
+  me.msg_parts.inputs['Reply'].onclick = me.msg_parts.inputs['Send'].onclick;
+}
+
+MessageThread.prototype.hide = function() {
+  var me = this;
+  
+  $dh(me.wrapper);
+  $ds(me.view_list_div);
+  me.display = 0;
+}
+
+MessageThread.prototype.show_as = function(reply) {
+  var me = this;
+  
+  if(!reply) {
+    $dh(me.msg_parts.inputs['Thread'].wrapper);
+    $dh(me.msg_parts.inputs['Reply']);
+    $ds(me.msg_parts.inputs['Send']);
+    me.in_compose = 1;
+  }
+  else {
+    $ds(me.msg_parts.inputs['Thread'].wrapper);
+    $ds(me.msg_parts.inputs['Reply']);
+    $dh(me.msg_parts.inputs['Send']);
+    $dh(me.view_list_div);
+    me.in_compose = 1;
+  } 
+  $ds(me.wrapper);
+  me.display = 1;
+}
+
+MessageThread.prototype.send_msg = function(arg){
+  var me = this;
+  var args = arg;
+  
+  var send_call_back = function(r, rt){
+    //var me = this;
+    if(r.message == 'true'){
+      me.msg_parts.inputs['To'].value = '';
+      me.msg_parts.inputs['Subject'].value = '';
+      me.msg_parts.inputs['Thread'].innerHTML = '';
+      
+      if(me.inbox_editor && pscript.inbox_text_editor_set == 1){
+        me.inbox_editor.editor.setContent('');
+      }
+      else{
+        me.msg_parts.inputs['Message'].value = '';
+      }
+      
+      if(me.req_frm == 'My Inbox'){
+        pscript.msg_struct.sent_lst.msg_li.run();
+        me.show_on_send_tab.show();
+        $ds(me.show_on_send_div);
+        $dh(me.parent);
+      }
+    }
+  }
+  
+  if(me.cur_message_id==null){
+    $c_obj('Message Control','send_message',docstring(args), send_call_back);
+  }
+  else{  
+    $c_obj('Message Control','send_reply',docstring(args), send_call_back);
+  }
+}
+
+MessageThread.prototype.send = function(req_frm, receiver_lst, show_on_send_tab, show_on_send_div) {
+  var me = this;
+  me.req_frm = req_frm;
+  me.show_on_send_tab = show_on_send_tab;
+  me.show_on_send_div = show_on_send_div;
+  var args = {'user_name':user};
+  
+  if(me.inbox_editor && pscript.inbox_text_editor_set == 1){
+    args.message = me.inbox_editor.editor.getContent();
+  }
+  else{
+    args.message = me.msg_parts.inputs['Message'].value;
+  }
+  
+  if(me.cur_message_id==null){
+    args.subject = me.msg_parts.inputs['Subject'].value;
+    args.to_list = me.msg_parts.inputs['To'].value;
+    if(!args.to_list) {msgprint('error:Must enter "To:"'); }
+    else if(!args.subject) {msgprint('error:Must enter "Subject"'); }
+    else me.send_msg(args);
+  }
+  else{
+    var subj = me.msg_parts.inputs['Subject'].value;
+    if(!subj.substr(0,3).toLowerCase()=='re:')
+      subj = 'Re: ' + subj;
+    args.subject = subj;
+    args.message_id = me.cur_message_id;
+    
+    me.send_msg(args);
+  }
+}
+
+MessageThread.prototype.delete_msg = function(req_frm, parent, view_list_tab, view_list_div) {
+  var me = this;
+  
+  var msg_lst = [];
+  var delete_message_dialog;
+  me.parent = parent;
+  
+  if(me.cur_message_id)
+    msg_lst.push(me.cur_message_id);
+  
+  if(msg_lst.length >= 1){
+    function set_delete_message_dialog() {
+      delete_message_dialog = new Dialog(400, 400, 'Delete Message');
+      delete_message_dialog.make_body([
+        ['HTML', 'Message', '<div class = "comment">Are you sure, you want to delete this message ?</div>'],
+        ['HTML', 'Response', '<div class = "comment" id="delete_message_dialog_response"></div>'],
+        ['HTML', 'Delete Message', '<div id="delete_message_btn" style ="height:25px;"></div>']
+      ]);
+      
+      var delete_message_btn1 = $a($i('delete_message_btn'), 'button', 'button');
+      delete_message_btn1.innerHTML = 'Yes';
+      delete_message_btn1.onclick = function(){ delete_message_dialog.add();}
+      
+      var delete_message_btn2 = $a($i('delete_message_btn'), 'button', 'button');
+      delete_message_btn2.innerHTML = 'No';
+      $y(delete_message_btn2,{marginLeft:'4px'});
+      
+      delete_message_btn2.onclick = function(){ delete_message_dialog.hide();}
+      
+      delete_message_dialog.onshow = function() {
+        $i('delete_message_dialog_response').innerHTML = '';
+      }
+      
+      delete_message_dialog.add = function() {
+        if(this.req_frm == 'My Inbox'){
+          var args = user + '~~' + this.msg_lst;
+          $c_obj('Message Control', 'delete_message', args, function(r, rt){
+            if(r.message == 'true'){
+              me.hide();
+              me.view_list_tab.show(); 
+              $ds(me.view_list_div);
+              delete_message_dialog.hide();
+            }
+          });  
+        }
+      }
+    }  
+    
+    if(!delete_message_dialog)
+      set_delete_message_dialog();
+    delete_message_dialog.req_frm = req_frm;
+    delete_message_dialog.msg_lst = msg_lst;
+    delete_message_dialog.view_list_tab = view_list_tab;
+    delete_message_dialog.view_list_div = view_list_div;
+    delete_message_dialog.show();
+  }
+}
+
+// ---------------- editor---------------------
+
+var editor_count = 0;
+
+function TextAreaEditor(txt, parent, callback, theme_advanced_btn1, theme_advanced_btn2, theme_advanced_btn3, editor_ht) {
+
+  this.txt = txt;
+  this.parent = parent;
+  this.callback = callback;
+  if(theme_advanced_btn1) this.theme_advanced_btn1 = theme_advanced_btn1;
+  if(theme_advanced_btn2) this.theme_advanced_btn2 = theme_advanced_btn2;
+  if(theme_advanced_btn3) this.theme_advanced_btn3 = theme_advanced_btn3;
+  if(editor_ht) this.editor_ht = editor_ht;
+
+  // load tinyMCE library
+  this.load_tiny_mce_library();
+}
+
+TextAreaEditor.prototype.load_tiny_mce_library = function() {
+
+  var me = this;
+  
+  if(!tinymce_loaded) {
+    tinymce_loaded = 1;
+    tinyMCE_GZ.init(
+      {
+        themes : "advanced",
+        plugins : "style,table,inlinepopups,indicime,emotions",
+        languages : "en",
+        disk_cache : true
+      }, function(){ me.setup_text_area() });
+  }
+  else {
+    me.setup_text_area();
+  }
+}
+
+TextAreaEditor.prototype.setup_text_area = function() {
+
+  var me = this;
+  if(!me.txt) {
+    me.txt = $a(me.parent, 'textarea');
+  }
+  
+  editor_count++;
+  me.id = 'editor_text_' + editor_count;
+  me.txt.setAttribute('id', me.id);
+  
+  tinyMCE.init({
+    theme : "advanced",
+    mode : "exact",
+    elements: me.id,
+    plugins:"table,style,inlinepopups,indicime,emotions",
+    theme_advanced_toolbar_location : "top",
+    theme_advanced_statusbar_location : "bottom",
+    extended_valid_elements: "div[id|dir|class|align|style]",
+    
+    // w/h
+    width: '100%',
+    height: me.editor_ht?me.editor_ht:'50px',
+    
+    // buttons
+    //theme_advanced_buttons1 :"bold,italic,underline,strikethrough,blockquote,forecolor,backcolor,bullist,numlist,|,undo,redo,|,image,code,indicime,indicimehelp,emotions",
+    theme_advanced_buttons1 : me.theme_advanced_btn1?me.theme_advanced_btn1:"bold,italic,underline,forecolor,backcolor,|,undo,redo,|,link,unlink,indicime,indicimehelp,emotions",
+    theme_advanced_buttons2 : me.theme_advanced_btn2?me.theme_advanced_btn2:"",
+    theme_advanced_buttons3 : me.theme_advanced_btn3?me.theme_advanced_btn3:"",
+    
+    // callback function with editor instance.
+    init_instance_callback : "editor_init_callback"
+  });  
+
+  editor_init_callback = function(inst) {
+    me.editor = tinyMCE.get(me.id);
+    me.editor.focus();
+    
+    if(me.callback){
+      me.callback(me.editor);
+    }
+  }  
+}
\ No newline at end of file
diff --git a/tools/page/messages/messages.txt b/tools/page/messages/messages.txt
new file mode 100644
index 0000000..8369afe
--- /dev/null
+++ b/tools/page/messages/messages.txt
@@ -0,0 +1 @@
+[{'creation': '2010-06-07 10:34:37', 'module': 'Tools', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'nabin@webnotestech.com', 'script': None, 'show_in_menu': 1, 'content': None, 'page_name': 'Messages', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Messages', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'nabin@webnotestech.com', 'name': 'PR000137', 'parent': 'Messages', 'creation': '2010-06-07 10:34:37', 'modified': '2010-09-01 14:56:20', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'nabin@webnotestech.com', 'name': 'PR000138', 'parent': 'Messages', 'creation': '2010-06-07 13:35:43', 'modified': '2010-09-01 14:56:20', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/tools/page/messages/messages_static.html b/tools/page/messages/messages_static.html
new file mode 100644
index 0000000..094418b
--- /dev/null
+++ b/tools/page/messages/messages_static.html
@@ -0,0 +1,2 @@
+<div>
+</div>
\ No newline at end of file
diff --git a/tools/page/trash/__init__.py b/tools/page/trash/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/page/trash/__init__.py
diff --git a/tools/page/trash/trash.html b/tools/page/trash/trash.html
new file mode 100644
index 0000000..0fdca75
--- /dev/null
+++ b/tools/page/trash/trash.html
@@ -0,0 +1,2 @@
+<div id="trash_header">&nbsp;</div>
+<div id="trash_div" style="margin: 0px;">&nbsp;</div>
\ No newline at end of file
diff --git a/tools/page/trash/trash.js b/tools/page/trash/trash.js
new file mode 100644
index 0000000..a1b44d4
--- /dev/null
+++ b/tools/page/trash/trash.js
@@ -0,0 +1,128 @@
+pscript['onload_Trash'] = function() {
+
+  // header and toolbar
+  var h = new PageHeader('trash_header','Trash Bin','Restore the documents that you have trashed')
+  
+  if(!pscript.trash_bin) pscript.trash_bin = new pscript.Trash();
+}
+
+pscript.Trash = function() {
+  // create UI elements
+  this.wrapper = $i('trash_div');
+  
+  this.head = $a(this.wrapper, 'div');
+  this.body = $a(this.wrapper, 'div');
+  $y(this.body, {margin:'8px'})
+
+  this.make_head();
+  this.load_masters();
+}
+
+// Make Button
+// ------------
+pscript.Trash.prototype.make_button = function(label, area){
+  var me = this;
+  var w = $a(area, 'div', '', {margin:'8px'});
+  var t = make_table(w,1,1,'400px',['50%','50%']);
+  var s = $a($td(t,0,0),'button');
+  s.innerHTML = label;
+  s.wrapper = w;
+  return s;
+}
+
+
+// Make Head
+// -------------
+pscript.Trash.prototype.make_head = function() {
+  var me = this;
+  
+  var make_select = function(label) {
+    var w = $a(me.head, 'div', '', {margin:'8px'});
+    var t = make_table(w,1,2,'400px',['50%','50%']);
+    $td(t,0,0).innerHTML = label;
+    var s = $a($td(t,0,1),'select','',{width:'140px'});
+    s.wrapper = w;
+    return s;
+  }
+  
+  // Select Master Name
+  this.master_select = make_select('Select Master');
+    
+  var me = this;
+  // Get Records
+  this.get_records_button = me.make_button('Get Records', me.head);
+  this.get_records_button.onclick = function() {
+    me.get_records();
+  }
+}
+
+
+// Load Masters
+// -------------
+pscript.Trash.prototype.load_masters = function(){
+  var me = this;
+  var callback = function(r, rt){
+    // Masters
+    empty_select(me.master_select);
+    add_sel_options(me.master_select,add_lists(['All'], r.message), 'All');
+  }
+  $c_obj('Trash Control','get_masters','',callback);
+}
+
+
+// Get Records
+// -----------
+pscript.Trash.prototype.get_records = function(){
+  var me = this;
+  me.body.innerHTML = '';
+  var callback = function(r, rt){
+    if(r.message) me.generate_trash_records(r.message);
+    else msgprint("No Records Found");
+  }
+  $c_obj('Trash Control','get_trash_records',sel_val(me.master_select),callback);
+}
+
+
+// Generate Trash Records
+// -----------------------
+pscript.Trash.prototype.generate_trash_records = function(rec_dict){
+  var me = this;
+  pscript.all_checkboxes = [];
+  mnames = keys(rec_dict).sort();
+  for(var i = 0; i < mnames.length; i ++){
+    var head = $a(me.body, 'h3'); head.innerHTML = mnames[i];
+    var rec_table = make_table(me.body,rec_dict[mnames[i]].length,2,'375px',['350px','25px'],{border:'1px solid #AAA',padding:'2px'});
+    for(var j = 0; j < rec_dict[mnames[i]].length; j++){
+      $a_input($td(rec_table,j,0), 'data');
+      $td(rec_table,j,0).innerHTML = rec_dict[mnames[i]][j];
+      var chk = $a_input($td(rec_table,j,1), 'checkbox');
+      chk.master = mnames[i];
+      chk.record = rec_dict[mnames[i]][j];
+      pscript.all_checkboxes.push(chk);
+    }
+  }
+  this.restore_button = me.make_button('Restore Selected', me.body);
+  this.restore_button.onclick = function() {
+    me.restore_records(0);
+  }
+  this.restore_all_button = me.make_button('Restore All', me.body);
+  this.restore_all_button.onclick = function() {
+    me.restore_records(1);
+  }
+}
+
+
+// Restore Records
+// ---------------
+pscript.Trash.prototype.restore_records = function(restore_all){
+  var me = this;
+  var out = {};
+  for(i in pscript.all_checkboxes) {
+    c = pscript.all_checkboxes[i];
+    if (restore_all || (!restore_all && c.checked)) {
+      if(!out[c.master]) out[c.master] = [c.record];
+      else {out[c.master].push(c.record);}
+    }
+  }
+  $c_obj('Trash Control','restore_records',JSON.stringify(out),function(r, rt){me.get_records();})
+}
\ No newline at end of file
diff --git a/tools/page/trash/trash.txt b/tools/page/trash/trash.txt
new file mode 100644
index 0000000..9be29a9
--- /dev/null
+++ b/tools/page/trash/trash.txt
@@ -0,0 +1 @@
+[{'creation': '2010-04-17 14:36:24', 'module': 'Tools', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'saumil@webnotestech.com', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Trash', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Trash', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'saumil@webnotestech.com', 'name': 'PR000122', 'parent': 'Trash', 'creation': '2010-04-19 10:03:20', 'modified': '2010-09-16 16:50:16', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'saumil@webnotestech.com', 'name': 'PR000123', 'parent': 'Trash', 'creation': '2010-04-21 10:33:38', 'modified': '2010-09-16 16:50:16', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'Sales Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'saumil@webnotestech.com', 'name': 'PR000124', 'parent': 'Trash', 'creation': '2010-04-21 10:33:38', 'modified': '2010-09-16 16:50:16', 'doctype': 'Page Role', 'idx': 3, 'parenttype': 'Page', 'role': 'Material Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'saumil@webnotestech.com', 'name': 'PR000125', 'parent': 'Trash', 'creation': '2010-04-21 10:33:38', 'modified': '2010-09-16 16:50:16', 'doctype': 'Page Role', 'idx': 4, 'parenttype': 'Page', 'role': 'Purchase Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'saumil@webnotestech.com', 'name': 'PR000126', 'parent': 'Trash', 'creation': '2010-04-21 10:33:38', 'modified': '2010-09-16 16:50:16', 'doctype': 'Page Role', 'idx': 5, 'parenttype': 'Page', 'role': 'Accounts Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
\ No newline at end of file
diff --git a/tools/page/wip_monitor/__init__.py b/tools/page/wip_monitor/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/page/wip_monitor/__init__.py
diff --git a/tools/page/wip_monitor/wip_monitor.html b/tools/page/wip_monitor/wip_monitor.html
new file mode 100644
index 0000000..b7eb59e
--- /dev/null
+++ b/tools/page/wip_monitor/wip_monitor.html
@@ -0,0 +1,2 @@
+<div id="wip_head"></div>
+<div id="wip_body" style="margin:16px"></div>
\ No newline at end of file
diff --git a/tools/page/wip_monitor/wip_monitor.js b/tools/page/wip_monitor/wip_monitor.js
new file mode 100644
index 0000000..f5a2a62
--- /dev/null
+++ b/tools/page/wip_monitor/wip_monitor.js
@@ -0,0 +1,88 @@
+pscript['onload_WIP Monitor'] = function(){
+	wip = new WIP_Monitor();
+
+	var h = new PageHeader('wip_head','Work in Progress Monitor','A quick glance at your work in progress and pipeline');
+	h.add_button('Refresh', function(){ wip = new WIP_Monitor();}, 1, 'ui-icon-refresh');
+	
+}
+
+// Work In Progress Monitor
+// =========================================================================================================================================================
+WIP_Monitor = function(){					
+	var me = this;
+  this.row_index = 0;
+  $c_obj('Home Control','get_wip_counts','',function(r,rt){
+    me.make_wip_dashboard(r.message);
+  });
+}
+
+
+// Make wip dashboard
+// ------------------
+WIP_Monitor.prototype.make_wip_dashboard = function(wip_dict)
+{
+	var me = this;
+	// list of doctypes which user can read
+	var can_read_dt = ['Lead', 'Enquiry', 'Sales Order', 'Receivable Voucher', 'Indent', 'Purchase Order', 'Payable Voucher', 'Delivery Note', 'Task', 'Serial No'];
+  
+	$i('wip_body').innerHTML = '';
+	this.tab = make_table('wip_body',1,0,'100%',[],{padding:'4px'});
+
+	for(var k=0; k<can_read_dt.length; k++){
+	
+    // check if the user can read these doctypes
+		if(in_list(profile.can_read, get_doctype_label(can_read_dt[k])))
+    {
+      var work = can_read_dt[k];
+      if(this.tab.rows[this.row_index].cells.length==2){
+        this.row_index = this.row_index + 1;
+        this.tab.insertRow(this.tab.rows.length);
+      }
+      var parent = this.tab.rows[this.row_index].insertCell(this.tab.rows[this.row_index].cells.length);
+      $y(parent, {paddingBottom:'16px', width:'50%', paddingLeft:'8px'})
+      me.show_wip_dashboard(parent, work, wip_dict[work]);
+    }
+	}
+}
+
+
+// Show wip dashboard
+// ------------------
+WIP_Monitor.prototype.show_wip_dashboard = function(parent, head, report_dict)
+{
+	var me = this;
+	var report_dt
+  
+	// dictionary for labels to be displayed
+	var wip_lbl_map = {'Lead':'Lead', 'Enquiry':'Enquiries', 'Sales Order':'Sales Order', 'Receivable Voucher':'Invoices', 'Indent':'Indent', 'Purchase Order':'Purchase Order', 'Payable Voucher':'Bills', 'Delivery Note':'Delivery Note', 'Task':'Tasks', 'Serial No':'Maintenance'};
+
+	// header
+	var h = $a(parent,'h3');
+
+  h.innerHTML = wip_lbl_map[head];
+  report_dt = head;
+    
+	for(report in report_dict){
+		me.make_report_body(parent, report, report_dict[report], report_dt);
+	}
+}
+
+
+// Make wip report body
+// --------------------
+WIP_Monitor.prototype.make_report_body = function(parent, lbl, records, rep_dt)
+{
+	var me = this;
+
+	dt_color = lbl=='Overdue' ? 'red' : 'black';
+	var tab2 = make_table(parent,1,2, '70%', ['10%', '90%'], {padding:'4px'});
+			
+	// no of records
+	var s1 = $a($td(tab2,0,0), 'span', '', {fontWeight:'bold', fontSize:'12px', color:dt_color});
+	s1.innerHTML = records;
+
+	// link to report
+	var s1 = $a($td(tab2,0,1), 'span', 'link_type', {cursor:'pointer', color:'#DFH'});
+	s1.dt = rep_dt;     s1.cn = rep_dt + '-' + lbl;     s1.innerHTML = lbl;
+	s1.onclick = function() { loadreport(this.dt, this.cn); }
+}
diff --git a/tools/page/wip_monitor/wip_monitor.txt b/tools/page/wip_monitor/wip_monitor.txt
new file mode 100644
index 0000000..b2394f6
--- /dev/null
+++ b/tools/page/wip_monitor/wip_monitor.txt
@@ -0,0 +1 @@
+[{'creation': '2010-06-29 10:44:15', 'module': 'Tools', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'WIP Monitor', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'WIP Monitor', 'idx': None, 'static_content': None, 'modified': '2010-11-09 23:12:33', 'parenttype': None, 'parent_node': None, 'parentfield': None}]
\ No newline at end of file
diff --git a/utilities/__init__.py b/utilities/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/utilities/__init__.py
diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py
new file mode 100644
index 0000000..e170700
--- /dev/null
+++ b/utilities/transaction_base.py
@@ -0,0 +1,204 @@
+import webnotes
+from webnotes.utils import load_json, cint, cstr, flt
+from webnotes.model.doc import Document, addchild, removechild, getchildren
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes import msgprint
+
+sql = webnotes.conn.sql
+
+class TransactionBase:
+
+	# Get Customer Default Primary Address - first load
+	# -----------------------
+	def get_default_customer_address(self, args=''):
+		address_text, address_name = self.get_address_text(customer=self.doc.customer)
+		contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(customer=self.doc.customer)
+		self.doc.customer_address = address_name or ''
+		self.doc.contact_person = contact_name or ''
+		self.doc.address_display = address_text or ''
+		self.doc.contact_display = contact_text or ''
+		self.doc.contact_email = contact_email or ''
+		self.doc.contact_mobile = contact_mobile or ''
+	
+		self.get_customer_details(self.doc.customer)
+		self.get_sales_person(self.doc.customer)				
+		
+	# Get Customer Default Shipping Address - first load
+	# -----------------------
+	def get_default_customer_shipping_address(self, args=''):		
+		address_text, address_name = self.get_address_text(customer=self.doc.customer,is_shipping_address=1)
+		contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(customer=self.doc.customer)		
+		self.doc.customer_address = address_name or ''
+		self.doc.contact_person = contact_name or ''
+		self.doc.address_display = address_text or ''
+		self.doc.contact_display = contact_text or ''
+		self.doc.contact_email = contact_email or ''
+		self.doc.contact_mobile = contact_mobile or ''
+		
+		self.get_customer_details(self.doc.customer)
+		if self.doc.doctype != 'Quotation':
+			self.get_sales_person(self.doc.customer)						
+
+	# Get Customer Address
+	# -----------------------
+	def get_customer_address(self, args):
+		args = load_json(args)		
+		address_text, address_name = self.get_address_text(address_name=args['address'])
+		contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(contact_name=args['contact'])
+		ret = {
+			'customer_address' : address_name,
+			'contact_person' : contact_name,
+			'address_display' : address_text,
+			'contact_display' : contact_text,
+			'contact_email' : contact_email,
+			'contact_mobile' : contact_mobile
+		}
+		return cstr(ret)	
+			
+	# Get Address Text
+	# -----------------------
+	def get_address_text(self, customer=None, address_name=None, supplier=None, is_shipping_address=None):
+		if customer:
+			cond = customer and 'customer="%s"' % customer or 'name="%s"' % address_name
+		elif supplier:
+			cond = supplier and 'supplier="%s"' % supplier or 'name="%s"' % address_name	
+		else:
+			cond = 'name="%s"' % address_name	
+
+		if is_shipping_address:
+			details = sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1)
+		else:
+			details = sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
+		
+		extract = lambda x: details and details[0] and details[0].get(x,'') or ''
+		address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')]
+		address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])])
+		if address_display.startswith('\n'): address_display = address_display[1:]		
+
+		address_name = details and details[0]['name'] or ''
+		return address_display, address_name
+
+	# Get Contact Text
+	# -----------------------
+	def get_contact_text(self, customer=None, contact_name=None, supplier=None):
+		if customer:
+			cond = customer and 'customer="%s"' % customer or 'name="%s"' % contact_name
+		elif supplier:
+			cond = supplier and 'supplier="%s"' % supplier or 'name="%s"' % contact_name
+		else:
+			cond = 'name="%s"' % contact_name			
+			
+		details = sql("select name, first_name, last_name, email_id, phone, mobile_no, department, designation from `tabContact` where %s and docstatus != 2 order by is_primary_contact desc limit 1" % cond, as_dict = 1)
+
+		extract = lambda x: details and details[0] and details[0].get(x,'') or ''
+		contact_fields = [('','first_name'),('\n','lastname')]
+		contact_display = ''.join([a[0]+extract(a[1]) for a in contact_fields if extract(a[1])])
+		if contact_display.startswith('\n'): contact_display = contact_display[1:]
+		
+		contact_name = details and details[0]['name'] or ''
+		contact_email = details and details[0]['email_id'] or ''
+		contact_mobile = details and details[0]['mobile_no'] or ''
+		return contact_display, contact_name, contact_email, contact_mobile
+
+	# Get Customer Details
+	# -----------------------
+	def get_customer_details(self, name):		
+		customer_details = sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+		if customer_details:
+			self.doc.customer_name = customer_details[0]['customer_name'] or ''
+			self.doc.customer_group = customer_details[0]['customer_group'] or ''
+			self.doc.territory = customer_details[0]['territory'] or ''
+			self.doc.sales_partner = customer_details[0]['default_sales_partner'] or ''
+			self.doc.commission_rate = customer_details[0]['default_commission_rate'] or ''
+			
+	# Get Customer Shipping Address
+	# -----------------------
+	def get_shipping_address(self, name):
+		details = sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where customer = '%s' and docstatus != 2 order by is_shipping_address desc limit 1" %(name), as_dict = 1)
+		
+		extract = lambda x: details and details[0] and details[0].get(x,'') or ''
+		address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')]
+		address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])])
+		if address_display.startswith('\n'): address_display = address_display[1:]
+		
+		ret = {
+			'shipping_address_name' : details and details[0]['name'] or '',
+			'shipping_address' : address_display
+		}
+		return cstr(ret)
+		
+	# Get Lead Details
+	# -----------------------
+	def get_lead_details(self, name):		
+		details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)		
+		
+		extract = lambda x: details and details[0] and details[0].get(x,'') or ''
+		address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','contact_no')]
+		address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])])
+		if address_display.startswith('\n'): address_display = address_display[1:]
+		
+		ret = {
+			'lead_name' : extract('lead_name'),
+			'address_display' : address_display,
+			'territory' : extract('territory'),
+			'contact_mobile' : extract('mobile_no'),
+			'contact_email' : extract('email_id')
+		}
+		return cstr(ret)
+		
+		
+	# Get Supplier Default Primary Address - first load
+	# -----------------------
+	def get_default_supplier_address(self, args):
+		args = load_json(args)
+		address_text, address_name = self.get_address_text(supplier=args['supplier'])
+		contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(supplier=args['supplier'])
+		ret = {
+			'supplier_address' : address_name,
+			'address_display' : address_text,
+			'contact_person' : contact_name,
+			'contact_display' : contact_text,
+			'contact_email' : contact_email,
+			'contact_mobile' : contact_mobile						
+		}
+		ret.update(self.get_supplier_details(args['supplier']))
+		return cstr(ret)
+		
+	# Get Supplier Address
+	# -----------------------
+	def get_supplier_address(self, args):
+		args = load_json(args)
+		address_text, address_name = self.get_address_text(address_name=args['address'])
+		contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(contact_name=args['contact'])
+		ret = {
+			'supplier_address' : address_name,
+			'address_display' : address_text,			
+			'contact_person' : contact_name,
+			'contact_display' : contact_text,
+			'contact_email' : contact_email,
+			'contact_mobile' : contact_mobile
+		}
+		return cstr(ret)	
+	
+	# Get Supplier Details
+	# -----------------------
+	def get_supplier_details(self, name):		
+		supplier_details = sql("select supplier_name from tabSupplier where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+		ret = {
+			'supplier_name' : supplier_details and supplier_details[0]['supplier_name'] or ''
+		}
+		return ret
+		
+	# Get Sales Person Details of Customer
+	# ------------------------------------
+	def get_sales_person(self, name):			
+		self.doc.clear_table(self.doclist,'sales_team')
+		idx = 0
+		for d in sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % name):
+			ch = addchild(self.doc, 'sales_team', 'Sales Team', 1, self.doclist)
+			ch.sales_person = d and cstr(d[0]) or ''
+			ch.allocated_percentage = d and flt(d[1]) or 0
+			ch.allocated_amount = d and flt(d[2]) or 0
+			ch.incentives = d and flt(d[3]) or 0
+			ch.idx = idx
+			idx += 1